| author | |
| committer | |
| log | 37b05742ff1544bccf7c8ae9b12c6707a5a54df2 |
| tree | 2101c24314e42f751751b9d52b5e3709cbbf2812 |
| parent | 6951889f6ede655d58b95a48bf052260e6a21d06 |
Temporary workaround for #8597 until upstream fix lands.
- add `zig build -Dskip-debug` option
- build a release-fast build.exe
- disable test suite build modes { debug, release-small, release-safe }
- enable passing test-* components
- use parallel pipeline steps for tests7 files changed, 168 insertions(+), 69 deletions(-)
build.zig+5-2| ... | @@ -44,6 +44,7 @@ pub fn build(b: *Builder) !void { | ... | @@ -44,6 +44,7 @@ pub fn build(b: *Builder) !void { |
| 44 | 44 | ||
| 45 | const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"}); | 45 | const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"}); |
| 46 | 46 | ||
| 47 | const skip_debug = b.option(bool, "skip-debug", "Main test suite skips debug builds") orelse false; | ||
| 47 | const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false; | 48 | const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false; |
| 48 | const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release; | 49 | const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release; |
| 49 | const skip_release_fast = b.option(bool, "skip-release-fast", "Main test suite skips release-fast builds") orelse skip_release; | 50 | const skip_release_fast = b.option(bool, "skip-release-fast", "Main test suite skips release-fast builds") orelse skip_release; |
| ... | @@ -237,8 +238,10 @@ pub fn build(b: *Builder) !void { | ... | @@ -237,8 +238,10 @@ pub fn build(b: *Builder) !void { |
| 237 | 238 | ||
| 238 | var chosen_modes: [4]builtin.Mode = undefined; | 239 | var chosen_modes: [4]builtin.Mode = undefined; |
| 239 | var chosen_mode_index: usize = 0; | 240 | var chosen_mode_index: usize = 0; |
| 240 | chosen_modes[chosen_mode_index] = builtin.Mode.Debug; | 241 | if (!skip_debug) { |
| 241 | chosen_mode_index += 1; | 242 | chosen_modes[chosen_mode_index] = builtin.Mode.Debug; |
| 243 | chosen_mode_index += 1; | ||
| 244 | } | ||
| 242 | if (!skip_release_safe) { | 245 | if (!skip_release_safe) { |
| 243 | chosen_modes[chosen_mode_index] = builtin.Mode.ReleaseSafe; | 246 | chosen_modes[chosen_mode_index] = builtin.Mode.ReleaseSafe; |
| 244 | chosen_mode_index += 1; | 247 | chosen_mode_index += 1; |
ci/drone/drone.yml+33-2| ... | @@ -6,7 +6,38 @@ platform: | ... | @@ -6,7 +6,38 @@ platform: |
| 6 | arch: arm64 | 6 | arch: arm64 |
| 7 | 7 | ||
| 8 | steps: | 8 | steps: |
| 9 | - name: build-and-test | 9 | - name: build |
| 10 | image: ziglang/static-base:llvm12-aarch64-1 | ||
| 11 | commands: | ||
| 12 | - ./ci/drone/linux_script_build | ||
| 13 | |||
| 14 | - name: test-1 | ||
| 15 | depends_on: | ||
| 16 | - build | ||
| 17 | image: ziglang/static-base:llvm12-aarch64-1 | ||
| 18 | commands: | ||
| 19 | - ./ci/drone/linux_script_test 1 | ||
| 20 | |||
| 21 | - name: test-2 | ||
| 22 | depends_on: | ||
| 23 | - build | ||
| 24 | image: ziglang/static-base:llvm12-aarch64-1 | ||
| 25 | commands: | ||
| 26 | - ./ci/drone/linux_script_test 2 | ||
| 27 | |||
| 28 | - name: test-3 | ||
| 29 | depends_on: | ||
| 30 | - build | ||
| 31 | image: ziglang/static-base:llvm12-aarch64-1 | ||
| 32 | commands: | ||
| 33 | - ./ci/drone/linux_script_test 3 | ||
| 34 | |||
| 35 | - name: finalize | ||
| 36 | depends_on: | ||
| 37 | - build | ||
| 38 | - test-1 | ||
| 39 | - test-2 | ||
| 40 | - test-3 | ||
| 10 | image: ziglang/static-base:llvm12-aarch64-1 | 41 | image: ziglang/static-base:llvm12-aarch64-1 |
| 11 | environment: | 42 | environment: |
| 12 | SRHT_OAUTH_TOKEN: | 43 | SRHT_OAUTH_TOKEN: |
| ... | @@ -16,4 +47,4 @@ steps: | ... | @@ -16,4 +47,4 @@ steps: |
| 16 | AWS_SECRET_ACCESS_KEY: | 47 | AWS_SECRET_ACCESS_KEY: |
| 17 | from_secret: AWS_SECRET_ACCESS_KEY | 48 | from_secret: AWS_SECRET_ACCESS_KEY |
| 18 | commands: | 49 | commands: |
| 19 | - ./ci/drone/linux_script | 50 | - ./ci/drone/linux_script_finalize |
ci/drone/linux_script deleted-65| ... | @@ -1,65 +0,0 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | set -x | ||
| 4 | set -e | ||
| 5 | |||
| 6 | TRIPLEARCH="$(uname -m)" | ||
| 7 | BUILDDIR="$(pwd)" | ||
| 8 | DISTDIR="$(pwd)/dist" | ||
| 9 | |||
| 10 | apk update | ||
| 11 | apk add py3-pip xz perl-utils jq curl samurai | ||
| 12 | pip3 install s3cmd | ||
| 13 | |||
| 14 | # Make the `zig version` number consistent. | ||
| 15 | # This will affect the cmake command below. | ||
| 16 | git config core.abbrev 9 | ||
| 17 | git fetch --unshallow || true | ||
| 18 | git fetch --tags | ||
| 19 | |||
| 20 | mkdir build | ||
| 21 | cd build | ||
| 22 | cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja | ||
| 23 | |||
| 24 | samu install | ||
| 25 | # run-translated-c tests are skipped due to: https://github.com/ziglang/zig/issues/8537 | ||
| 26 | ./zig build test \ | ||
| 27 | -Dskip-release \ | ||
| 28 | -Dskip-non-native \ | ||
| 29 | -Dskip-compile-errors \ | ||
| 30 | -Dskip-run-translated-c | ||
| 31 | |||
| 32 | if [ -z "$DRONE_PULL_REQUEST" ]; then | ||
| 33 | mv ../LICENSE "$DISTDIR/" | ||
| 34 | mv ../zig-cache/langref.html "$DISTDIR/" | ||
| 35 | mv "$DISTDIR/bin/zig" "$DISTDIR/" | ||
| 36 | rmdir "$DISTDIR/bin" | ||
| 37 | |||
| 38 | GITBRANCH="$DRONE_BRANCH" | ||
| 39 | VERSION="$("$DISTDIR/zig" version)" | ||
| 40 | DIRNAME="zig-linux-$TRIPLEARCH-$VERSION" | ||
| 41 | TARBALL="$DIRNAME.tar.xz" | ||
| 42 | mv "$DISTDIR" "$DIRNAME" | ||
| 43 | tar cfJ "$TARBALL" "$DIRNAME" | ||
| 44 | |||
| 45 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 46 | |||
| 47 | SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1) | ||
| 48 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 49 | |||
| 50 | JSONFILE="$TRIPLEARCH-linux-$GITBRANCH.json" | ||
| 51 | touch $JSONFILE | ||
| 52 | echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE | ||
| 53 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE | ||
| 54 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE | ||
| 55 | |||
| 56 | s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE" | ||
| 57 | s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json" | ||
| 58 | if [ "$GITBRANCH" = "master" ]; then | ||
| 59 | # avoid leaking oauth token | ||
| 60 | set +x | ||
| 61 | |||
| 62 | cd "$BUILDDIR" | ||
| 63 | ./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN" | ||
| 64 | fi | ||
| 65 | fi | ||
ci/drone/linux_script_base created+22| ... | @@ -0,0 +1,22 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # https://docs.drone.io/pipeline/docker/syntax/workspace/ | ||
| 4 | # | ||
| 5 | # Drone automatically creates a temporary volume, known as your workspace, | ||
| 6 | # where it clones your repository. The workspace is the current working | ||
| 7 | # directory for each step in your pipeline. | ||
| 8 | # | ||
| 9 | # Because the workspace is a volume, filesystem changes are persisted between | ||
| 10 | # pipeline steps. In other words, individual steps can communicate and share | ||
| 11 | # state using the filesystem. | ||
| 12 | # | ||
| 13 | # Workspace volumes are ephemeral. They are created when the pipeline starts | ||
| 14 | # and destroyed after the pipeline completes. | ||
| 15 | |||
| 16 | set -x | ||
| 17 | set -e | ||
| 18 | |||
| 19 | TRIPLEARCH="$(uname -m)" | ||
| 20 | DISTDIR="$DRONE_WORKSPACE/dist" | ||
| 21 | |||
| 22 | export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache" | ||
ci/drone/linux_script_build created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | . ./ci/drone/linux_script_base | ||
| 4 | |||
| 5 | apk update | ||
| 6 | apk add samurai | ||
| 7 | |||
| 8 | # Make the `zig version` number consistent. | ||
| 9 | # This will affect the cmake command below. | ||
| 10 | git config core.abbrev 9 | ||
| 11 | git fetch --unshallow || true | ||
| 12 | git fetch --tags | ||
| 13 | |||
| 14 | mkdir build | ||
| 15 | cd build | ||
| 16 | cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja | ||
| 17 | |||
| 18 | samu install | ||
ci/drone/linux_script_finalize created+46| ... | @@ -0,0 +1,46 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | . ./ci/drone/linux_script_base | ||
| 4 | |||
| 5 | if [ -n "$DRONE_PULL_REQUEST" ]; then | ||
| 6 | exit 0 | ||
| 7 | fi | ||
| 8 | |||
| 9 | apk update | ||
| 10 | apk add py3-pip xz perl-utils jq curl samurai | ||
| 11 | pip3 install s3cmd | ||
| 12 | |||
| 13 | cd build | ||
| 14 | |||
| 15 | mv ../LICENSE "$DISTDIR/" | ||
| 16 | # docs are disabled due to: https://github.com/ziglang/zig/issues/8597 | ||
| 17 | #mv ../zig-cache/langref.html "$DISTDIR/" | ||
| 18 | mv "$DISTDIR/bin/zig" "$DISTDIR/" | ||
| 19 | rmdir "$DISTDIR/bin" | ||
| 20 | |||
| 21 | GITBRANCH="$DRONE_BRANCH" | ||
| 22 | VERSION="$("$DISTDIR/zig" version)" | ||
| 23 | DIRNAME="zig-linux-$TRIPLEARCH-$VERSION" | ||
| 24 | TARBALL="$DIRNAME.tar.xz" | ||
| 25 | mv "$DISTDIR" "$DIRNAME" | ||
| 26 | tar cfJ "$TARBALL" "$DIRNAME" | ||
| 27 | |||
| 28 | s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/ | ||
| 29 | |||
| 30 | SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1) | ||
| 31 | BYTESIZE=$(wc -c < $TARBALL) | ||
| 32 | |||
| 33 | JSONFILE="tarball.json" | ||
| 34 | touch $JSONFILE | ||
| 35 | echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE | ||
| 36 | echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE | ||
| 37 | echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE | ||
| 38 | |||
| 39 | s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json" | ||
| 40 | if [ "$GITBRANCH" = "master" ]; then | ||
| 41 | # avoid leaking oauth token | ||
| 42 | set +x | ||
| 43 | |||
| 44 | cd "$DRONE_WORKSPACE" | ||
| 45 | ./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN" | ||
| 46 | fi | ||
ci/drone/linux_script_test created+44| ... | @@ -0,0 +1,44 @@ | ||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | . ./ci/drone/linux_script_base | ||
| 4 | |||
| 5 | # only release-fast builds of test suite due to: https://github.com/ziglang/zig/issues/8597 | ||
| 6 | # | ||
| 7 | # Some test suite components will be missing because they do not support | ||
| 8 | # forcing -OReleaseFast | ||
| 9 | # | ||
| 10 | # see `zig build --help` for the full list of test-* components | ||
| 11 | case "$1" in | ||
| 12 | 1) | ||
| 13 | steps="\ | ||
| 14 | test-stage2 \ | ||
| 15 | test-fmt \ | ||
| 16 | test-behavior" | ||
| 17 | ;; | ||
| 18 | 2) | ||
| 19 | steps="test-std" | ||
| 20 | ;; | ||
| 21 | 3) | ||
| 22 | steps="\ | ||
| 23 | test-compiler-rt \ | ||
| 24 | test-minilibc \ | ||
| 25 | test-compare-output" | ||
| 26 | ;; | ||
| 27 | '') | ||
| 28 | echo "error: expecting test group argument" | ||
| 29 | exit 1 | ||
| 30 | ;; | ||
| 31 | *) | ||
| 32 | echo "error: unknown test group: $1" | ||
| 33 | exit 1 | ||
| 34 | ;; | ||
| 35 | esac | ||
| 36 | |||
| 37 | # only release-fast builds of test suite due to: https://github.com/ziglang/zig/issues/8597 | ||
| 38 | ./build/zig build \ | ||
| 39 | -Drelease \ | ||
| 40 | -Dskip-debug \ | ||
| 41 | -Dskip-release-small \ | ||
| 42 | -Dskip-release-safe \ | ||
| 43 | -Dskip-non-native \ | ||
| 44 | $steps | ||