Selenium Tests #24
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: Selenium Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| schedule: | |
| # Nightly regression at 18:30 UTC (≈ 04:30 AEST). | |
| - cron: '30 18 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| suite: | |
| description: 'TestNG suite to run' | |
| type: choice | |
| default: testng.xml | |
| options: [testng.xml, testng-smoke.xml] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Compile | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| cache: maven | |
| - name: Compile | |
| run: ./mvnw -B clean test-compile | |
| test: | |
| # Firefox is the gating browser here. Chrome runs in chrome.yml, which does | |
| # not gate — see "An open finding: Chrome on GitHub's runners" in the README | |
| # for the measurements behind that split. | |
| name: firefox | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| cache: maven | |
| # Ubuntu runners ship Firefox. Selenium Manager resolves the matching | |
| # geckodriver at run time, so no driver binaries are installed here. | |
| - name: Run the suite | |
| run: | | |
| ./mvnw -B test \ | |
| -Dsuite=${{ inputs.suite || 'testng.xml' }} \ | |
| -Dbrowser=firefox \ | |
| -Dheadless=true \ | |
| -Dthreads=2 | |
| - name: Upload Allure results | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: allure-results-firefox | |
| path: target/allure-results | |
| retention-days: 7 | |
| - name: Upload Surefire reports | |
| if: failure() | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: surefire-reports-firefox | |
| path: target/surefire-reports | |
| retention-days: 7 | |
| report: | |
| name: Publish Allure report | |
| needs: test | |
| if: ${{ !cancelled() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| cache: maven | |
| - name: Download results | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: allure-results-firefox | |
| # The Allure Maven plugin reads from the build directory, so the | |
| # artifact is restored to exactly where a local run would leave it. | |
| path: target/allure-results | |
| # Generated with the allure-maven plugin already declared in the POM | |
| # rather than a third-party action. The popular marketplace action builds | |
| # from openjdk:8-jre-alpine, an image that no longer exists on Docker Hub, | |
| # so it fails at image pull. | |
| - name: Generate the report | |
| run: ./mvnw -B allure:report | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: target/site/allure-maven-plugin | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 |