ci: drone: use zig-bootstrap tarball instead of system toolchain

This commit is contained in:
Andrew Kelley 2021-06-02 14:58:15 -07:00
parent 16c5cbab0c
commit 05cd8936c8
3 changed files with 50 additions and 9 deletions

View file

@ -7,28 +7,28 @@ platform:
steps: steps:
- name: build - name: build
image: ziglang/static-base:llvm12-aarch64-3 image: ziglang/static-base:llvm12-aarch64-5
commands: commands:
- ./ci/drone/linux_script_build - ./ci/drone/linux_script_build
- name: test-1 - name: test-1
depends_on: depends_on:
- build - build
image: ziglang/static-base:llvm12-aarch64-3 image: ziglang/static-base:llvm12-aarch64-5
commands: commands:
- ./ci/drone/linux_script_test 1 - ./ci/drone/linux_script_test 1
- name: test-2 - name: test-2
depends_on: depends_on:
- build - build
image: ziglang/static-base:llvm12-aarch64-3 image: ziglang/static-base:llvm12-aarch64-5
commands: commands:
- ./ci/drone/linux_script_test 2 - ./ci/drone/linux_script_test 2
- name: test-3 - name: test-3
depends_on: depends_on:
- build - build
image: ziglang/static-base:llvm12-aarch64-3 image: ziglang/static-base:llvm12-aarch64-5
commands: commands:
- ./ci/drone/linux_script_test 3 - ./ci/drone/linux_script_test 3
@ -38,7 +38,7 @@ steps:
- test-1 - test-1
- test-2 - test-2
- test-3 - test-3
image: ziglang/static-base:llvm12-aarch64-3 image: ziglang/static-base:llvm12-aarch64-5
environment: environment:
SRHT_OAUTH_TOKEN: SRHT_OAUTH_TOKEN:
from_secret: SRHT_OAUTH_TOKEN from_secret: SRHT_OAUTH_TOKEN

View file

@ -2,8 +2,30 @@
. ./ci/drone/linux_script_base . ./ci/drone/linux_script_base
apk update PREFIX="/deps/local"
apk add samurai ZIG="$PREFIX/bin/zig"
TARGET="$TRIPLEARCH-linux-musl"
MCPU="baseline"
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
# The `CMAKE_AR` parameter will consider any spaces to
# be part of the executable path rather than CLI args, so we have
# to create wrapper scripts for `zig ar` and zig ranlib`.
cat <<'ENDFILE' >$PREFIX/bin/ar
#!/bin/sh
/deps/local/bin/zig ar $@
ENDFILE
cat <<'ENDFILE' >$PREFIX/bin/ranlib
#!/bin/sh
/deps/local/bin/zig ranlib $@
ENDFILE
chmod +x $PREFIX/bin/ar
chmod +x $PREFIX/bin/ranlib
# Make the `zig version` number consistent. # Make the `zig version` number consistent.
# This will affect the cmake command below. # This will affect the cmake command below.
@ -13,6 +35,25 @@ git fetch --tags
mkdir build mkdir build
cd build cd build
cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja cmake .. \
-DCMAKE_INSTALL_PREFIX="$DISTDIR" \
-DCMAKE_PREFIX_PATH="$PREFIX" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_AR="$PREFIX/bin/ar" \
-DCMAKE_RANLIB="$PREFIX/bin/ranlib" \
-DZIG_TARGET_TRIPLE="$TARGET" \
-DZIG_TARGET_MCPU="$MCPU" \
-DZIG_STATIC=ON \
-GNinja
# Now CMake will use Zig as the C/C++ compiler. We reset the environment variables
# so that installation and testing do not get affected by them.
unset CC
unset CXX
samu install
# Here we rebuild Zig but this time using the Zig binary we just now produced to
# build zig1.o rather than relying on the one built with stage0. See
# https://github.com/ziglang/zig/issues/6830 for more details.
cmake .. -DZIG_EXECUTABLE="$DISTDIR/bin/zig"
samu install samu install

View file

@ -7,7 +7,7 @@ if [ -n "$DRONE_PULL_REQUEST" ]; then
fi fi
apk update apk update
apk add py3-pip xz perl-utils jq curl samurai apk add py3-pip perl-utils jq curl
pip3 install s3cmd pip3 install s3cmd
cd build cd build