-
Notifications
You must be signed in to change notification settings - Fork 34
139 lines (122 loc) · 4.37 KB
/
build.yml
File metadata and controls
139 lines (122 loc) · 4.37 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Build
on:
push:
branches: [main]
pull_request:
jobs:
matrix-build:
permissions:
contents: read
strategy:
fail-fast: false
matrix:
java: [17]
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
java: 21
- os: ubuntu-latest
java: 25
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-os-${{ matrix.os }}-java-${{ matrix.java }}
cancel-in-progress: true
runs-on: ${{ matrix.os }}
defaults:
run:
shell: "bash"
name: "Build on ${{ matrix.os }} with Java ${{ matrix.java }}"
env:
DEFAULT_JAVA: 17
DEFAULT_OS: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-java@v5
name: Set up Java ${{ matrix.java }}
with:
distribution: "temurin"
java-version: ${{ matrix.java }}
cache: "maven"
- name: Cache SonarQube packages
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }}
uses: actions/cache@v5
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Build with Java ${{ matrix.java }}
run: |
mvn --batch-mode -T 1C clean org.jacoco:jacoco-maven-plugin:prepare-agent install \
-Dossindex.skip=true \
-Djava.version=${{ matrix.java }}
- name: Sonar analysis
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }}
run: |
mvn --batch-mode org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
-Dsonar.token=$SONAR_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Verify reproducible build
# Build fails on Windows with error: "Failed to execute goal org.apache.maven.plugins:maven-artifact-plugin:3.5.0:compare (default-cli) on project openfasttrace-reporter-plaintext: Could not copy D:\a\openfasttrace\openfasttrace\reporter\plaintext\target\openfasttrace-reporter-plaintext-3.8.0.buildcompareto D:\a\openfasttrace\openfasttrace\target\openfasttrace-root-0.0.0.buildcompare"
if: ${{ matrix.os != 'windows-latest' }}
run: |
mvn --batch-mode -T 1C clean verify artifact:compare -DskipTests \
-Dossindex.skip=true \
-Djava.version=${{ matrix.java }}
- name: Archive oft binary
uses: actions/upload-artifact@v7
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }}
with:
name: openfasttrace-binaries
path: |
product/target/openfasttrace-*.jar
!product/target/openfasttrace-*-javadoc.jar
!product/target/openfasttrace-*-sources.jar
if-no-files-found: error
- name: Run self-trace
run: ./oft-self-trace.sh
- name: Upload self-tracing report
uses: actions/upload-artifact@v7
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }}
with:
name: self-tracing-report
path: target/self-trace-report.html
if-no-files-found: error
- name: Check shell scripts
if: ${{ env.DEFAULT_OS == matrix.os && env.DEFAULT_JAVA == matrix.java }}
run: .github/workflows/run_shellcheck.sh
ossindex:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-java@v5
with:
cache: maven
distribution: temurin
java-version: 17
server-id: ossindex
server-username: OSSINDEX_USERNAME
server-password: OSSINDEX_TOKEN
- name: Ossindex
run: |
mvn -T 1C --errors --batch-mode test-compile \
org.sonatype.ossindex.maven:ossindex-maven-plugin:audit \
org.sonatype.ossindex.maven:ossindex-maven-plugin:audit-aggregate
env:
OSSINDEX_USERNAME: ${{ secrets.OSSINDEX_USERNAME }}
OSSINDEX_TOKEN: ${{ secrets.OSSINDEX_TOKEN }}
build:
permissions:
contents: read
needs:
- matrix-build
- ossindex
runs-on: ubuntu-slim
steps:
- run: echo "Build successful"