Refactor Allure Lifecycle for v3 #1372
Workflow file for this run
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: Build | |
| permissions: | |
| contents: read | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - '*' | |
| push: | |
| branches: | |
| - 'main' | |
| - 'hotfix-*' | |
| concurrency: | |
| # On main, we don't want any jobs cancelled. | |
| # On PR branches, we cancel the job if new commits are pushed. | |
| group: ${{ github.ref }} | |
| cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
| jobs: | |
| build: | |
| name: "Build (JDK ${{ matrix.java }})" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| java: [17, 25] | |
| env: | |
| ALLURE_MATRIX_ENV: ubuntu-jdk-${{ matrix.java }} | |
| ALLURE_TEST_DUMP_NAME: allure-results-test-jdk-${{ matrix.java }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20.x' | |
| - name: "Set up JDK" | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: ${{ matrix.java }} | |
| - name: "Setup Gradle" | |
| uses: gradle/actions/setup-gradle@v6 | |
| with: | |
| gradle-version: 'wrapper' | |
| - name: "Select Gradle task exclusions" | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.java }}" == "17" ]]; then | |
| higher_java_modules=( | |
| ":allure-jooq" | |
| ":allure-karate" | |
| ) | |
| excludes=() | |
| for module in "${higher_java_modules[@]}"; do | |
| excludes+=("-x" "$module:build" "-x" "$module:test") | |
| done | |
| echo "GRADLE_EXCLUDES=${excludes[*]}" >> "$GITHUB_ENV" | |
| fi | |
| - name: "Build with Gradle" | |
| run: ./gradlew build -x test $GRADLE_EXCLUDES --scan | |
| - name: "Run tests with Allure" | |
| if: always() | |
| run: npx -y allure@3 run --config ./allurerc.mjs --rerun 2 --environment="${{ env.ALLURE_MATRIX_ENV }}" --dump="${{ env.ALLURE_TEST_DUMP_NAME }}" -- ./gradlew --no-build-cache cleanTest test $GRADLE_EXCLUDES | |
| - name: "Upload Allure test dump" | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: ${{ env.ALLURE_TEST_DUMP_NAME }} | |
| path: ./${{ env.ALLURE_TEST_DUMP_NAME }}.zip | |
| report: | |
| needs: [build] | |
| name: "Build report" | |
| runs-on: ubuntu-latest | |
| if: always() | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| checks: write | |
| env: | |
| ALLURE_SERVICE_TOKEN: ${{ secrets.ALLURE_SERVICE_TOKEN }} | |
| ALLURE_TOKEN: ${{ secrets.ALLURE_TOKEN }} | |
| ALLURE_ENDPOINT: ${{ secrets.ALLURE_ENDPOINT }} | |
| ALLURE_PROJECT_ID: ${{ secrets.ALLURE_PROJECT_ID }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20.x' | |
| - name: "Download Allure dumps" | |
| uses: actions/download-artifact@v8 | |
| continue-on-error: true | |
| with: | |
| pattern: allure-results-* | |
| path: ./ | |
| merge-multiple: true | |
| - name: "Generate Allure report" | |
| run: npx -y allure@3 generate --config ./allurerc.mjs --dump="allure-results-*.zip" --output=./build/allure-report | |
| - name: "Post Allure summary" | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false | |
| uses: allure-framework/allure-action@v0 | |
| with: | |
| report-directory: ./build/allure-report | |
| github-token: ${{ secrets.GITHUB_TOKEN }} |