1
Fork 0
Commit Graph

56 Commits (main)

Author SHA1 Message Date
Motiejus Jakštys e319ac4635
zig cache dir: move to `/tmp/zig-cache` (#52)
This cache directory can be re-used by everything and everyone. There is
nothing bazel or hermetic_cc_toolchain specific there. So let's make it
clear.

Also, if there are any more zig-based toolchains on top of Bazel or
other build systems where they cannot rely on $HOME, but need an
absolute path, this feels like a reasonable choice.
2023-04-28 09:05:34 -07:00
Motiejus Jakštys cb46744cb8 launcher: use `-mcpu=baseline`
This log message has been seen in a Github Actions worker:

      running <...>/c++ failed: signal: illegal instruction (core dumped)

I conclude that the launcher was compiled on a newer CPU than used on
the worker at the time.

Reported-by: mp@edgeless.systems

Fixes #22
2023-04-24 12:38:23 +03:00
Motiejus Jakštys 3630f62053 rules/ remove run_under
rules/ were never meant to be added to the release. Now that we are not
*running* multi-arch binaries, we can remove the infrastructure that was
necessary to do so.

I may get back to this -- but we need to dust quite a bit off before
that happens.
2023-04-24 10:13:53 +03:00
Motiejus Jakštys e0e7a4ca46
Rename bazel-zig-cc to hermetic_cc_toolchain (#36)
As it says on the tin.

Long live hermetic_cc_toolchain!
2023-04-21 10:00:03 -04:00
Motiejus Jakštys 73a9ceccfb
revert "Re-license portions of the code to Apache 2.0" (#35)
This (partially) reverts commit dfdb1f2680
2023-04-19 20:23:25 -04:00
Motiejus Jakštys 6d2ee8cad0 replace zopfli with encoding/gzip 2023-03-14 20:25:57 +02:00
Motiejus Jakštys 5cccfb1ce1 move bin/ to tools/
The directories are not that different now. Also, clean up .bazelrc
2023-03-10 10:37:43 +02:00
Motiejus Jakštys 3a204583f3
all commands: use /tmp/bazel-zig-cc (#6)
Different Bazel instances can share the zig cache all right.
2023-03-08 17:33:59 +02:00
Motiejus Jakštys af9360366b
More CI (#3)
- ci only: use a separate zig cache dir for each run
- use `tools/bazel` everywhere.
- remove arm64 tests. They don't give enough value to be worth the
  brittle environment.
- remove windows execution, except for launcher. Ditto. I will probably
  bring them back.
2023-03-06 17:32:48 +02:00
Zhongpeng Lin fef28b9706 Enable Lint on CI (#2) 2023-03-06 11:46:02 +02:00
Motiejus Jakštys dfdb1f2680
Re-license portions of the code to Apache 2.0
Your old version of the software released under the old license can
still be used under the terms of the old license.

I have received the following statement from the past contributors
Luis Holanda, Jeremy Volkman and Fabian Hahn:

  I hereby confirm that I am the copyright holder or authorized by the
  copyright holder of this contribution. As such I hereby confirm that
  all contributions made to bazel-zig-cc by me or on behalf of me,
  hereby is licensed under the Apache 2.0 License
  [http://www.apache.org/licenses/LICENSE-2.0]. I am aware that my
  previous contributions will still be available under the MIT license
  as well. I confirm that I am aware of the bazel-zig-cc teams intention
  to release bazel-zig-cc under the Apache 2.0 License from release
  [1.0] and onwards, and that the bazel-zig-cc no longer will accept
  contributions made under the MIT and that any future submissions from
  myself will be considered to be licensed under Apache 2.0 unless I
  expressly state otherwise.

Copyright and re-licensing for Google and Uber employees has been
resolved internally.

Since not all contributors took action to re-license the code yet,
portions of bazel-zig-cc remain licensed as MIT.

I have started this project during my personal time with my personal
resources. I am now handing over all copyrights to this code to Uber
Technologies, Inc.
2023-03-06 11:05:13 +02:00
Motiejus Jakštys 0d0441b9c7 ci/test: show how bad the artifact situation is 2023-02-24 12:41:32 +02:00
Motiejus Jakštys 4647e8436c launcher: remove --color=on 2023-02-24 12:01:49 +02:00
Motiejus Jakštys 28b46bfb96 ci/launcher: check fmt 2023-02-24 11:53:10 +02:00
Motiejus Jakštys 52b4f4b436 Merge branch 'motiejus_go1.20' 2023-02-24 11:43:00 +02:00
Motiejus Jakštys 0fd73783db ci/launcher: colors 2023-01-30 19:11:20 -08:00
Motiejus Jakštys 13a7d6800e ci/launcher: make it go faster 2023-01-30 19:08:30 -08:00
Motiejus Jakštys 11f7e1ad82 CI: fix tests 2023-01-30 18:01:01 -08:00
Motiejus Jakštys eced0109ca 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.
2023-01-03 11:46:58 +02:00
Motiejus Jakštys 8bc78753e2 ci/test: quote {}
This is recommended in the man page
2022-12-11 07:20:14 +02:00
Motiejus Jakštys bf88ddb2d5 ci/test: fail on error 2022-11-29 14:23:45 +02:00
Motiejus Jakštys 557b726d62 shellcheck 2022-10-13 12:48:43 +03:00
Motiejus Jakštys 7383c4984e ci/test: add tests for exact expected artifacts.
Cache reuse in zig is currently quite fragile (we are using a forked
version with github.com/ziglang/zig/issues/13051), so ensure that it
does not regress when zig SDK upgrades.
2022-10-13 12:41:07 +03:00
Motiejus Jakštys ae57dac00d ci/lint: make it fail in CI
It would "fix" the files on CI and not fail. ci/lint should verify they
are OK first, and give guidance to fix them.

also, `shellcheck -x` is no longer necessary; we can use the plain one
now.
2022-09-29 12:11:34 +03:00
Motiejus Jakštys 79674a1d96 replace /usr/bin/env sh with /bin/sh
/bin/sh exists in NixOS and in fact is the only file in `/bin`:

    $ docker run -ti --rm nixos/nix ls /bin /usr/bin
    /bin:
    sh

    /usr/bin:
    env

More context in
https://lists.sr.ht/~motiejus/bazel-zig-cc/%3CCAFVMu-pvNx%2BpeQYdge_fvmSGrHDmn78VmoYwTxkDgMjbzfVAwQ%40mail.gmail.com%3E
2022-08-30 09:21:27 +03:00
Motiejus Jakštys 4629534c19 [ci] add colors to test output 2022-08-12 05:54:33 +03:00
Motiejus Jakštys 5240246cab ci/test: simplify the script even more 2022-07-28 14:13:53 -07:00
Motiejus Jakštys 09ebb03d47 ci/lint: more verbose output 2022-07-28 14:10:11 -07:00
Luis Holanda 8b5c41e409 misc: use /usr/bin/env in scripts
This patch continues the work to support NixOS and others non-FHS
distributions by replacing instances of `/bin/bash` with
`/usr/bin/env bash`, which works correctly in more systems than the
former.

Signed-off-by: Luis Holanda <luiscmholanda@gmail.com>
2022-07-28 12:44:57 -07:00
Motiejus Jakštys db2f187aa9 ci/test: switch to proper fastbuild
turns out this was overwritten in .bazelrc from a long time ago.
2022-06-28 13:34:02 +03:00
Motiejus Jakštys fe1949388f [ci/test] set -c fastbuild
Seems like it's not the default, unlike the docs say. Will investigate
on why is that later.
2022-06-28 12:48:31 +03:00
Motiejus Jakštys 3ac217e2cc windows tests: move tests, get rid of wine-binfmt
This removes all other Bazel test commands, so all tests can be again
tested with `bazel test ...`.

Also, fixes linux-arm64 glibc tests. Until now they've worked only in
CI. Now they work everywhere I tried.
2022-06-06 10:33:46 +03:00
Fabian Hahn 6f2ae838cd added Windows target testing 2022-06-02 05:27:22 +03:00
Motiejus Jakštys d4f40a19fb fix ci/release
by adding a stub commit there
2022-04-20 14:45:48 +03:00
Motiejus Jakštys c2c6edd11c Merge branch 'laurynasl_libc' 2022-04-20 12:24:05 +03:00
Motiejus Jakštys d2af022174 shellcheck 2022-04-18 12:55:53 +03:00
Motiejus Jakštys 486a26a196 [release] add to CI 2022-04-18 12:37:12 +03:00
Motiejus Jakštys a53170cf82 ci/list* and ci/test: simple style improvements 2022-04-18 11:58:43 +03:00
laurynasl 4d65b80903 Add libc constraint and libc aware toolchains
- Also get rid of @bazel_skylib dependency
2022-04-14 14:29:06 +00:00
laurynasl 7a81e2a129 Restructure tests to all run in bazel
- add rules to run tests for a specific platform
- use downloaded buildifier
- move lint to a script
- rename ci tasks
- stop running under qemu-aarch64-static as it doesn't do anything
2022-04-14 10:47:02 +00:00
laurynasl 723e6f051d Move toolchainss under @zig_sdk//platform: 2022-04-07 12:43:34 +03:00
laurynasl dd76e0b76f move platforms under @zig_cc//platform: 2022-04-07 12:43:34 +03:00
Motiejus Jakštys 3d166c5671 use .bazelrc for qemu configuration 2022-02-08 14:22:21 +02:00
Motiejus Jakštys acb4fd475a restructure tests for merging 2022-02-05 06:12:41 +02:00
Motiejus Jakštys 7c8682b865 run tests with qemu-aarch64 2022-02-05 05:35:39 +02:00
Motiejus Jakštys 5871171549 run bazel test
This simplifies the tests somewhat.
2022-02-04 10:07:34 +02:00
Motiejus Jakštys 78a77ebbe5 preparing for aarch64 tests 2022-02-03 18:01:32 +02:00
Motiejus Jakštys ebbf499208 move golang tests to its own directory
this prepares for more test binaries.
2022-02-03 15:24:26 +02:00
Motiejus Jakštys 5631c7e2b6 build everything under //test/... and remove duplicate test binaries 2022-02-03 14:58:42 +02:00
Motiejus Jakštys bcd9731f92 add @zig_sdk//:<os>_<arch>_platform values 2022-02-03 14:24:26 +02:00