2021-11-22 17:25:02 +02:00
|
|
|
image: debian/stable
|
2021-06-08 06:30:06 +03:00
|
|
|
packages:
|
2021-09-07 10:50:16 +03:00
|
|
|
- direnv
|
2021-10-18 15:15:50 +03:00
|
|
|
- shellcheck
|
2022-02-04 10:09:32 +02:00
|
|
|
- qemu-user-static
|
2022-12-12 06:06:00 +02:00
|
|
|
- binfmt-support
|
2022-04-18 13:12:08 +03:00
|
|
|
- moreutils
|
2022-12-11 07:12:43 +02:00
|
|
|
- file
|
2022-06-02 08:46:16 +03:00
|
|
|
- wine64
|
2021-06-08 06:30:06 +03:00
|
|
|
sources:
|
|
|
|
- https://git.sr.ht/~motiejus/bazel-zig-cc
|
|
|
|
environment:
|
2021-06-08 06:33:06 +03:00
|
|
|
CC: /usr/bin/false
|
2021-10-18 15:15:50 +03:00
|
|
|
triggers:
|
|
|
|
- action: email
|
|
|
|
condition: failure
|
|
|
|
to: motiejus+srht@jakstys.lt
|
2021-06-08 06:30:06 +03:00
|
|
|
tasks:
|
|
|
|
- setup: |
|
2021-06-19 12:14:19 +03:00
|
|
|
sudo apt-get purge gcc -y && sudo apt-get autoremove -y
|
2022-04-13 15:58:11 +03:00
|
|
|
sudo dpkg --add-architecture arm64
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install libc6:arm64 -y
|
2023-01-18 22:43:33 +02:00
|
|
|
- lint_gazelle: |
|
2021-11-05 20:27:28 +02:00
|
|
|
cd bazel-zig-cc; . .envrc
|
2022-04-13 15:58:11 +03:00
|
|
|
./ci/lint
|
2023-01-18 22:43:33 +02:00
|
|
|
bazel run --color=yes --curses=yes //:gazelle
|
2021-11-05 20:22:06 +02:00
|
|
|
git diff --exit-code
|
2022-04-18 12:35:14 +03:00
|
|
|
- test_release: |
|
|
|
|
cd bazel-zig-cc; . .envrc
|
|
|
|
./ci/release
|
2022-09-30 15:18:21 +03:00
|
|
|
- list_toolchains_platforms: |
|
|
|
|
cd bazel-zig-cc; . .envrc
|
|
|
|
./ci/list_toolchains_platforms
|
zig launcher: replace shell wrappers with a binary
Until now we needed to maintain two versions of the zig launcher: one
for Windows and one for everything else. This was problematic for two
reasons:
1. I do not know powershell and thus keep breaking the Windows wrapper
all the time (see git history of Fabian fixing stuff that I broke).
2. This makes bazel-zig-cc dependent on the system shell, making it not
really hermetic. So the recently added
`--experimental_use_hermetic_linux_sandbox` does not work with
bazel-zig-cc, unless we bind-mount a bunch of stuff: `/usr`, `/bin`,
`/lib`, `/usr/lib:/lib`, `/usr/lib64:/lib64` and `/proc`.
Switching to a Zig-based wrapper solves both issues, and we can do this:
bazel build "$@" \
--experimental_use_hermetic_linux_sandbox \
--sandbox_add_mount_pair=/proc \
<...>
Zig itself still depends on `/proc` for `/proc/self/exe`, so we need to
keep that. I will look into reducing even that dependency separately.
Not all is nice and shiny though: this commit replaces ~80 LOC worth of
shell scripts wrappers with a singe ~300 LOC zig program, which is
arguably harder to understand. However, it is easier to change, at least
for me, because it's a single file with unit tests! Most importantly,
the gnarly code (which resolves paths and sets environment variables) is
cross-platform.
Thanks to Fabian Hahn for testing this on Windows and pointing out
errors.
2022-12-20 17:00:50 +02:00
|
|
|
- test_launcher: |
|
|
|
|
cd bazel-zig-cc; . .envrc
|
|
|
|
./ci/launcher --color=yes --curses=yes
|
2022-09-30 15:18:21 +03:00
|
|
|
- test: |
|
|
|
|
cd bazel-zig-cc; . .envrc
|
zig launcher: replace shell wrappers with a binary
Until now we needed to maintain two versions of the zig launcher: one
for Windows and one for everything else. This was problematic for two
reasons:
1. I do not know powershell and thus keep breaking the Windows wrapper
all the time (see git history of Fabian fixing stuff that I broke).
2. This makes bazel-zig-cc dependent on the system shell, making it not
really hermetic. So the recently added
`--experimental_use_hermetic_linux_sandbox` does not work with
bazel-zig-cc, unless we bind-mount a bunch of stuff: `/usr`, `/bin`,
`/lib`, `/usr/lib:/lib`, `/usr/lib64:/lib64` and `/proc`.
Switching to a Zig-based wrapper solves both issues, and we can do this:
bazel build "$@" \
--experimental_use_hermetic_linux_sandbox \
--sandbox_add_mount_pair=/proc \
<...>
Zig itself still depends on `/proc` for `/proc/self/exe`, so we need to
keep that. I will look into reducing even that dependency separately.
Not all is nice and shiny though: this commit replaces ~80 LOC worth of
shell scripts wrappers with a singe ~300 LOC zig program, which is
arguably harder to understand. However, it is easier to change, at least
for me, because it's a single file with unit tests! Most importantly,
the gnarly code (which resolves paths and sets environment variables) is
cross-platform.
Thanks to Fabian Hahn for testing this on Windows and pointing out
errors.
2022-12-20 17:00:50 +02:00
|
|
|
export BAZEL_ZIG_CC_CACHE_PREFIX=/tmp/bazel-zig-cc-2
|
|
|
|
./ci/test \
|
|
|
|
--color=yes --curses=yes \
|
|
|
|
--repo_env BAZEL_ZIG_CC_CACHE_PREFIX=$BAZEL_ZIG_CC_CACHE_PREFIX \
|
|
|
|
--sandbox_writable_path "$BAZEL_ZIG_CC_CACHE_PREFIX"
|