Skip to content

Commit c772c79

Browse files
committed
ci: fix windows testing
1 parent b62813a commit c772c79

14 files changed

Lines changed: 133 additions & 197 deletions

File tree

.aspect/workflows/bazelrc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
# build without the bytes
2-
common --remote_download_outputs=minimal
3-
common --nobuild_runfile_links
1+
# Flags for Aspect Workflows are provided by tools/preset.bazelrc via each workspace's .bazelrc
2+
# and activated by --config=ci in .aspect/workflows/config.yaml bazel.flags

.aspect/workflows/config.yaml

Lines changed: 67 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,102 @@ workspaces:
33
.:
44
icon: webpack
55
label: rules_webpack
6+
tasks:
7+
# Root repository is bzlmod-only
8+
- bazel-7-no-bzlmod:
9+
without: true
610
e2e/loaders:
711
icon: bazel
812
tasks:
9-
- test:
10-
queue: aspect-medium
13+
# loaders only has WORKSPACE (no MODULE.bazel)
14+
- bazel-7:
15+
without: true
16+
- bazel-8:
17+
without: true
18+
- bazel-9:
19+
without: true
1120
- buildifier:
1221
without: true
1322
e2e/loaders_jslib:
1423
icon: bazel
1524
tasks:
16-
- test:
17-
queue: aspect-medium
25+
# loaders_jslib only has WORKSPACE (no MODULE.bazel)
26+
- bazel-7:
27+
without: true
28+
- bazel-8:
29+
without: true
30+
- bazel-9:
31+
without: true
1832
- buildifier:
1933
without: true
2034
e2e/smoke:
2135
icon: bazel
2236
tasks:
23-
- test:
24-
queue: aspect-medium
2537
- buildifier:
2638
without: true
2739
e2e/smoke_rjs3:
2840
icon: bazel
2941
tasks:
30-
- test:
31-
queue: aspect-medium
42+
# smoke_rjs3 is bzlmod-only
43+
- bazel-7-no-bzlmod:
44+
without: true
3245
- buildifier:
3346
without: true
3447
e2e/worker:
3548
icon: bazel
3649
tasks:
37-
- test:
38-
queue: aspect-medium
50+
# worker MODULE.bazel not yet migrated (TODO)
51+
- bazel-7:
52+
without: true
53+
- bazel-8:
54+
without: true
55+
- bazel-9:
56+
without: true
3957
- buildifier:
4058
without: true
59+
bazel:
60+
flags:
61+
- --config=ci
4162
tasks:
4263
- checkout:
4364
update_strategy: rebase
4465
- test:
66+
name: Bazel 7
67+
id: bazel-7
68+
bazel:
69+
flags:
70+
- --test_tag_filters=-skip-on-bazel7
71+
- --build_tag_filters=-skip-on-bazel7
72+
env:
73+
USE_BAZEL_VERSION: 7.x
74+
- test:
75+
name: Bazel 7 (no bzlmod)
76+
id: bazel-7-no-bzlmod
77+
bazel:
78+
flags:
79+
- --noenable_bzlmod
80+
- --test_tag_filters=-skip-on-bazel7
81+
- --build_tag_filters=-skip-on-bazel7
82+
env:
83+
USE_BAZEL_VERSION: 7.x
84+
- test:
85+
name: Bazel 8
86+
id: bazel-8
87+
bazel:
88+
flags:
89+
- --test_tag_filters=-skip-on-bazel8
90+
- --build_tag_filters=-skip-on-bazel8
91+
env:
92+
USE_BAZEL_VERSION: 8.x
93+
- test:
94+
name: Bazel 9
95+
id: bazel-9
96+
bazel:
97+
flags:
98+
- --test_tag_filters=-skip-on-bazel9
99+
- --build_tag_filters=-skip-on-bazel9
100+
env:
101+
USE_BAZEL_VERSION: 9.x
45102
- buildifier:
46103
queue: aspect-medium
47104
- finalization:

.github/workflows/BUILD.bazel

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets")
2-
3-
write_aspect_bazelrc_presets(
4-
name = "update_aspect_bazelrc_presets",
5-
presets = [
6-
"bazel6",
7-
"bazel7",
8-
],
9-
)
1+
# Intentionally empty - bazelrc presets are generated by //tools:preset
2+
# See tools/BUILD.bazel which uses bazelrc-preset.bzl to generate tools/preset.bazelrc

.github/workflows/bazel6.bazelrc

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

.github/workflows/bazel7.bazelrc

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

.github/workflows/ci.bazelrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
common --disk_cache=~/.cache/bazel-disk-cache
33
common --repository_cache=~/.cache/bazel-repository-cache
44

5-
# Debug where options came from
6-
common --announce_rc
7-
85
# Allows tests to run bazelisk-in-bazel, since this is the cache folder used
96
common --test_env=XDG_CACHE_HOME

.github/workflows/ci.yaml

Lines changed: 13 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -18,65 +18,25 @@ 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:6, version:\"6.5.0\""
34-
)
35-
printf -v j '{%s},' "${a[@]}"
36-
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
37-
- id: os
38-
name: Prepare 'os' matrix axis
39-
# Only run MacOS and Windows on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively)
40-
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
41-
run: |
42-
a=( ubuntu )
43-
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"macos"* ]]; then
44-
a+=( macos )
45-
fi
46-
if [[ "${{ github.ref_name }}" == "main" ]] || [[ "${{ github.head_ref }}" == *"windows"* ]]; then
47-
a+=( windows )
48-
fi
49-
printf -v j '"%s",' "${a[@]}"
50-
echo "res=[${j%,}]" | tee -a $GITHUB_OUTPUT
51-
outputs:
52-
bazel-version: ${{ steps.bazel-version.outputs.res }}
53-
os: ${{ steps.os.outputs.res }}
54-
21+
# Mac/Windows smoke tests
22+
# Linux tests are run on Aspect Workflows (see .aspect/workflows/config.yaml)
23+
# Only run on main branch (not PRs) to minimize minutes (billed at 10X and 2X respectively)
24+
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
5525
test:
26+
if: github.ref_name == 'main' || contains(github.head_ref, 'macos') || contains(github.head_ref, 'windows')
5627
runs-on: ${{ matrix.os }}-latest
57-
needs:
58-
- matrix-prep
5928
strategy:
6029
fail-fast: false
6130
matrix:
62-
bazel-version: ${{ fromJSON(needs.matrix-prep.outputs.bazel-version) }}
6331
bzlmod: [1, 0]
64-
os: ${{ fromJSON(needs.matrix-prep.outputs.os) }}
32+
os: [macos, windows]
6533
folder:
6634
- '.'
6735
- 'e2e/loaders'
6836
- 'e2e/smoke'
6937
- 'e2e/smoke_rjs3'
7038
- 'e2e/worker'
7139
exclude:
72-
# Don't test MacOS and Windows against secondary bazel version to minimize minutes (billed at 10X and 2X respectively)
73-
# https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#included-storage-and-minutes
74-
- os: macos
75-
bazel-version:
76-
major: 6
77-
- os: windows
78-
bazel-version:
79-
major: 6
8040
# Root repository no longer tests non-bzlmod/WORKSPACE
8141
- folder: .
8242
bzlmod: 0
@@ -89,14 +49,6 @@ jobs:
8949
# rules_js v3 is bzlmod-only and requires bazel 7+
9050
- folder: e2e/smoke_rjs3
9151
bzlmod: 0
92-
- folder: e2e/smoke_rjs3
93-
bazel-version:
94-
major: 6
95-
# bazel 7 linux tested on Aspect Workflows
96-
- os: ubuntu
97-
bazel-version:
98-
major: 7
99-
bzlmod: 1
10052

10153
steps:
10254
- uses: actions/checkout@v4
@@ -108,29 +60,22 @@ jobs:
10860
~/.cache/bazel-disk-cache
10961
~/.cache/bazel-repository-cache
11062
~/.cache/xdg-cache
111-
key: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel') }}
112-
restore-keys: bazel-cache-${{ matrix.bazel-version.version }}-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-
113-
114-
- name: Configure Bazel version
115-
working-directory: ${{ matrix.folder }}
116-
shell: bash
117-
run: |
118-
# Overwrite the .bazelversion instead of using USE_BAZEL_VERSION so that Bazelisk
119-
# still bootstraps Aspect CLI from configuration in .bazeliskrc. Aspect CLI will
120-
# then use .bazelversion to determine which Bazel version to use.
121-
echo "${{ matrix.bazel-version.version }}" > .bazelversion
63+
key: bazel-cache-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-${{ hashFiles('.bazelrc', '.bazelversion', '**/BUILD', '**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel', 'WORKSPACE.bzlmod', 'MODULE.bazel') }}
64+
restore-keys: bazel-cache-${{ matrix.bzlmod }}-${{ matrix.os }}-${{ matrix.folder }}-
12265

12366
- name: bazel test //...
12467
working-directory: ${{ matrix.folder }}
12568
shell: bash
12669
run: |
70+
v=$(head -n 1 .bazelversion)
71+
m=${v::1}
12772
bazel \
128-
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/bazel${{ matrix.bazel-version.major }}.bazelrc \
12973
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/tools/preset.bazelrc \
13074
--bazelrc=${GITHUB_WORKSPACE//\\/\/}/.github/workflows/ci.bazelrc \
13175
test \
132-
--test_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \
133-
--build_tag_filters=-skip-on-bazel${{ matrix.bazel-version.major }} \
76+
--config=ci \
77+
--test_tag_filters=-skip-on-bazel${m} \
78+
--build_tag_filters=-skip-on-bazel${m} \
13479
--enable_bzlmod=${{ matrix.bzlmod }} \
13580
//...
13681

BUILD.bazel

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
1-
load("@bazel_gazelle//:def.bzl", "gazelle", "gazelle_binary")
21
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
32
load("@npm//:defs.bzl", "npm_link_all_packages")
43

54
npm_link_all_packages(name = "node_modules")
65

7-
gazelle_binary(
8-
name = "gazelle_bin",
9-
languages = ["@bazel_skylib_gazelle_plugin//bzl"],
10-
)
11-
12-
# gazelle:exclude @bazel/*
13-
14-
gazelle(
15-
name = "gazelle",
16-
gazelle = "gazelle_bin",
17-
)
18-
196
buildifier(
207
name = "buildifier",
218
exclude_patterns = ["./.git/*"],

MODULE.bazel

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ module(
77
)
88

99
# Lower-bounds (minimum) versions for direct runtime dependencies
10-
bazel_dep(name = "aspect_bazel_lib", version = "2.7.7")
10+
bazel_dep(name = "aspect_bazel_lib", version = "2.19.2")
1111
bazel_dep(name = "aspect_rules_js", version = "2.0.0")
12-
bazel_dep(name = "aspect_tools_telemetry", version = "0.2.8")
12+
bazel_dep(name = "aspect_tools_telemetry", version = "0.3.3")
1313
bazel_dep(name = "bazel_skylib", version = "1.5.0")
1414

1515
tel = use_extension("@aspect_tools_telemetry//:extension.bzl", "telemetry")
@@ -18,27 +18,10 @@ use_repo(tel, "aspect_tools_telemetry_report")
1818
####### Dev dependencies ########
1919

2020
bazel_dep(name = "bazel_features", version = "0.1.0", dev_dependency = True)
21-
bazel_dep(name = "bazelrc-preset.bzl", version = "1.5.1", dev_dependency = True)
22-
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
23-
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
24-
bazel_dep(name = "gazelle", version = "0.36.0", dev_dependency = True, repo_name = "bazel_gazelle")
21+
bazel_dep(name = "bazelrc-preset.bzl", version = "1.9.2", dev_dependency = True)
22+
bazel_dep(name = "buildifier_prebuilt", version = "8.2.1.2", dev_dependency = True)
2523
bazel_dep(name = "platforms", version = "0.0.8", dev_dependency = True)
2624

27-
buildifier_prebuilt = use_extension(
28-
"@buildifier_prebuilt//:defs.bzl",
29-
"buildifier_prebuilt_deps_extension",
30-
dev_dependency = True,
31-
)
32-
use_repo(
33-
buildifier_prebuilt,
34-
"buildifier_prebuilt_toolchains",
35-
)
36-
37-
register_toolchains(
38-
"@buildifier_prebuilt_toolchains//:all",
39-
dev_dependency = True,
40-
)
41-
4225
# NPM packages for testing
4326
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
4427
npm.npm_translate_lock(

0 commit comments

Comments
 (0)