-
Notifications
You must be signed in to change notification settings - Fork 4
110 lines (102 loc) · 3.59 KB
/
workflow.yaml
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
name: Continuous integration
on:
push:
branches: master
pull_request:
branches: master
workflow_dispatch: # allows manual triggering
schedule:
- cron: '1 11 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
build-and-test:
name: Build & Test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-2019]
bazel_mode: [workspace, module]
version: ["5.3.0", "6.0.0", "7.0.0"]
exclude:
- version: 5.3.0
bazel_mode: module
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: bazelbuild/setup-bazelisk@v2
- uses: tweag/configure-bazel-remote-cache-auth@v0
with:
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
bazelrc_path: .bazelrc.auth
- uses: extractions/netrc@v1
with:
machine: api.github.com
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure for CI
uses: tweag/write-bazelrc@v0
with:
content: build --config=ci
- name: Disable stardoc
# Windows: Stardoc complains about docstring quote indentation on Windows.
# bzlmod: Stardoc does not work with bzlmod.
if: ${{ matrix.os == 'windows-2019' || matrix.bazel_mode == 'module' }}
uses: tweag/write-bazelrc@v0
with:
content: build --config=no-stardoc
- name: Enable bzlmod
uses: tweag/write-bazelrc@v0
if: ${{ matrix.bazel_mode == 'module' }}
with:
content: build --experimental_enable_bzlmod
- name: Configure the Bazel version
run: |
echo "USE_BAZEL_VERSION=${{ matrix.version }}" > .bazeliskrc
echo "USE_BAZEL_VERSION=${{ matrix.version }}" > tests/.bazeliskrc
- name: Run Bazel test at root
if: ${{ matrix.bazel_mode == 'workspace' }}
uses: ./.github/actions/run_bazel_test
with:
os: ${{ matrix.os }}
- name: Run Bazel test under tests directory
uses: ./.github/actions/run_bazel_test
with:
working-directory: tests
os: ${{ matrix.os }}
# - name: Run tests (bzlmod)
# if: matrix.bazel_mode == 'module'
# working-directory: ./tests
# run: |
# echo "USE_BAZEL_VERSION=${{ matrix.version }}" > .bazeliskrc
# if [[ ${{ runner.os }} == Windows ]]; then
# # On Windows `//...` expands to `/...`.
# BAZEL_SH='C:\msys64\usr\bin\bash.exe' bazel test ///...
# else
# bazel test //...
# fi
# - name: Run tests (workspace)
# if: matrix.bazel_mode == 'workspace'
# run: |
# echo "USE_BAZEL_VERSION=${{ matrix.version }}" > .bazeliskrc
# echo "USE_BAZEL_VERSION=${{ matrix.version }}" > tests/.bazeliskrc
# if [[ ${{ runner.os }} == Windows ]]; then
# # Because of the docstring quote issue on Windows we skip the stardoc test on the main workspace.
# # On Windows `//...` expands to `/...`.
# cd tests && BAZEL_SH='C:\msys64\usr\bin\bash.exe' bazel test ///...
# else
# bazel test //...
# cd tests && bazel test //...
# fi
all_ci_tests:
runs-on: ubuntu-latest
needs:
- build-and-test
if: ${{ always() }}
steps:
- uses: cgrindel/gha_join_jobs@794a2d117251f22607f1aab937d3fd3eaaf9a2f5 # v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}