authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-25 18:12:35-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-08-28 17:07:21-07:00
log532cfb65e018c216972cb50a82c7a0379934c8cc
tree5e4e011efd5b6554a3a3bf19ef6398895b2a1cab
parentaee53e2ffdd8c68a9b505f8aaad318bfbb459965

CI: rework to account for new cmake behavior

* CMakeLists: pass `-Dstrip` for release zig builds * pass -target and -mcpu to zig1. works around llvm on freebsd incorrectly detecting "freestanding" instead of "freebsd" for the native OS. * ci.ziglang.org is now responsible for creating aarch64-macos tarballs rather than Azure.

27 files changed, 417 insertions(+), 445 deletions(-)

CMakeLists.txt+11-7
...@@ -959,9 +959,11 @@ else()...@@ -959,9 +959,11 @@ else()
959 set(ZIG2_OBJECT "${CMAKE_BINARY_DIR}/zig2.o")959 set(ZIG2_OBJECT "${CMAKE_BINARY_DIR}/zig2.o")
960endif()960endif()
961if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")961if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
962 set(ZIG_RELEASE_ARG "")962 set(ZIG_RELEASE_ARG "")
963elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
964 set(ZIG_RELEASE_ARG -Drelease)
963else()965else()
964 set(ZIG_RELEASE_ARG -Drelease)966 set(ZIG_RELEASE_ARG -Drelease -Dstrip)
965endif()967endif()
966if(ZIG_SKIP_INSTALL_LIB_FILES)968if(ZIG_SKIP_INSTALL_LIB_FILES)
967 set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files")969 set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files")
...@@ -985,7 +987,9 @@ set(BUILD_ZIG2_ARGS...@@ -985,7 +987,9 @@ set(BUILD_ZIG2_ARGS
985 --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"987 --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
986 "-femit-bin=${ZIG2_OBJECT}"988 "-femit-bin=${ZIG2_OBJECT}"
987 -fcompiler-rt989 -fcompiler-rt
988 "${ZIG_SINGLE_THREADED_ARG}"990 ${ZIG_SINGLE_THREADED_ARG}
991 -target "${ZIG_TARGET_TRIPLE}"
992 -mcpu "${ZIG_TARGET_MCPU}"
989 -lc993 -lc
990 --pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}"994 --pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}"
991 --pkg-end995 --pkg-end
...@@ -1042,10 +1046,10 @@ set(ZIG_INSTALL_ARGS "build"...@@ -1042,10 +1046,10 @@ set(ZIG_INSTALL_ARGS "build"
1042 "-Dconfig_h=${ZIG_CONFIG_H_OUT}"1046 "-Dconfig_h=${ZIG_CONFIG_H_OUT}"
1043 "-Denable-llvm"1047 "-Denable-llvm"
1044 "-Denable-stage1"1048 "-Denable-stage1"
1045 "${ZIG_RELEASE_ARG}"1049 ${ZIG_RELEASE_ARG}
1046 "${ZIG_STATIC_ARG}"1050 ${ZIG_STATIC_ARG}
1047 "${ZIG_SKIP_INSTALL_LIB_FILES_ARG}"1051 ${ZIG_SKIP_INSTALL_LIB_FILES_ARG}
1048 "${ZIG_SINGLE_THREADED_ARG}"1052 ${ZIG_SINGLE_THREADED_ARG}
1049 "-Dtarget=${ZIG_TARGET_TRIPLE}"1053 "-Dtarget=${ZIG_TARGET_TRIPLE}"
1050 "-Dcpu=${ZIG_TARGET_MCPU}"1054 "-Dcpu=${ZIG_TARGET_MCPU}"
1051)1055)
ci/azure/macos_arm64_script deleted-132
...@@ -1,132 +0,0 @@
1#!/bin/sh
2
3set -x
4set -e
5
6brew update && brew install ncurses s3cmd
7
8ZIGDIR="$(pwd)"
9
10HOST_ARCH="x86_64"
11HOST_TARGET="$HOST_ARCH-macos-none"
12HOST_MCPU="baseline"
13HOST_CACHE_BASENAME="zig+llvm+lld+clang-$HOST_TARGET-0.10.0-dev.2931+bdf3fa12f"
14HOST_PREFIX="$HOME/$HOST_CACHE_BASENAME"
15
16ARCH="aarch64"
17TARGET="$ARCH-macos-none"
18MCPU="apple_a14"
19CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.2931+bdf3fa12f"
20PREFIX="$HOME/$CACHE_BASENAME"
21
22JOBS="-j2"
23
24rm -rf $HOST_PREFIX $PREFIX
25cd $HOME
26
27wget -nv "https://ziglang.org/deps/$HOST_CACHE_BASENAME.tar.xz"
28wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
29tar xf "$HOST_CACHE_BASENAME.tar.xz"
30tar xf "$CACHE_BASENAME.tar.xz"
31
32cd $ZIGDIR
33
34# Make the `zig version` number consistent.
35# This will affect the cmake command below.
36git config core.abbrev 9
37git fetch --unshallow || true
38git fetch --tags
39
40# Build host zig compiler in debug so that we can get the
41# current version when packaging
42
43ZIG="$HOST_PREFIX/bin/zig"
44
45export CC="$ZIG cc -target $HOST_TARGET -mcpu=$HOST_MCPU"
46export CXX="$ZIG c++ -target $HOST_TARGET -mcpu=$HOST_MCPU"
47
48mkdir build.host
49cd build.host
50cmake .. \
51 -DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
52 -DCMAKE_PREFIX_PATH="$HOST_PREFIX" \
53 -DCMAKE_BUILD_TYPE=Release \
54 -DZIG_TARGET_TRIPLE="$HOST_TARGET" \
55 -DZIG_TARGET_MCPU="$HOST_MCPU" \
56 -DZIG_STATIC=ON \
57 -DZIG_OMIT_STAGE2=ON
58
59unset CC
60unset CXX
61
62make $JOBS install
63
64# Build zig compiler cross-compiled for arm64
65cd $ZIGDIR
66
67ZIG="$ZIGDIR/build.host/release/bin/zig"
68
69export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
70export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
71
72mkdir build
73cd build
74cmake .. \
75 -DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
76 -DCMAKE_PREFIX_PATH="$PREFIX" \
77 -DCMAKE_BUILD_TYPE=Release \
78 -DZIG_TARGET_TRIPLE="$TARGET" \
79 -DZIG_TARGET_MCPU="$MCPU" \
80 -DZIG_EXECUTABLE="$ZIG" \
81 -DZIG_STATIC=ON
82
83unset CC
84unset CXX
85
86make $JOBS install
87
88if [ "${BUILD_REASON}" != "PullRequest" ]; then
89 mv ../LICENSE release/
90
91 # We do not run test suite but still need langref.
92 mkdir -p release/docs
93 $ZIG run ../doc/docgen.zig -- $ZIG ../doc/langref.html.in release/docs/langref.html
94
95 # Produce the experimental std lib documentation.
96 mkdir -p release/docs/std
97 $ZIG test ../lib/std/std.zig \
98 --zig-lib-dir ../lib \
99 -femit-docs=release/docs/std \
100 -fno-emit-bin
101
102 mv release/bin/zig release/
103 rmdir release/bin
104
105 VERSION=$(../build.host/release/bin/zig version)
106 DIRNAME="zig-macos-$ARCH-$VERSION"
107 TARBALL="$DIRNAME.tar.xz"
108 mv release "$DIRNAME"
109 tar cfJ "$TARBALL" "$DIRNAME"
110
111 mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
112 s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
113
114 SHASUM=$(shasum -a 256 $TARBALL | cut '-d ' -f1)
115 BYTESIZE=$(wc -c < $TARBALL)
116
117 JSONFILE="macos-$GITBRANCH.json"
118 touch $JSONFILE
119 echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
120 echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
121 echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
122
123 s3cmd put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
124 s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-macos-$VERSION.json"
125
126 # `set -x` causes these variables to be mangled.
127 # See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
128 set +x
129 echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
130 echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
131 echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
132fi
ci/azure/macos_script+1-9
...@@ -34,6 +34,7 @@ git fetch --tags...@@ -34,6 +34,7 @@ git fetch --tags
34mkdir build34mkdir build
35cd build35cd build
36cmake .. \36cmake .. \
37 -DCMAKE_INSTALL_PREFIX="stage3-release" \
37 -DCMAKE_PREFIX_PATH="$PREFIX" \38 -DCMAKE_PREFIX_PATH="$PREFIX" \
38 -DCMAKE_BUILD_TYPE=Release \39 -DCMAKE_BUILD_TYPE=Release \
39 -DZIG_TARGET_TRIPLE="$TARGET" \40 -DZIG_TARGET_TRIPLE="$TARGET" \
...@@ -47,15 +48,6 @@ unset CXX...@@ -47,15 +48,6 @@ unset CXX
4748
48make $JOBS install49make $JOBS install
4950
50stage2/bin/zig build \
51 --prefix stage3-release \
52 --search-prefix "$PREFIX" \
53 -Dstatic-llvm \
54 -Drelease \
55 -Dstrip \
56 -Dtarget="$TARGET" \
57 -Denable-stage1
58
59stage3-release/bin/zig build test docs \51stage3-release/bin/zig build test docs \
60 -Denable-macos-sdk \52 -Denable-macos-sdk \
61 -Dstatic-llvm \53 -Dstatic-llvm \
ci/azure/pipelines.yml-12
...@@ -10,17 +10,6 @@ jobs:...@@ -10,17 +10,6 @@ jobs:
10 - script: ci/azure/macos_script10 - script: ci/azure/macos_script
11 name: main11 name: main
12 displayName: 'Build and test'12 displayName: 'Build and test'
13- job: BuildMacOS_arm64
14 pool:
15 vmImage: 'macOS-11'
16 timeoutInMinutes: 180
17 steps:
18 - task: DownloadSecureFile@1
19 inputs:
20 secureFile: s3cfg
21 - script: ci/azure/macos_arm64_script
22 name: main
23 displayName: 'Build'
24- job: BuildWindows13- job: BuildWindows
25 timeoutInMinutes: 36014 timeoutInMinutes: 360
26 pool:15 pool:
...@@ -155,7 +144,6 @@ jobs:...@@ -155,7 +144,6 @@ jobs:
155- job: OnMasterSuccess144- job: OnMasterSuccess
156 dependsOn:145 dependsOn:
157 - BuildMacOS146 - BuildMacOS
158 - BuildMacOS_arm64
159 - BuildWindows147 - BuildWindows
160 condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))148 condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
161 strategy:149 strategy:
ci/drone/linux_script_base deleted-22
...@@ -1,22 +0,0 @@
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
16set -x
17set -e
18
19TRIPLEARCH="$(uname -m)"
20DISTDIR="$DRONE_WORKSPACE/dist"
21
22export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
ci/drone/linux_script_build+10-19
...@@ -1,17 +1,16 @@...@@ -1,17 +1,16 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
45
5# Probe CPU/brand details.6ARCH="$(uname -m)"
6# TODO: `lscpu` is changing package names in EDGE to `util-linux-misc`7INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
7apk update8
8apk add util-linux9export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
9echo "lscpu:"
10lscpu | sed 's,^, : ,'
1110
12PREFIX="/deps/local"11PREFIX="/deps/local"
13ZIG="$PREFIX/bin/zig"12ZIG="$PREFIX/bin/zig"
14TARGET="$TRIPLEARCH-linux-musl"13TARGET="$ARCH-linux-musl"
15MCPU="baseline"14MCPU="baseline"
1615
17export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"16export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
...@@ -30,8 +29,8 @@ cat <<'ENDFILE' >$PREFIX/bin/ranlib...@@ -30,8 +29,8 @@ cat <<'ENDFILE' >$PREFIX/bin/ranlib
30/deps/local/bin/zig ranlib $@29/deps/local/bin/zig ranlib $@
31ENDFILE30ENDFILE
3231
33chmod +x $PREFIX/bin/ar32chmod +x "$PREFIX/bin/ar"
34chmod +x $PREFIX/bin/ranlib33chmod +x "$PREFIX/bin/ranlib"
3534
36# Make the `zig version` number consistent.35# Make the `zig version` number consistent.
37# This will affect the cmake command below.36# This will affect the cmake command below.
...@@ -43,6 +42,7 @@ mkdir build...@@ -43,6 +42,7 @@ mkdir build
43cd build42cd build
44cmake .. \43cmake .. \
45 -DCMAKE_PREFIX_PATH="$PREFIX" \44 -DCMAKE_PREFIX_PATH="$PREFIX" \
45 -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
46 -DCMAKE_BUILD_TYPE=Release \46 -DCMAKE_BUILD_TYPE=Release \
47 -DCMAKE_AR="$PREFIX/bin/ar" \47 -DCMAKE_AR="$PREFIX/bin/ar" \
48 -DCMAKE_RANLIB="$PREFIX/bin/ranlib" \48 -DCMAKE_RANLIB="$PREFIX/bin/ranlib" \
...@@ -56,12 +56,3 @@ cmake .. \...@@ -56,12 +56,3 @@ cmake .. \
56unset CC56unset CC
57unset CXX57unset CXX
58samu install58samu install
59
60stage2/bin/zig build \
61 --prefix "$DISTDIR" \
62 --search-prefix "$PREFIX" \
63 -Dstatic-llvm \
64 -Drelease \
65 -Dstrip \
66 -Dtarget="$TARGET" \
67 -Denable-stage1
ci/drone/linux_script_finalize+15-9
...@@ -1,6 +1,12 @@...@@ -1,6 +1,12 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
5
6ARCH="$(uname -m)"
7INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
8
9export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
410
5if [ -n "$DRONE_PULL_REQUEST" ]; then11if [ -n "$DRONE_PULL_REQUEST" ]; then
6 exit 012 exit 0
...@@ -12,16 +18,16 @@ pip3 install s3cmd...@@ -12,16 +18,16 @@ pip3 install s3cmd
1218
13cd build19cd build
1420
15mv ../LICENSE "$DISTDIR/"21mv ../LICENSE "$INSTALL_PREFIX/"
16mv ../zig-cache/langref.html "$DISTDIR/"22mv ../zig-cache/langref.html "$INSTALL_PREFIX/"
17mv "$DISTDIR/bin/zig" "$DISTDIR/"23mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/"
18rmdir "$DISTDIR/bin"24rmdir "$INSTALL_PREFIX/bin"
1925
20GITBRANCH="$DRONE_BRANCH"26GITBRANCH="$DRONE_BRANCH"
21VERSION="$("$DISTDIR/zig" version)"27VERSION="$("$INSTALL_PREFIX/zig" version)"
22DIRNAME="zig-linux-$TRIPLEARCH-$VERSION"28DIRNAME="zig-linux-$ARCH-$VERSION"
23TARBALL="$DIRNAME.tar.xz"29TARBALL="$DIRNAME.tar.xz"
24mv "$DISTDIR" "$DIRNAME"30mv "$INSTALL_PREFIX" "$DIRNAME"
25tar cfJ "$TARBALL" "$DIRNAME"31tar cfJ "$TARBALL" "$DIRNAME"
2632
27s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/33s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
...@@ -35,7 +41,7 @@ echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE...@@ -35,7 +41,7 @@ echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
35echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE41echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
36echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE42echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
3743
38s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json"44s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json"
39if [ "$GITBRANCH" = "master" ]; then45if [ "$GITBRANCH" = "master" ]; then
40 # avoid leaking oauth token46 # avoid leaking oauth token
41 set +x47 set +x
ci/drone/test_linux_behavior+10-5
...@@ -1,8 +1,13 @@...@@ -1,8 +1,13 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
45
5./build/zig build test-behavior -Dskip-non-native6INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
6./build/zig build test-compiler-rt -Dskip-non-native7ZIG="$INSTALL_PREFIX/bin/zig"
7./build/zig build test-fmt8export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
8./build/zig build docs9
10$ZIG build test-behavior -Dskip-non-native
11$ZIG build test-compiler-rt -Dskip-non-native
12$ZIG build test-fmt
13$ZIG build docs
ci/drone/test_linux_cases+8-3
...@@ -1,6 +1,11 @@...@@ -1,6 +1,11 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
45
5./build/zig build -Dskip-non-native # test building self-hosted without LLVM6INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
6./build/zig build -Dskip-non-native test-cases7ZIG="$INSTALL_PREFIX/bin/zig"
8export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
9
10$ZIG build -Dskip-non-native # test building self-hosted without LLVM
11$ZIG build -Dskip-non-native test-cases
ci/drone/test_linux_misc+13-8
...@@ -1,11 +1,16 @@...@@ -1,11 +1,16 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
45
5./build/zig build test-universal-libc -Dskip-non-native6INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
6./build/zig build test-compare-output -Dskip-non-native7ZIG="$INSTALL_PREFIX/bin/zig"
7./build/zig build test-standalone -Dskip-non-native -Dskip-release-safe8export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
8./build/zig build test-stack-traces -Dskip-non-native9
9./build/zig build test-cli -Dskip-non-native10$ZIG build test-universal-libc -Dskip-non-native
10./build/zig build test-asm-link -Dskip-non-native11$ZIG build test-compare-output -Dskip-non-native
11./build/zig build test-translate-c -Dskip-non-native12$ZIG build test-standalone -Dskip-non-native -Dskip-release-safe
13$ZIG build test-stack-traces -Dskip-non-native
14$ZIG build test-cli -Dskip-non-native
15$ZIG build test-asm-link -Dskip-non-native
16$ZIG build test-translate-c -Dskip-non-native
ci/drone/test_linux_std_Debug+7-2
...@@ -1,5 +1,10 @@...@@ -1,5 +1,10 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
45
5./build/zig build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native6INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
7ZIG="$INSTALL_PREFIX/bin/zig"
8export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
9
10$ZIG build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native
ci/drone/test_linux_std_ReleaseFast+7-2
...@@ -1,5 +1,10 @@...@@ -1,5 +1,10 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
45
5./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded6INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
7ZIG="$INSTALL_PREFIX/bin/zig"
8export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
9
10$ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
ci/drone/test_linux_std_ReleaseSafe+7-2
...@@ -1,5 +1,10 @@...@@ -1,5 +1,10 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
45
5./build/zig build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded6INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
7ZIG="$INSTALL_PREFIX/bin/zig"
8export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
9
10$ZIG build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
ci/drone/test_linux_std_ReleaseSmall+9-4
...@@ -1,11 +1,16 @@...@@ -1,11 +1,16 @@
1#!/bin/sh1#!/bin/sh
22
3. ./ci/drone/linux_script_base3set -x
4set -e
5
6INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
7ZIG="$INSTALL_PREFIX/bin/zig"
8export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
49
5# Empirically, this takes about 55 minutes on the CI, and is the bottleneck10# Empirically, this takes about 55 minutes on the CI, and is the bottleneck
6# causing timeouts. So this is disabled in favor of running a smaller set11# causing timeouts. So this is disabled in favor of running a smaller set
7# of ReleaseSmall std lib tests.12# of ReleaseSmall std lib tests.
8# ./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native13# $ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native
914
10./build/zig test lib/std/std.zig -OReleaseSmall15$ZIG test lib/std/std.zig -OReleaseSmall
11./build/zig test lib/std/std.zig -OReleaseSmall -lc16$ZIG test lib/std/std.zig -OReleaseSmall -lc
ci/srht/freebsd_script+17-17
...@@ -31,6 +31,8 @@ export TERM=dumb...@@ -31,6 +31,8 @@ export TERM=dumb
3131
32mkdir build32mkdir build
33cd build33cd build
34
35
34cmake .. \36cmake .. \
35 -DCMAKE_BUILD_TYPE=Release \37 -DCMAKE_BUILD_TYPE=Release \
36 -DCMAKE_PREFIX_PATH=$PREFIX \38 -DCMAKE_PREFIX_PATH=$PREFIX \
...@@ -38,40 +40,38 @@ cmake .. \...@@ -38,40 +40,38 @@ cmake .. \
38 -DZIG_TARGET_MCPU="$MCPU" \40 -DZIG_TARGET_MCPU="$MCPU" \
39 -DZIG_STATIC=ON \41 -DZIG_STATIC=ON \
40 -GNinja42 -GNinja
41samu install
4243
43# TODO: eliminate this workaround. Without this, zig does not end up passing44# TODO: eliminate this workaround. Without this, zig does not end up passing
44# -isystem /usr/include when building libc++, resulting in #include <sys/endian.h>45# -isystem /usr/include when building libc++, resulting in #include <sys/endian.h>
45# "file not found" errors.46# "file not found" errors.
46stage2/bin/zig libc >libc.txt47echo "include_dir=/usr/include" >>libc.txt
48echo "sys_include_dir=/usr/include" >>libc.txt
49echo "crt_dir=/usr/lib" >>libc.txt
50echo "msvc_lib_dir=" >>libc.txt
51echo "kernel32_lib_dir=" >>libc.txt
52echo "gcc_dir=" >>libc.txt
53ZIG_LIBC_TXT="$(pwd)/libc.txt"
4754
48ZIG_LIBC=libc.txt stage2/bin/zig build \55ZIG_LIBC="$ZIG_LIBC_TXT" samu install
49 --prefix stage3-release \
50 --search-prefix "$PREFIX" \
51 -Dstatic-llvm \
52 -Drelease \
53 -Dstrip \
54 -Dtarget="$TARGET" \
55 -Denable-stage1
5656
57# Here we skip some tests to save time.57# Here we skip some tests to save time.
58stage3-release/bin/zig build test docs \58stage3/bin/zig build test docs \
59 -Dstatic-llvm \59 -Dstatic-llvm \
60 --search-prefix "$PREFIX" \60 --search-prefix "$PREFIX" \
61 -Dskip-stage1 \61 -Dskip-stage1 \
62 -Dskip-non-native62 -Dskip-non-native
6363
64if [ -f ~/.s3cfg ]; then64if [ -f ~/.s3cfg ]; then
65 mv ../LICENSE stage3-release/65 mv ../LICENSE stage3/
66 mv ../zig-cache/langref.html stage3-release/66 mv ../zig-cache/langref.html stage3/
67 mv stage3-release/bin/zig stage3-release/67 mv stage3/bin/zig stage3/
68 rmdir stage3-release/bin68 rmdir stage3/bin
6969
70 GITBRANCH=$(basename $GITHUB_REF)70 GITBRANCH=$(basename $GITHUB_REF)
71 VERSION=$(stage3-release/zig version)71 VERSION=$(stage3/zig version)
72 DIRNAME="zig-freebsd-x86_64-$VERSION"72 DIRNAME="zig-freebsd-x86_64-$VERSION"
73 TARBALL="$DIRNAME.tar.xz"73 TARBALL="$DIRNAME.tar.xz"
74 mv stage3-release "$DIRNAME"74 mv stage3 "$DIRNAME"
75 tar cfJ "$TARBALL" "$DIRNAME"75 tar cfJ "$TARBALL" "$DIRNAME"
7676
77 s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/77 s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
ci/zinc/build_aarch64_macos created+20
...@@ -0,0 +1,20 @@
1#!/bin/sh
2
3set -x
4set -e
5
6RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
7TARGET="aarch64-macos-none"
8MCPU="apple_a14"
9INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET"
10SEARCH_PREFIX="/deps/$TARGET"
11
12"$RELEASE_STAGING/bin/zig" build \
13 --prefix "$INSTALL_PREFIX" \
14 --search-prefix "$SEARCH_PREFIX" \
15 -Dstatic-llvm \
16 -Drelease \
17 -Dstrip \
18 -Dtarget="$TARGET" \
19 -Dmcpu="$MCPU" \
20 -Denable-stage1
ci/zinc/configure_git created+10
...@@ -0,0 +1,10 @@
1#!/bin/sh
2
3set -x
4set -e
5
6# Make the `zig version` number consistent.
7# This will affect the cmake commands that follow.
8# This is in its own script because git does not support this command
9# being run concurrently with itself.
10git config core.abbrev 9
ci/zinc/drone.yml+50-7
...@@ -9,17 +9,33 @@ workspace:...@@ -9,17 +9,33 @@ workspace:
9 path: /workspace9 path: /workspace
1010
11steps:11steps:
12- name: configure_git
13 image: ci/debian-amd64:11.1-9
14 commands:
15 - ./ci/zinc/configure_git
16
12- name: test_stage3_debug17- name: test_stage3_debug
13 image: ci/debian-amd64:11.1-818 depends_on:
19 - configure_git
20 image: ci/debian-amd64:11.1-9
14 commands:21 commands:
15 - ./ci/zinc/linux_test_stage3_debug.sh22 - ./ci/zinc/linux_test_stage3_debug
1623
17- name: test_stage3_release24- name: test_stage3_release
18 image: ci/debian-amd64:11.1-825 depends_on:
26 - configure_git
27 image: ci/debian-amd64:11.1-9
19 commands:28 commands:
20 - ./ci/zinc/linux_test_stage3_release.sh29 - ./ci/zinc/linux_test_stage3_release
2130
22- name: package31- name: build_aarch64_macos
32 depends_on:
33 - test_stage3_release
34 image: ci/debian-amd64:11.1-9
35 commands:
36 - ./ci/zinc/build_aarch64_macos
37
38- name: linux_package
23 depends_on:39 depends_on:
24 - test_stage3_debug40 - test_stage3_debug
25 - test_stage3_release41 - test_stage3_release
...@@ -28,13 +44,40 @@ steps:...@@ -28,13 +44,40 @@ steps:
28 - master44 - master
29 event:45 event:
30 - push46 - push
31 image: ci/debian-amd64:11.1-847 image: ci/debian-amd64:11.1-9
48 environment:
49 AWS_ACCESS_KEY_ID:
50 from_secret: AWS_ACCESS_KEY_ID
51 AWS_SECRET_ACCESS_KEY:
52 from_secret: AWS_SECRET_ACCESS_KEY
53 commands:
54 - ./ci/zinc/linux_package
55
56- name: macos_package
57 depends_on:
58 - test_stage3_debug
59 - build_aarch64_macos
60 when:
61 branch:
62 - master
63 event:
64 - push
65 image: ci/debian-amd64:11.1-9
32 environment:66 environment:
33 AWS_ACCESS_KEY_ID:67 AWS_ACCESS_KEY_ID:
34 from_secret: AWS_ACCESS_KEY_ID68 from_secret: AWS_ACCESS_KEY_ID
35 AWS_SECRET_ACCESS_KEY:69 AWS_SECRET_ACCESS_KEY:
36 from_secret: AWS_SECRET_ACCESS_KEY70 from_secret: AWS_SECRET_ACCESS_KEY
71 commands:
72 - ./ci/zinc/macos_package
73
74- name: notify_lavahut
75 depends_on:
76 - macos_package
77 - linux_package
78 image: ci/debian-amd64:11.1-9
79 environment:
37 SRHT_OAUTH_TOKEN:80 SRHT_OAUTH_TOKEN:
38 from_secret: SRHT_OAUTH_TOKEN81 from_secret: SRHT_OAUTH_TOKEN
39 commands:82 commands:
40 - ./ci/zinc/linux_package.sh83 - ./ci/zinc/notify_lavahut
ci/zinc/linux_base.sh deleted-31
...@@ -1,31 +0,0 @@
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
16set -x
17set -e
18
19ARCH="$(uname -m)"
20
21DEPS_LOCAL="/deps/local"
22WORKSPACE="$DRONE_WORKSPACE"
23
24DEBUG_STAGING="$WORKSPACE/_debug/staging"
25RELEASE_STAGING="$WORKSPACE/_release/staging"
26
27export PATH=$DEPS_LOCAL/bin:$PATH
28
29# Make the `zig version` number consistent.
30# This will affect the cmake commands that follow.
31git config core.abbrev 9
ci/zinc/linux_package created+45
...@@ -0,0 +1,45 @@
1#!/bin/sh
2
3set -x
4set -e
5
6ARCH="$(uname -m)"
7OS="linux"
8RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
9VERSION=$($RELEASE_STAGING/bin/zig version)
10BASENAME="zig-$OS-$ARCH-$VERSION"
11TARBALL="$BASENAME.tar.xz"
12
13# This runs concurrently with the macos_package script, so it should not make
14# any changes to the filesystem that will cause problems for the other script.
15
16cp -r "$RELEASE_STAGING" "$BASENAME"
17
18# Remove the unnecessary bin dir in $prefix/bin/zig
19mv $BASENAME/bin/zig $BASENAME/
20rmdir $BASENAME/bin
21
22# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
23mv $BASENAME/lib/zig $BASENAME/lib2
24rmdir $BASENAME/lib
25mv $BASENAME/lib2 $BASENAME/lib
26
27tar cfJ "$TARBALL" "$BASENAME"
28
29SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
30BYTESIZE=$(wc -c < $TARBALL)
31
32MANIFEST="manifest.json"
33touch $MANIFEST
34echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST
35echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST
36echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST
37
38# Publish artifact.
39s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
40
41# Publish manifest.
42s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json"
43
44# Explicit exit helps show last command duration.
45exit
ci/zinc/linux_package.sh deleted-45
...@@ -1,45 +0,0 @@
1#!/bin/sh
2
3. ./ci/zinc/linux_base.sh
4
5# Remove the unnecessary bin dir in $prefix/bin/zig
6mv $RELEASE_STAGING/bin/zig $RELEASE_STAGING/
7rmdir $RELEASE_STAGING/bin
8
9# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
10mv $RELEASE_STAGING/lib/zig $RELEASE_STAGING/lib2
11rmdir $RELEASE_STAGING/lib
12mv $RELEASE_STAGING/lib2 $RELEASE_STAGING/lib
13
14VERSION=$($RELEASE_STAGING/zig version)
15BASENAME="zig-linux-$ARCH-$VERSION"
16TARBALL="$BASENAME.tar.xz"
17mv "$RELEASE_STAGING" "$BASENAME"
18tar cfJ "$TARBALL" "$BASENAME"
19ls -l "$TARBALL"
20
21SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
22BYTESIZE=$(wc -c < $TARBALL)
23
24MANIFEST="manifest.json"
25touch $MANIFEST
26echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST
27echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST
28echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST
29
30# Publish artifact.
31s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
32
33# Publish manifest.
34s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json"
35
36# Avoid leaking oauth token.
37set +x
38
39cd $WORKSPACE
40./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
41
42set -x
43
44# Explicit exit helps show last command duration.
45exit
ci/zinc/linux_test_stage3_debug created+61
...@@ -0,0 +1,61 @@
1#!/bin/sh
2
3set -x
4set -e
5
6ARCH="$(uname -m)"
7DEPS_LOCAL="/deps/local"
8OLD_ZIG="$DEPS_LOCAL/bin/zig"
9TARGET="${ARCH}-linux-musl"
10MCPU="baseline"
11
12export PATH=$DEPS_LOCAL/bin:$PATH
13
14echo "building stage3-debug with zig version $($OLD_ZIG version)"
15
16# Override the cache directories so that we don't clobber with the release
17# testing script which is running concurrently and in the same directory.
18# Normally we want processes to cooperate, but in this case we want them isolated.
19export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-cache-local-debug"
20export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-cache-global-debug"
21
22export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
23export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
24
25mkdir build-debug
26cd build-debug
27cmake .. \
28 -DCMAKE_INSTALL_PREFIX="$(pwd)/stage3" \
29 -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
30 -DCMAKE_BUILD_TYPE=Debug \
31 -DZIG_STATIC=ON \
32 -DZIG_USE_LLVM_CONFIG=OFF \
33 -GNinja
34
35# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
36# so that installation and testing do not get affected by them.
37unset CC
38unset CXX
39
40ninja install
41
42echo "Looking for non-conforming code formatting..."
43stage3/bin/zig fmt --check .. \
44 --exclude ../test/cases/ \
45 --exclude ../build-debug \
46 --exclude ../build-release \
47 --exclude "$ZIG_LOCAL_CACHE_DIR" \
48 --exclude "$ZIG_GLOBAL_CACHE_DIR"
49
50# simultaneously test building self-hosted without LLVM and with 32-bit arm
51stage3/bin/zig build -Dtarget=arm-linux-musleabihf
52
53stage3/bin/zig build test \
54 -fqemu \
55 -fwasmtime \
56 -Dstatic-llvm \
57 -Dtarget=native-native-musl \
58 --search-prefix "$DEPS_LOCAL"
59
60# Explicit exit helps show last command duration.
61exit
ci/zinc/linux_test_stage3_debug.sh deleted-56
...@@ -1,56 +0,0 @@
1#!/bin/sh
2
3. ./ci/zinc/linux_base.sh
4
5OLD_ZIG="$DEPS_LOCAL/bin/zig"
6TARGET="${ARCH}-linux-musl"
7MCPU="baseline"
8
9echo "building stage3-debug with zig version $($OLD_ZIG version)"
10
11# Override the cache directories so that we don't clobber with the release
12# testing script which is running concurrently and in the same directory.
13# Normally we want processes to cooperate, but in this case we want them isolated.
14export ZIG_LOCAL_CACHE_DIR="$(pwd)/zig-cache-local-debug"
15export ZIG_GLOBAL_CACHE_DIR="$(pwd)/zig-cache-global-debug"
16
17export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
18export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
19
20mkdir build-debug
21cd build-debug
22cmake .. \
23 -DCMAKE_INSTALL_PREFIX="$(pwd)/stage3" \
24 -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
25 -DCMAKE_BUILD_TYPE=Debug \
26 -DZIG_STATIC=ON \
27 -DZIG_USE_LLVM_CONFIG=OFF \
28 -GNinja
29
30# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
31# so that installation and testing do not get affected by them.
32unset CC
33unset CXX
34
35ninja install
36
37echo "Looking for non-conforming code formatting..."
38stage3/bin/zig fmt --check .. \
39 --exclude ../test/cases/ \
40 --exclude ../build-debug \
41 --exclude ../build-release \
42 --exclude "$ZIG_LOCAL_CACHE_DIR" \
43 --exclude "$ZIG_GLOBAL_CACHE_DIR"
44
45# simultaneously test building self-hosted without LLVM and with 32-bit arm
46stage3/bin/zig build -Dtarget=arm-linux-musleabihf
47
48stage3/bin/zig build test \
49 -fqemu \
50 -fwasmtime \
51 -Dstatic-llvm \
52 -Dtarget=native-native-musl \
53 --search-prefix "$DEPS_LOCAL"
54
55# Explicit exit helps show last command duration.
56exit
ci/zinc/linux_test_stage3_release created+58
...@@ -0,0 +1,58 @@
1#!/bin/sh
2
3set -x
4set -e
5
6ARCH="$(uname -m)"
7DEPS_LOCAL="/deps/local"
8RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
9OLD_ZIG="$DEPS_LOCAL/bin/zig"
10TARGET="${ARCH}-linux-musl"
11MCPU="baseline"
12
13export PATH=$DEPS_LOCAL/bin:$PATH
14
15echo "building stage3-release with zig version $($OLD_ZIG version)"
16
17export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
18export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
19
20mkdir build-release
21cd build-release
22cmake .. \
23 -DCMAKE_INSTALL_PREFIX="$RELEASE_STAGING" \
24 -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
25 -DCMAKE_BUILD_TYPE=Release \
26 -DZIG_TARGET_TRIPLE="$TARGET" \
27 -DZIG_TARGET_MCPU="$MCPU" \
28 -DZIG_STATIC=ON \
29 -GNinja
30
31# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
32# so that installation and testing do not get affected by them.
33unset CC
34unset CXX
35
36ninja install
37
38"$RELEASE_STAGING/bin/zig" build test docs \
39 -fqemu \
40 -fwasmtime \
41 -Dstatic-llvm \
42 -Dtarget=native-native-musl \
43 --search-prefix "$DEPS_LOCAL"
44
45# Produce the experimental std lib documentation.
46mkdir -p "$RELEASE_STAGING/docs/std"
47"$RELEASE_STAGING/bin/zig" test ../lib/std/std.zig \
48 -femit-docs=$RELEASE_STAGING/docs/std \
49 -fno-emit-bin
50
51cp ../LICENSE $RELEASE_STAGING/
52cp ../zig-cache/langref.html $RELEASE_STAGING/docs/
53
54# Look for HTML errors.
55tidy --drop-empty-elements no -qe $RELEASE_STAGING/docs/langref.html
56
57# Explicit exit helps show last command duration.
58exit
ci/zinc/linux_test_stage3_release.sh deleted-53
...@@ -1,53 +0,0 @@
1#!/bin/sh
2
3. ./ci/zinc/linux_base.sh
4
5OLD_ZIG="$DEPS_LOCAL/bin/zig"
6TARGET="${ARCH}-linux-musl"
7MCPU="baseline"
8
9echo "building stage3-release with zig version $($OLD_ZIG version)"
10
11export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
12export CXX="$OLD_ZIG c++ -target $TARGET -mcpu=$MCPU"
13
14mkdir build-release
15cd build-release
16cmake .. \
17 -DCMAKE_INSTALL_PREFIX="$RELEASE_STAGING" \
18 -DCMAKE_PREFIX_PATH="$DEPS_LOCAL" \
19 -DCMAKE_BUILD_TYPE=Release \
20 -DZIG_TARGET_TRIPLE="$TARGET" \
21 -DZIG_TARGET_MCPU="$MCPU" \
22 -DZIG_STATIC=ON \
23 -GNinja
24
25# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
26# so that installation and testing do not get affected by them.
27unset CC
28unset CXX
29
30ninja install
31
32"$RELEASE_STAGING/bin/zig" build test docs \
33 -fqemu \
34 -fwasmtime \
35 -Dstatic-llvm \
36 -Dtarget=native-native-musl \
37 --search-prefix "$DEPS_LOCAL"
38
39# Produce the experimental std lib documentation.
40mkdir -p "$RELEASE_STAGING/docs/std"
41"$RELEASE_STAGING/bin/zig" test ../lib/std/std.zig \
42 --zig-lib-dir lib \
43 -femit-docs=$RELEASE_STAGING/docs/std \
44 -fno-emit-bin
45
46cp ../LICENSE $RELEASE_STAGING/
47cp ../zig-cache/langref.html $RELEASE_STAGING/docs/
48
49# Look for HTML errors.
50tidy --drop-empty-elements no -qe $RELEASE_STAGING/docs/langref.html
51
52# Explicit exit helps show last command duration.
53exit
ci/zinc/macos_package created+49
...@@ -0,0 +1,49 @@
1#!/bin/sh
2
3set -x
4set -e
5
6ARCH="aarch64"
7OS=macos
8ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging"
9VERSION=$($ZIG_PREFIX/bin/zig version)
10TARGET="$ARCH-$OS-none"
11INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET"
12BASENAME="zig-$OS-$ARCH-$VERSION"
13TARBALL="$BASENAME.tar.xz"
14
15# This runs concurrently with the linux_package script, so it should not make
16# any changes to the filesystem that will cause problems for the other script.
17
18# Remove the unnecessary bin dir in $prefix/bin/zig
19mv $INSTALL_PREFIX/bin/zig $INSTALL_PREFIX/
20rmdir $INSTALL_PREFIX/bin
21
22# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
23mv $INSTALL_PREFIX/lib/zig $INSTALL_PREFIX/lib2
24rmdir $INSTALL_PREFIX/lib
25mv $INSTALL_PREFIX/lib2 $INSTALL_PREFIX/lib
26
27cp -r "$ZIG_PREFIX/docs" "$INSTALL_PREFIX/"
28cp "$ZIG_PREFIX/LICENSE" "$INSTALL_PREFIX/"
29
30mv "$INSTALL_PREFIX" "$BASENAME"
31tar cfJ "$TARBALL" "$BASENAME"
32
33SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
34BYTESIZE=$(wc -c < $TARBALL)
35
36MANIFEST="manifest.json"
37touch $MANIFEST
38echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST
39echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST
40echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST
41
42# Publish artifact.
43s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
44
45# Publish manifest.
46s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json"
47
48# Explicit exit helps show last command duration.
49exit
ci/zinc/notify_lavahut created+9
...@@ -0,0 +1,9 @@
1#!/bin/sh
2
3set +x # Avoid leaking oauth token.
4set -e
5
6ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging"
7VERSION=$($ZIG_PREFIX/bin/zig version)
8cd $DRONE_WORKSPACE
9./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"