Skip to content

Commit 2d16551

Browse files
committed
CI: Test examples on CI with bindists
The examples are tested with a nixpkgs haskell toolchain as part of the integration tests, but not for the bindists. Note, the examples are using a fixed GHC version (9.4.8 currently) and should work with the latest Bazel 6.x and 7.x release.
1 parent b469c79 commit 2d16551

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

.github/workflows/workflow.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,86 @@ jobs:
252252
name: Logs ${{ matrix.os }} ${{ matrix.module }} ${{ matrix.bzlmod }}
253253
path: logs
254254

255+
examples-bindist:
256+
name: Build & Test Examples - bindist
257+
strategy:
258+
fail-fast: false
259+
matrix:
260+
os: [ubuntu-22.04, macos-13, macos-14, windows-latest]
261+
bzlmod: [true, false]
262+
bazel:
263+
- "6.x"
264+
- "7.x"
265+
env:
266+
USE_BAZEL_VERSION: ${{ matrix.bazel }}
267+
runs-on: ${{ matrix.os }}
268+
steps:
269+
- uses: actions/checkout@v4
270+
- uses: ./.github/actions/free_disk_space_on_linux
271+
- uses: ./.github/actions/install_apt_pkgs
272+
with:
273+
packages: libtinfo5
274+
- name: Mount Bazel cache
275+
uses: actions/cache@v4
276+
with:
277+
path: ~/repo-cache
278+
key: repo-cache-${{ runner.os }}-bindist-${{ env.cache-version }}
279+
- uses: tweag/configure-bazel-remote-cache-auth@v0
280+
with:
281+
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }}
282+
bazelrc_path: .bazelrc.auth
283+
- uses: ./.github/actions/set_tcp_keepalive_time
284+
- uses: extractions/netrc@v2
285+
with:
286+
machine: api.github.com
287+
password: ${{ secrets.GITHUB_TOKEN }}
288+
- name: Configure
289+
shell: bash
290+
run: |
291+
case "${{ runner.os }}" in
292+
macOS) BUILD_CONFIG=macos-bindist;;
293+
Linux) BUILD_CONFIG=linux-bindist;;
294+
Windows) BUILD_CONFIG=ci-windows-bindist;;
295+
esac
296+
if [[ ${{ runner.os }} == Windows ]]; then
297+
output_root_setting="startup --output_user_root=C:/_bzl"
298+
# On windows, we use a separate remote cache for bzlmod,
299+
# because the c dependency analysis is leaking absolute paths which are different
300+
if ${{ matrix.bzlmod }}; then
301+
bzlmod_cache_silo_key='build --remote_default_exec_properties=bzlmod-cache-silo-key=bzlmod'
302+
else
303+
bzlmod_cache_silo_key='build --remote_default_exec_properties=bzlmod-cache-silo-key=workspace'
304+
fi
305+
else
306+
output_root_setting=""
307+
bzlmod_cache_silo_key=""
308+
fi
309+
cat >>.bazelrc.local <<EOF
310+
common --config=ci
311+
build --config=$BUILD_CONFIG
312+
$output_root_setting
313+
$bzlmod_cache_silo_key
314+
common --enable_bzlmod=${{ matrix.bzlmod }}
315+
EOF
316+
- name: Build
317+
shell: bash
318+
working-directory: examples
319+
run: |
320+
# Quote the package specifier so that it works on Windows
321+
bazelisk build "//..."
322+
323+
- name: Test
324+
shell: bash
325+
working-directory: examples
326+
run: |
327+
# Quote the package specifier so that it works on Windows
328+
bazelisk build "//..."
329+
255330
all_ci_tests:
256331
runs-on: ubuntu-22.04
257332
needs:
258333
- lint
334+
- examples-bindist
259335
- test-nixpkgs
260336
- test-bindist
261337
if: ${{ always() }}

0 commit comments

Comments
 (0)