Skip to content

Commit a309fe8

Browse files
committed
chore(ci): simplify GHA setup and target mac/windows only
We now test Linux on Aspect Workflows
1 parent c1d78ec commit a309fe8

File tree

2 files changed

+6
-134
lines changed

2 files changed

+6
-134
lines changed

.bazeliskrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 6 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,8 @@ concurrency:
1818
cancel-in-progress: ${{ github.ref_name != 'main' }}
1919

2020
jobs:
21-
# Prepares dynamic test matrix values
22-
matrix-prep:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v4
26-
- id: bazel-version
27-
name: Prepare 'bazel-version' matrix axis
28-
run: |
29-
v=$(head -n 1 .bazelversion)
30-
m=${v::1}
31-
a=(
32-
"major:$m, version:\"$v\""
33-
"major:8, version:\"8.3.1\""
34-
"major:6, version:\"6.5.0\""
35-
)
36-
printf -v j '{%s},' "${a[@]}"
37-
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
38-
- id: os
39-
name: Prepare 'os' matrix axis
40-
# Only run MacOS and Windows on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively)
41-
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
42-
run: |
43-
a=( ubuntu )
44-
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"macos"* ]]; then
45-
a+=( macos )
46-
fi
47-
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"windows"* ]]; then
48-
a+=( windows )
49-
fi
50-
printf -v j '"%s",' "${a[@]}"
51-
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
52-
outputs:
53-
bazel-version: ${{ steps.bazel-version.outputs.res }}
54-
os: ${{ steps.os.outputs.res }}
55-
5621
test:
57-
runs-on: ${{ matrix.os }}-latest
22+
runs-on: ${{ matrix.os }}
5823
needs:
5924
- matrix-prep
6025
defaults:
@@ -63,119 +28,28 @@ jobs:
6328
strategy:
6429
fail-fast: false
6530
matrix:
66-
bazel-version: ${{ fromJSON(needs.matrix-prep.outputs.bazel-version) }}
67-
bzlmod: [1, 0]
68-
os: ${{ fromJSON(needs.matrix-prep.outputs.os) }}
31+
os: [macos, windows]
6932
folder:
7033
- '.'
7134
- 'e2e/smoke'
7235
- 'e2e/external_dep'
7336
- 'e2e/external_dep/app'
7437
- 'e2e/worker'
75-
exclude:
76-
# Don't test MacOS and Windows against secondary bazel version to minimize minutes (billed at 10X and 2X respectively)
77-
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
78-
- os: macos
79-
bazel-version:
80-
major: 6
81-
- os: windows
82-
bazel-version:
83-
major: 6
84-
# Linux on the primary bazel version is tested on Aspect Workflows
85-
- os: ubuntu
86-
bazel-version:
87-
major: 7
88-
bzlmod: 1
89-
# Don't test root workspace with Bazel 6 to reduce the size of the test matrix
90-
- bazel-version:
91-
major: 6
92-
folder: .
93-
# Don't test non-bzlmod with Bazel 6 to reduce the size of the test matrix
94-
- bazel-version:
95-
major: 6
96-
bzlmod: 0
97-
# Don't test non-bzlmod with Bazel 8 where only modern bzlmod should be used
98-
- bazel-version:
99-
major: 8
100-
bzlmod: 0
101-
# Don't test root workspace with non-bzlmod
102-
- bzlmod: 0
103-
folder: .
104-
# TODO: e2e/smoke broken with bazel6
105-
- bazel-version:
106-
major: 6
107-
folder: e2e/smoke
108-
# TODO: broken on bazel 8
109-
- bazel-version:
110-
major: 8
111-
folder: e2e/external_dep
112-
# TODO: broken on bazel 8
113-
- bazel-version:
114-
major: 8
115-
folder: e2e/external_dep/app
116-
# Disable some broken tests on Windows
117-
- os: windows
118-
folder: .
119-
- os: windows
120-
folder: e2e/worker
12138
include:
122-
# Additional docs tests
123-
- bazel-version:
124-
major: 7
125-
version: 7.3.2
126-
bzlmod: 1
127-
folder: docs
128-
os: ubuntu
39+
folder: docs
40+
os: ubuntu
12941

13042
# Steps represent a sequence of tasks that will be executed as part of the job
13143
steps:
13244
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
13345
- uses: actions/checkout@v4
134-
135-
- name: Mount bazel caches
136-
uses: actions/cache@v4
137-
with:
138-
# Cache the --dist_cache and --repository_cache directories (see ci.bazelrc)
139-
# and the default bazel output (https://bazel.build/remote/output-directories#layout)
140-
# and bazelisk cache.
141-
path: |
142-
~/.cache/bazel-disk-cache
143-
~/.cache/bazel-repository-cache
144-
~/.cache/bazel
145-
~/.cache/bazelisk
146-
key: >-
147-
bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-
148-
${{ hashFiles('.bazelrc', '.bazelversion', '.bazeliskrc', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel', '**/*.js', '!e2e') }}-
149-
${{ hashFiles(format('{0}/.bazelrc', matrix.folder), format('{0}/.bazelversion', matrix.folder), format('{0}/.bazeliskrc', matrix.folder), format('{0}/**/BUILD', matrix.folder), format('{0}/**/BUILD.bazel', matrix.folder), format('{0}/**/*.bzl', matrix.folder), format('{0}/WORKSPACE', matrix.folder), format('{0}/WORKSPACE.bazel', matrix.folder), format('{0}/WORKSPACE.bzlmod', matrix.folder), format('{0}/MODULE.bazel', matrix.folder), format('{0}/MODULE.bazel.lock', matrix.folder), format('{0}/**/*.js', matrix.folder)) }}
150-
restore-keys: |
151-
bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-
152-
153-
- name: Configure Bazel version
154-
shell: bash
155-
run: |
156-
# Overwrite the .bazelversion instead of using USE_BAZEL_VERSION so that Bazelisk
157-
# still bootstraps Aspect CLI from configuration in .bazeliskrc. Aspect CLI will
158-
# then use .bazelversion to determine which Bazel version to use.
159-
echo "${{ matrix.bazel-version.version }}" > .bazelversion
160-
161-
# TODO: remove this block once we have Aspect CLI Windows releases
162-
- name: Don't use Aspect CLI on Windows
163-
if: matrix.os == 'windows'
164-
shell: bash
165-
run: rm -f .bazeliskrc
166-
46+
- uses: bazel-contrib/setup-bazel@20a70d3f3125a766bb29e2f597a2200896c37c98
16747
- name: bazel test //...
16848
shell: bash
16949
run: |
17050
bazel \
17151
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \
172-
test \
173-
--config=ci \
174-
--incompatible_merge_fixed_and_default_shell_env \
175-
--test_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }},-skip-on-bzlmod-${{ matrix.bzlmod }} \
176-
--build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }},-skip-on-bzlmod-${{ matrix.bzlmod }} \
177-
--enable_bzlmod=${{ matrix.bzlmod }} \
178-
//...
52+
test --config=ci //...
17953
18054
bats-tests:
18155
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)