Commit 37b05742ff

Michael Dusan <michael.dusan@gmail.com>
2021-04-24 22:39:26
ci: drone disable debug test suite for aarch64
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 tests
1 parent 6951889
ci/drone/drone.yml
@@ -6,7 +6,38 @@ platform:
   arch: arm64
 
 steps:
-- name: build-and-test
+- name: build
+  image: ziglang/static-base:llvm12-aarch64-1
+  commands:
+  - ./ci/drone/linux_script_build
+
+- name: test-1
+  depends_on:
+  - build
+  image: ziglang/static-base:llvm12-aarch64-1
+  commands:
+  - ./ci/drone/linux_script_test 1
+
+- name: test-2
+  depends_on:
+  - build
+  image: ziglang/static-base:llvm12-aarch64-1
+  commands:
+  - ./ci/drone/linux_script_test 2
+
+- name: test-3
+  depends_on:
+  - build
+  image: ziglang/static-base:llvm12-aarch64-1
+  commands:
+  - ./ci/drone/linux_script_test 3
+
+- name: finalize
+  depends_on:
+  - build
+  - test-1
+  - test-2
+  - test-3
   image: ziglang/static-base:llvm12-aarch64-1
   environment:
     SRHT_OAUTH_TOKEN:
@@ -16,4 +47,4 @@ steps:
     AWS_SECRET_ACCESS_KEY:
       from_secret: AWS_SECRET_ACCESS_KEY
   commands:
-  - ./ci/drone/linux_script
+  - ./ci/drone/linux_script_finalize
ci/drone/linux_script
@@ -1,65 +0,0 @@
-#!/bin/sh
-
-set -x
-set -e
-
-TRIPLEARCH="$(uname -m)"
-BUILDDIR="$(pwd)"
-DISTDIR="$(pwd)/dist"
-
-apk update
-apk add py3-pip xz perl-utils jq curl samurai
-pip3 install s3cmd
-
-# Make the `zig version` number consistent.
-# This will affect the cmake command below.
-git config core.abbrev 9
-git fetch --unshallow || true
-git fetch --tags
-
-mkdir build
-cd build
-cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja
-
-samu install
-# run-translated-c tests are skipped due to: https://github.com/ziglang/zig/issues/8537
-./zig build test \
-    -Dskip-release \
-    -Dskip-non-native \
-    -Dskip-compile-errors \
-    -Dskip-run-translated-c
-
-if [ -z "$DRONE_PULL_REQUEST" ]; then
-  mv ../LICENSE "$DISTDIR/"
-  mv ../zig-cache/langref.html "$DISTDIR/"
-  mv "$DISTDIR/bin/zig" "$DISTDIR/"
-  rmdir "$DISTDIR/bin"
-
-  GITBRANCH="$DRONE_BRANCH"
-  VERSION="$("$DISTDIR/zig" version)"
-  DIRNAME="zig-linux-$TRIPLEARCH-$VERSION"
-  TARBALL="$DIRNAME.tar.xz"
-  mv "$DISTDIR" "$DIRNAME"
-  tar cfJ "$TARBALL" "$DIRNAME"
-
-  s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
-
-  SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
-  BYTESIZE=$(wc -c < $TARBALL)
-
-  JSONFILE="$TRIPLEARCH-linux-$GITBRANCH.json"
-  touch $JSONFILE
-  echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
-  echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
-  echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
-
-  s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
-  s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json"
-  if [ "$GITBRANCH" = "master" ]; then 
-    # avoid leaking oauth token
-    set +x
-
-    cd "$BUILDDIR"
-    ./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
-  fi
-fi
ci/drone/linux_script_base
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# https://docs.drone.io/pipeline/docker/syntax/workspace/
+#
+# Drone automatically creates a temporary volume, known as your workspace,
+# where it clones your repository. The workspace is the current working
+# directory for each step in your pipeline.
+#
+# Because the workspace is a volume, filesystem changes are persisted between
+# pipeline steps. In other words, individual steps can communicate and share
+# state using the filesystem.
+#
+# Workspace volumes are ephemeral. They are created when the pipeline starts
+# and destroyed after the pipeline completes.
+
+set -x
+set -e
+
+TRIPLEARCH="$(uname -m)"
+DISTDIR="$DRONE_WORKSPACE/dist"
+
+export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
ci/drone/linux_script_build
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+. ./ci/drone/linux_script_base
+
+apk update
+apk add samurai
+
+# Make the `zig version` number consistent.
+# This will affect the cmake command below.
+git config core.abbrev 9
+git fetch --unshallow || true
+git fetch --tags
+
+mkdir build
+cd build
+cmake .. -DCMAKE_BUILD_TYPE=Release "-DCMAKE_INSTALL_PREFIX=$DISTDIR" -DZIG_STATIC=ON -DCMAKE_PREFIX_PATH=/deps/local -GNinja
+
+samu install
ci/drone/linux_script_finalize
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+. ./ci/drone/linux_script_base
+
+if [ -n "$DRONE_PULL_REQUEST" ]; then
+  exit 0
+fi
+
+apk update
+apk add py3-pip xz perl-utils jq curl samurai
+pip3 install s3cmd
+
+cd build
+
+mv ../LICENSE "$DISTDIR/"
+# docs are disabled due to: https://github.com/ziglang/zig/issues/8597
+#mv ../zig-cache/langref.html "$DISTDIR/"
+mv "$DISTDIR/bin/zig" "$DISTDIR/"
+rmdir "$DISTDIR/bin"
+
+GITBRANCH="$DRONE_BRANCH"
+VERSION="$("$DISTDIR/zig" version)"
+DIRNAME="zig-linux-$TRIPLEARCH-$VERSION"
+TARBALL="$DIRNAME.tar.xz"
+mv "$DISTDIR" "$DIRNAME"
+tar cfJ "$TARBALL" "$DIRNAME"
+
+s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
+
+SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
+BYTESIZE=$(wc -c < $TARBALL)
+
+JSONFILE="tarball.json"
+touch $JSONFILE
+echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
+echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
+echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
+
+s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json"
+if [ "$GITBRANCH" = "master" ]; then
+  # avoid leaking oauth token
+  set +x
+
+  cd "$DRONE_WORKSPACE"
+  ./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
+fi
ci/drone/linux_script_test
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+. ./ci/drone/linux_script_base
+
+# only release-fast builds of test suite due to: https://github.com/ziglang/zig/issues/8597
+#
+# Some test suite components will be missing because they do not support
+# forcing -OReleaseFast
+#
+# see `zig build --help` for the full list of test-* components
+case "$1" in
+  1)
+    steps="\
+      test-stage2 \
+      test-fmt \
+      test-behavior"
+    ;;
+  2)
+    steps="test-std"
+    ;;
+  3)
+    steps="\
+      test-compiler-rt \
+      test-minilibc \
+      test-compare-output"
+    ;;
+  '')
+    echo "error: expecting test group argument"
+    exit 1
+    ;;
+  *)
+    echo "error: unknown test group: $1"
+    exit 1
+    ;;
+esac
+
+# only release-fast builds of test suite due to: https://github.com/ziglang/zig/issues/8597
+./build/zig build \
+  -Drelease \
+  -Dskip-debug \
+  -Dskip-release-small \
+  -Dskip-release-safe \
+  -Dskip-non-native \
+  $steps
build.zig
@@ -44,6 +44,7 @@ pub fn build(b: *Builder) !void {
 
     const fmt_build_zig = b.addFmt(&[_][]const u8{"build.zig"});
 
+    const skip_debug = b.option(bool, "skip-debug", "Main test suite skips debug builds") orelse false;
     const skip_release = b.option(bool, "skip-release", "Main test suite skips release builds") orelse false;
     const skip_release_small = b.option(bool, "skip-release-small", "Main test suite skips release-small builds") orelse skip_release;
     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 {
 
     var chosen_modes: [4]builtin.Mode = undefined;
     var chosen_mode_index: usize = 0;
-    chosen_modes[chosen_mode_index] = builtin.Mode.Debug;
-    chosen_mode_index += 1;
+    if (!skip_debug) {
+        chosen_modes[chosen_mode_index] = builtin.Mode.Debug;
+        chosen_mode_index += 1;
+    }
     if (!skip_release_safe) {
         chosen_modes[chosen_mode_index] = builtin.Mode.ReleaseSafe;
         chosen_mode_index += 1;