Repository navigation
Warden v3 #1030
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| actions: read | |
| pull-requests: read | |
| jobs: | |
| dedupe: | |
| name: Avoid Duplicate Test Runs | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| outputs: | |
| should_run: ${{ steps.dedupe.outputs.should_run }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Decide whether this run owns the tests | |
| id: dedupe | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} | |
| run: bash .github/scripts/should-run-tests-workflow.sh | |
| scripts: | |
| name: Repository Script Tests | |
| needs: dedupe | |
| if: needs.dedupe.outputs.should_run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.12.0 | |
| - name: Test workflow and fixture scripts | |
| run: node --test .github/tests/*.test.mjs mock-db/tests/*.test.mjs | |
| detect-changes: | |
| name: Detect Changes | |
| needs: dedupe | |
| if: needs.dedupe.outputs.should_run == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| outputs: | |
| frontend: ${{ steps.filter.outputs.frontend }} | |
| backend: ${{ steps.filter.outputs.backend }} | |
| launcher: ${{ steps.filter.outputs.launcher }} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Detect changed components | |
| id: filter | |
| env: | |
| DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PUSH_BEFORE_SHA: ${{ github.event.before }} | |
| run: bash .github/scripts/detect-component-changes.sh | |
| frontend: | |
| name: Frontend Tests | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.frontend == 'true' && github.repository == 'Modtale/modtale' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Modtale/modtale') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: frontend | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.12.0 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: npm ci | |
| - name: Check frontend types | |
| run: npm run check | |
| - name: Run frontend tests | |
| run: npm run test | |
| backend: | |
| name: Backend Tests | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.backend == 'true' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: backend | |
| env: | |
| MONGODB_URI: mongodb://localhost:27017/modtale-test | |
| MONGODB_DATABASE_NAME: modtale-test | |
| R2_BUCKET_NAME: modtale-test | |
| R2_ACCESS_KEY: test-access-key | |
| R2_SECRET_KEY: test-secret-key | |
| R2_ENDPOINT: https://example.com | |
| R2_PUBLIC_DOMAIN: https://cdn.example.com | |
| FRONTEND_URL: http://localhost:5173 | |
| BACKEND_URL: http://localhost:8080 | |
| WARDEN_ENABLED: "false" | |
| PRE_AUTH_SECRET: test-pre-auth-secret | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 26 | |
| check-latest: true | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Ensure Gradle wrapper is executable | |
| run: chmod +x gradlew | |
| - name: Run backend tests | |
| run: ./gradlew test | |
| launcher: | |
| name: Launcher Tests | |
| needs: detect-changes | |
| if: needs.detect-changes.outputs.launcher == 'true' && github.repository == 'Modtale/modtale' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Modtale/modtale') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: launcher | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: 26 | |
| check-latest: true | |
| - name: Set up Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Ensure Gradle wrapper is executable | |
| run: chmod +x gradlew | |
| - name: Install Wayland compositor for JavaFX tests | |
| run: | | |
| sudo apt-get update | |
| sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | |
| libgtk-3-0t64 libopengl0 libegl1 libpango-1.0-0 libasound2t64 \ | |
| libudev1 libwayland-client0 libwayland-egl1 | |
| sudo apt-get install -y weston libgl1-mesa-dri | |
| - name: Run launcher tests | |
| run: | | |
| set -euo pipefail | |
| # Run Linux validation without an X server. | |
| export XDG_RUNTIME_DIR | |
| XDG_RUNTIME_DIR=$(mktemp -d) | |
| export WAYLAND_DISPLAY=modtale-validation | |
| weston --backend=headless-backend.so --renderer=pixman --socket="$WAYLAND_DISPLAY" --idle-time=0 \ | |
| --width=1600 --height=1000 --no-config > "$XDG_RUNTIME_DIR/weston.log" 2>&1 & | |
| weston_pid=$! | |
| trap 'kill "$weston_pid" 2>/dev/null || true; cat "$XDG_RUNTIME_DIR/weston.log"; rm -rf "$XDG_RUNTIME_DIR"' EXIT | |
| for attempt in {1..100}; do | |
| if [ -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]; then break; fi | |
| kill -0 "$weston_pid" | |
| sleep 0.1 | |
| done | |
| test -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" | |
| env -u DISPLAY GDK_BACKEND=wayland ./gradlew test --no-daemon | |
| - name: Upload launcher test reports | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: launcher-test-reports | |
| path: | | |
| launcher/build/reports/tests/test | |
| launcher/build/test-results/test | |
| if-no-files-found: ignore |