-
Notifications
You must be signed in to change notification settings - Fork 74
191 lines (189 loc) · 6.44 KB
/
ci.yaml
File metadata and controls
191 lines (189 loc) · 6.44 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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test-jre21:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
bazel: '8.x'
- os: ubuntu-latest
bazel: '9.x'
- os: macos-latest
bazel: '8.x'
- os: macos-latest
bazel: '9.x'
steps:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: ^1.17
id: go
- name: Setup Bazelisk
run: go install github.com/bazelbuild/bazelisk@latest && export PATH=$PATH:$(go env GOPATH)/bin
- uses: actions/checkout@v4
- name: Run bazel-diff tests
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
run: ~/go/bin/bazelisk coverage --combined_report=lcov //cli/... --enable_bzlmod=true --enable_workspace=false
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report-jre21-${{ matrix.os }}-bazel-${{ matrix.bazel }}
path: bazel-out/_coverage/_coverage_report.dat
if-no-files-found: warn
- name: Upload test logs
uses: actions/upload-artifact@v4
if: always()
with:
name: test-logs-jre21-${{ matrix.os }}-bazel-${{ matrix.bazel }}
path: bazel-testlogs/
if-no-files-found: warn
test-jre11-run-example:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
bazel: '7.x'
disable_workspace: 'false'
extra_flags: ''
- os: ubuntu-latest
bazel: '7.x'
disable_workspace: 'false'
extra_flags: '--incompatible_disable_native_repo_rules'
- os: ubuntu-latest
bazel: '8.x'
disable_workspace: 'true'
extra_flags: ''
- os: ubuntu-latest
bazel: '8.6.0rc1'
disable_workspace: 'true'
extra_flags: ''
- os: ubuntu-latest
bazel: '8.x'
disable_workspace: 'true'
extra_flags: '--incompatible_disable_native_repo_rules'
- os: ubuntu-latest
bazel: '9.x'
disable_workspace: 'true'
extra_flags: ''
- os: ubuntu-latest
bazel: '9.x'
disable_workspace: 'true'
extra_flags: '--incompatible_disable_native_repo_rules'
# Skip Windows + Bazel 7.x due to protobuf compilation issues on MSVC
# Windows is tested with Bazel 8.x and 9.x which are more current
- os: windows-latest
bazel: '8.x'
disable_workspace: 'true'
extra_flags: ''
- os: windows-latest
bazel: '9.x'
disable_workspace: 'true'
extra_flags: ''
steps:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
id: java
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: ^1.17
id: go
- name: Setup Bazelisk (Linux/macOS)
if: runner.os != 'Windows'
run: go install github.com/bazelbuild/bazelisk@latest && export PATH=$PATH:$(go env GOPATH)/bin
- name: Setup Bazelisk (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
go install github.com/bazelbuild/bazelisk@latest
$env:PATH = "$env:PATH;$(go env GOPATH)\bin"
echo "$env:USERPROFILE\go\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run bazel-diff example script (Linux)
if: runner.os != 'Windows'
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
BAZEL_DIFF_DISABLE_WORKSPACE: ${{ matrix.disable_workspace }}
BAZEL_DIFF_FORCE_CHECKOUT: true
BAZEL_EXTRA_COMMAND_OPTIONS: ${{ matrix.extra_flags }}
run: ./bazel-diff-example.sh "$GITHUB_WORKSPACE" ~/go/bin/bazelisk $(git rev-parse HEAD~1) $(git rev-parse HEAD)
- name: Run bazel-diff example script (Windows)
if: runner.os == 'Windows'
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
BAZEL_DIFF_DISABLE_WORKSPACE: ${{ matrix.disable_workspace }}
BAZEL_DIFF_FORCE_CHECKOUT: true
BAZEL_EXTRA_COMMAND_OPTIONS: ${{ matrix.extra_flags }}
shell: pwsh
run: |
$prevRev = git rev-parse HEAD~1
$currRev = git rev-parse HEAD
.\bazel-diff-example.ps1 -WorkspacePath "$env:GITHUB_WORKSPACE" -BazelPath "$env:USERPROFILE\go\bin\bazelisk.exe" -PreviousRevision $prevRev -FinalRevision $currRev
deploy:
needs: [test-jre21]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
strategy:
matrix:
java: [ '11' ]
steps:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
id: java
- name: Setup Go environment
uses: actions/setup-go@v5
with:
go-version: ^1.17
id: go
- name: Setup Bazelisk
run: go install github.com/bazelbuild/bazelisk@latest && export PATH=$PATH:$(go env GOPATH)/bin
- uses: actions/checkout@v4
- name: Build deployable JAR
run: ~/go/bin/bazelisk build //cli:bazel-diff_deploy.jar
- uses: actions/upload-artifact@v4
with:
name: bazel-diff_deploy.jar
path: bazel-bin/cli/bazel-diff_deploy.jar
if-no-files-found: error
- name: Build release source archive
run: make release_source_archive
- uses: actions/upload-artifact@v4
with:
name: release.tar.gz
path: archives/release.tar.gz
if-no-files-found: error
- name: Attest deploy JAR provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: 'bazel-bin/cli/bazel-diff_deploy.jar'
- name: Attest source archive provenance
uses: actions/attest-build-provenance@v2
with:
subject-path: 'archives/release.tar.gz'