Repository navigation
184 lines (174 loc) · 8.04 KB
/
Copy pathworkflow.yml
File metadata and controls
184 lines (174 loc) · 8.04 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
name: CEL-Java CI
run-name: Workflow started by ${{ github.actor }}.
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
# Cancel previous workflows on the PR when there are multiple fast commits.
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
Bazel-Build-Java8:
runs-on: cel-java-ubuntu-4core
timeout-minutes: 30
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
- run: echo "🔎 The name of your branch is ${GITHUB_REF} and your repository is ${GITHUB_REPOSITORY}."
- name: Check out repository code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
# Share repository cache between workflows.
repository-cache: true
bazelrc: |
build --disk_cache=/home/runner/.cache/bazel-disk
# Prevent PRs from polluting cache
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Restore Bazel disk cache
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
restore-keys: |
bazel-disk-${{ runner.os }}-${{ github.job }}-
- name: Mark job start
run: touch "$RUNNER_TEMP/job-start"
- name: Bazel Output Version
run: bazelisk --version
- name: Java 8 Build
run: bazel build ... --java_language_version=8 --java_runtime_version=8 --build_tag_filters=-conformance_maven
- name: Unwanted Dependencies
run: .github/workflows/unwanted_deps.sh
- name: Cross-artifact Duplicate Classes Check
run: .github/workflows/cross_artifact_dependencies_check.sh
- name: Prune disk cache entries not used by this job
# Bazel bumps mtimes on use; drop stale entries so the saved cache doesn't grow unbounded.
if: github.event_name != 'pull_request'
run: |
if [ -d ~/.cache/bazel-disk ]; then
du -sh ~/.cache/bazel-disk
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
du -sh ~/.cache/bazel-disk
fi
- name: Save Bazel disk cache
if: github.event_name != 'pull_request'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
- run: echo "🍏 This job's status is ${JOB_STATUS}."
env:
JOB_STATUS: ${{ job.status }}
Bazel-Tests:
runs-on: cel-java-ubuntu-4core
timeout-minutes: 30
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
- run: echo "🔎 The name of your branch is ${GITHUB_REF} and your repository is ${GITHUB_REPOSITORY}."
- name: Check out repository code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Setup Bazel
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
# Share repository cache between workflows.
repository-cache: true
bazelrc: |
build --disk_cache=/home/runner/.cache/bazel-disk
# Prevent PRs from polluting cache
cache-save: ${{ github.event_name != 'pull_request' }}
- name: Restore Bazel disk cache
uses: actions/cache/restore@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
restore-keys: |
bazel-disk-${{ runner.os }}-${{ github.job }}-
- name: Mark job start
run: touch "$RUNNER_TEMP/job-start"
- name: Bazel Output Version
run: bazelisk --version
- name: Bazel Test
# Exclude codelab exercises as they are intentionally made to fail
# Exclude maven conformance tests. They are only executed when there's version change.
run: bazelisk test ... --deleted_packages=//codelab/src/test/codelab --test_output=errors --test_tag_filters=-conformance_maven --build_tag_filters=-conformance_maven
- name: Prune disk cache entries not used by this job
# Bazel bumps mtimes on use; drop stale entries so the saved cache doesn't grow unbounded.
if: github.event_name != 'pull_request'
run: |
if [ -d ~/.cache/bazel-disk ]; then
du -sh ~/.cache/bazel-disk
find ~/.cache/bazel-disk -type f ! -newer "$RUNNER_TEMP/job-start" -delete
du -sh ~/.cache/bazel-disk
fi
- name: Save Bazel disk cache
if: github.event_name != 'pull_request'
uses: actions/cache/save@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: ~/.cache/bazel-disk
key: bazel-disk-${{ runner.os }}-${{ github.job }}-${{ github.sha }}
- run: echo "🍏 This job's status is ${JOB_STATUS}."
env:
JOB_STATUS: ${{ job.status }}
# -- Start of Maven Conformance Tests (Ran only when there's version changes) --
Maven-Conformance:
runs-on: cel-java-ubuntu-4core
timeout-minutes: 30
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
- run: echo "🔎 The name of your branch is ${GITHUB_REF} and your repository is ${GITHUB_REPOSITORY}."
- name: Check out repository code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
# Full history so changed-files doesn't need credentials to fetch more.
fetch-depth: 0
persist-credentials: false
- name: Get changed files
id: changed_file
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47.0.0
with:
files: publish/cel_version.bzl
- name: Setup Bazel
if: steps.changed_file.outputs.any_changed == 'true'
uses: bazel-contrib/setup-bazel@083175551ceeceebc757ebee2127fde78840ca77 # 0.18.0
with:
# Share repository cache between workflows.
repository-cache: true
# Never write to the cache, strictly read-only
cache-save: false
- name: Verify Version Consistency
if: steps.changed_file.outputs.any_changed == 'true'
run: |
CEL_VERSION=$(grep 'CEL_VERSION =' publish/cel_version.bzl | cut -d '"' -f 2)
MODULE_VERSION=$(grep 'CEL_VERSION =' MODULE.bazel | cut -d '"' -f 2)
if [ -z "$CEL_VERSION" ] || [ -z "$MODULE_VERSION" ]; then
echo "❌ Error: Could not extract one or both version strings."
exit 1
fi
echo "Version in publish/cel_version.bzl: ${CEL_VERSION}"
echo "Version in MODULE.bazel: ${MODULE_VERSION}"
if [ "$CEL_VERSION" != "$MODULE_VERSION" ]; then
echo "❌ Error: Version mismatch between files!"
exit 1
fi
echo "✅ Versions match."
- name: Run Conformance Maven Test on Version Change
if: steps.changed_file.outputs.any_changed == 'true'
run: bazelisk test //conformance/src/test/java/dev/cel/conformance:conformance_maven --test_output=errors
- run: echo "🍏 This job's status is ${JOB_STATUS}."
env:
JOB_STATUS: ${{ job.status }}