E2E #178
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: E2E | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [ main ] | |
| # Run on direct pushes only when the E2E infrastructure itself changed. | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - ".github/workflows/e2e.yml" | |
| - "docker-compose.e2e.yml" | |
| - "scripts/e2e/**" | |
| - "app/tests/e2e/**" | |
| schedule: | |
| - cron: "30 2 * * *" | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| jobs: | |
| e2e: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| env: | |
| APP_CONTAINER: learning-app | |
| DB_CONTAINER: learning-db | |
| E2E_BASE_URL: http://localhost:8080/apps/learning | |
| E2E_USERNAME: admin | |
| E2E_PASSWORD: admin | |
| CI: "true" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: app/package-lock.json | |
| - name: Verify Node runtime | |
| run: | | |
| node -v | |
| npm -v | |
| - name: Install app dependencies | |
| run: npm --prefix app ci | |
| - name: Build frontend | |
| run: npm --prefix app run build | |
| - name: Start Nextcloud stack | |
| run: docker compose -f docker-compose.e2e.yml up -d | |
| - name: Wait for Nextcloud | |
| run: bash scripts/e2e/wait-nextcloud.sh | |
| - name: Disable App Store in CI | |
| run: docker exec ${{ env.APP_CONTAINER }} php occ config:system:set appstoreenabled --value=false --type=boolean | |
| - name: Disable first-run wizard and notifications in CI | |
| run: | | |
| docker exec ${{ env.APP_CONTAINER }} php occ app:disable firstrunwizard || true | |
| docker exec ${{ env.APP_CONTAINER }} php occ app:disable notifications || true | |
| - name: Grant admin instructor role in CI | |
| run: | | |
| docker exec ${{ env.APP_CONTAINER }} php occ group:add learning-instructors || true | |
| docker exec ${{ env.APP_CONTAINER }} php occ group:adduser learning-instructors admin || true | |
| - name: Install learning app into CI container | |
| run: | | |
| docker exec learning-app sh -lc 'mkdir -p /var/www/html/custom_apps/learning' | |
| tar \ | |
| --exclude=node_modules \ | |
| --exclude=tests/e2e/.auth \ | |
| --exclude=tests/e2e/.env.generated \ | |
| --exclude=playwright-report \ | |
| -C app -cf - . | docker exec -i learning-app tar -xf - -C /var/www/html/custom_apps/learning | |
| docker exec learning-app sh -lc 'chown -R www-data:www-data /var/www/html/custom_apps/learning' | |
| docker exec learning-app php occ app:enable learning | |
| docker exec learning-app php occ upgrade | |
| docker exec learning-app php occ status --output=json | |
| - name: Install Playwright browser | |
| run: npx --prefix app playwright install --with-deps chromium | |
| - name: Seed E2E fixtures | |
| run: bash scripts/e2e/seed-fixtures.sh | |
| - name: Run E2E tests | |
| run: | | |
| set -a | |
| source app/tests/e2e/.env.generated | |
| set +a | |
| npm --prefix app run test:e2e:ci | |
| - name: Upload Playwright report | |
| if: always() | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: playwright-report | |
| path: | | |
| app/playwright-report | |
| app/test-results | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| - name: Dump container logs on failure | |
| if: failure() | |
| run: | | |
| docker logs learning-app || true | |
| docker logs learning-db || true |