-
Notifications
You must be signed in to change notification settings - Fork 239
99 lines (84 loc) · 2.64 KB
/
build.yml
File metadata and controls
99 lines (84 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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: "Build with Gradle"
run: ./gradlew build -x test --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
- 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 }}
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 }}