Skip to content

Merge branch 'main' of https://github.com/TheJinius/CS203-Project #259

Merge branch 'main' of https://github.com/TheJinius/CS203-Project

Merge branch 'main' of https://github.com/TheJinius/CS203-Project #259

Workflow file for this run

name: Run Tests
on:
push:
branches: [ main, develop, backend ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Start Docker (for Testcontainers)
run: |
echo "Docker is available for Testcontainers"
docker --version
- name: Run all tests with Testcontainers
run: mvn clean test -Dspring.profiles.active=test
env:
# Redis configuration (dummy values for tests that don't use Redis)
REDIS_URL: localhost
REDIS_PORT: 6379
REDIS_USERNAME: ""
REDIS_PASSWORD: ""
# Cognito OAuth2 configuration (dummy values for tests)
COGNITO_ISSUER: https://dummy-issuer.com
COGNITO_TOKEN_SIGNING_KEY_URL: https://dummy-issuer.com/.well-known/jwks.json
COGNITO_DOMAIN: dummy-domain
AWS_REGION: us-east-1
COGNITO_CLIENT_ID: dummy-client-id
WITS_USERNAME: test-username
WITS_PASSWORD: test-password
# Database configuration (Testcontainers will handle this)
# The test profile uses Testcontainers with PostgreSQL
SPRING_PROFILES_ACTIVE: test
- name: Generate test coverage report
run: mvn jacoco:report
continue-on-error: true
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: |
target/surefire-reports/
target/site/jacoco/
retention-days: 30
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: success()
with:
name: coverage-report
path: target/site/jacoco/
retention-days: 30
- name: Test Summary
uses: test-summary/action@v2
if: always()
with:
paths: target/surefire-reports/*.xml