name: Tests on: push: branches: [main] pull_request: workflow_dispatch: # Needed for the gh-pages publish step. permissions: contents: write jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - name: Install dependencies run: npm install - name: Run tests (Allure results) env: ALLURE_RESULTS_DIR: allure-results run: npm run test:allure # node:test nests everything under the `test/` directory; flatten so the # tree top level is the test file, matching the pytest report. - name: Flatten Allure tree if: always() run: node scripts/allure-flatten.mjs allure-results # Everything below builds + publishes the Allure report even when tests # fail, so the report always reflects the latest run. - name: Get previous Allure history if: always() uses: actions/checkout@v4 continue-on-error: true with: ref: gh-pages path: gh-pages-prev - name: Restore Allure history if: always() run: | if [ -f gh-pages-prev/history/history.jsonl ]; then mkdir -p history cp gh-pages-prev/history/history.jsonl history/history.jsonl fi # Allure Report 3 (the `allure` npm package + awesome plugin). Pure Node, # no Java needed. Produces the modern "awesome" UI and a root summary.json. - name: Generate Allure report if: always() run: npx allure generate allure-results - name: Bundle history into report if: always() run: | mkdir -p allure-report/history if [ -f history/history.jsonl ]; then cp history/history.jsonl allure-report/history/history.jsonl fi - name: Publish to GitHub Pages if: always() uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: allure-report