Skip to content
Merged

Dev #66

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .concat.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Afrontend/lib
backend/tests
backend/user_auth_service/app
backend/event_ticketing_service/app

6 changes: 6 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ DB_PASSWORD=localpassword
SECRET_KEY=a-very-secret-key-for-local-development-change-me
ACCESS_TOKEN_EXPIRE_MINUTES=30
ADMIN_SECRET_KEY=local-admin-secret-key
INITIAL_ADMIN_EMAIL=admin@resellio.com
INITIAL_ADMIN_PASSWORD=AdminPassword123!

# SendGrid Email Configuration
EMAIL_API_KEY="api-key-placeholder"
EMAIL_FROM_EMAIL="sender-email-placeholder"
82 changes: 29 additions & 53 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
name: API Tests
name: Run Tests

on:
push:
branches: [ main, dev ]
pull_request:
# Be explicit about which events trigger the workflow for PRs
types: [ opened, synchronize, reopened ]
branches: [ main, dev ]
workflow_dispatch:

jobs:
test:
backend-tests:
runs-on: ubuntu-latest
name: "Backend Python Tests"

steps:
- name: Checkout code
Expand All @@ -25,63 +28,36 @@ jobs:

- name: Create .env file for Docker Compose
run: |
source ./scripts/utils/print.bash
pretty_info "Creating root .env file for Docker Compose..."
echo "Creating .env file from template..."
cp .env.template .env
pretty_success ".env file created successfully."
gen_separator '-'
pretty_info ".env content"
cat .env
gen_separator '-'
echo ".env file created."

- name: Start services with Docker Compose
run: |
source ./scripts/utils/print.bash
pretty_info "Starting services with Docker Compose..."
docker compose up -d --build
pretty_success "Services started."
- name: Run Backend API tests
run: ./scripts/actions/run_tests.bash backend local

- name: Wait for API to be ready
run: |
source ./scripts/utils/print.bash
pretty_info "Waiting for API Gateway to become healthy..."
timeout 120s bash -c '
source ./scripts/utils/print.bash
until curl -fs http://localhost:8080/health &>/dev/null; do
pretty_info "Waiting for API Gateway...";
sleep 5;
done
'
pretty_success "API Gateway is ready!"
- name: Show logs on failure
if: failure()
run: echo "Test script failed. Logs are part of the script output."

frontend-tests:
runs-on: ubuntu-latest
name: "Frontend Flutter Tests"

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Show running service status
# Combined the two run steps into one named step
- name: Prepare scripts and .env file
run: |
source ./scripts/utils/print.bash
gen_separator '='
pretty_info "Docker Compose Status"
docker compose ps
gen_separator '='
pretty_info "Pinging health check endpoint again:"
curl -f http://localhost:8080/health
chmod +x ./scripts/utils/print.bash ./scripts/actions/run_tests.bash
echo "Creating .env file from template..."
cp .env.template .env
echo ".env file created."

- name: Run API tests
run: ./scripts/actions/run_tests.bash local
- name: Run Frontend (Flutter) tests via Docker Compose
run: ./scripts/actions/run_tests.bash frontend local

- name: Show logs on failure
if: failure()
run: |
source ./scripts/utils/print.bash
pretty_error "Tests failed. Dumping service logs..."
gen_separator '='
pretty_info "Service Logs"
gen_separator '='
docker compose logs
gen_separator '='

- name: Cleanup services
if: always()
run: |
source ./scripts/utils/print.bash
pretty_info "Cleaning up Docker Compose services and volumes..."
docker compose down -v
pretty_success "Cleanup complete."
run: echo "Test script failed. Logs are part of the script output."
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ credentials.json
# Temporary files / Misc
tmp/
tmp

concat.conf

notes.py
Loading