mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
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.
This commit is contained in:
parent
aee53e2ffd
commit
532cfb65e0
@ -960,8 +960,10 @@ else()
|
||||
endif()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||
set(ZIG_RELEASE_ARG "")
|
||||
else()
|
||||
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
|
||||
set(ZIG_RELEASE_ARG -Drelease)
|
||||
else()
|
||||
set(ZIG_RELEASE_ARG -Drelease -Dstrip)
|
||||
endif()
|
||||
if(ZIG_SKIP_INSTALL_LIB_FILES)
|
||||
set(ZIG_SKIP_INSTALL_LIB_FILES_ARG "-Dskip-install-lib-files")
|
||||
@ -985,7 +987,9 @@ set(BUILD_ZIG2_ARGS
|
||||
--zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
|
||||
"-femit-bin=${ZIG2_OBJECT}"
|
||||
-fcompiler-rt
|
||||
"${ZIG_SINGLE_THREADED_ARG}"
|
||||
${ZIG_SINGLE_THREADED_ARG}
|
||||
-target "${ZIG_TARGET_TRIPLE}"
|
||||
-mcpu "${ZIG_TARGET_MCPU}"
|
||||
-lc
|
||||
--pkg-begin build_options "${ZIG_CONFIG_ZIG_OUT}"
|
||||
--pkg-end
|
||||
@ -1042,10 +1046,10 @@ set(ZIG_INSTALL_ARGS "build"
|
||||
"-Dconfig_h=${ZIG_CONFIG_H_OUT}"
|
||||
"-Denable-llvm"
|
||||
"-Denable-stage1"
|
||||
"${ZIG_RELEASE_ARG}"
|
||||
"${ZIG_STATIC_ARG}"
|
||||
"${ZIG_SKIP_INSTALL_LIB_FILES_ARG}"
|
||||
"${ZIG_SINGLE_THREADED_ARG}"
|
||||
${ZIG_RELEASE_ARG}
|
||||
${ZIG_STATIC_ARG}
|
||||
${ZIG_SKIP_INSTALL_LIB_FILES_ARG}
|
||||
${ZIG_SINGLE_THREADED_ARG}
|
||||
"-Dtarget=${ZIG_TARGET_TRIPLE}"
|
||||
"-Dcpu=${ZIG_TARGET_MCPU}"
|
||||
)
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
brew update && brew install ncurses s3cmd
|
||||
|
||||
ZIGDIR="$(pwd)"
|
||||
|
||||
HOST_ARCH="x86_64"
|
||||
HOST_TARGET="$HOST_ARCH-macos-none"
|
||||
HOST_MCPU="baseline"
|
||||
HOST_CACHE_BASENAME="zig+llvm+lld+clang-$HOST_TARGET-0.10.0-dev.2931+bdf3fa12f"
|
||||
HOST_PREFIX="$HOME/$HOST_CACHE_BASENAME"
|
||||
|
||||
ARCH="aarch64"
|
||||
TARGET="$ARCH-macos-none"
|
||||
MCPU="apple_a14"
|
||||
CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.2931+bdf3fa12f"
|
||||
PREFIX="$HOME/$CACHE_BASENAME"
|
||||
|
||||
JOBS="-j2"
|
||||
|
||||
rm -rf $HOST_PREFIX $PREFIX
|
||||
cd $HOME
|
||||
|
||||
wget -nv "https://ziglang.org/deps/$HOST_CACHE_BASENAME.tar.xz"
|
||||
wget -nv "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
|
||||
tar xf "$HOST_CACHE_BASENAME.tar.xz"
|
||||
tar xf "$CACHE_BASENAME.tar.xz"
|
||||
|
||||
cd $ZIGDIR
|
||||
|
||||
# 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
|
||||
|
||||
# Build host zig compiler in debug so that we can get the
|
||||
# current version when packaging
|
||||
|
||||
ZIG="$HOST_PREFIX/bin/zig"
|
||||
|
||||
export CC="$ZIG cc -target $HOST_TARGET -mcpu=$HOST_MCPU"
|
||||
export CXX="$ZIG c++ -target $HOST_TARGET -mcpu=$HOST_MCPU"
|
||||
|
||||
mkdir build.host
|
||||
cd build.host
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
|
||||
-DCMAKE_PREFIX_PATH="$HOST_PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$HOST_TARGET" \
|
||||
-DZIG_TARGET_MCPU="$HOST_MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-DZIG_OMIT_STAGE2=ON
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
make $JOBS install
|
||||
|
||||
# Build zig compiler cross-compiled for arm64
|
||||
cd $ZIGDIR
|
||||
|
||||
ZIG="$ZIGDIR/build.host/release/bin/zig"
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="$(pwd)/release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_EXECUTABLE="$ZIG" \
|
||||
-DZIG_STATIC=ON
|
||||
|
||||
unset CC
|
||||
unset CXX
|
||||
|
||||
make $JOBS install
|
||||
|
||||
if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
||||
mv ../LICENSE release/
|
||||
|
||||
# We do not run test suite but still need langref.
|
||||
mkdir -p release/docs
|
||||
$ZIG run ../doc/docgen.zig -- $ZIG ../doc/langref.html.in release/docs/langref.html
|
||||
|
||||
# Produce the experimental std lib documentation.
|
||||
mkdir -p release/docs/std
|
||||
$ZIG test ../lib/std/std.zig \
|
||||
--zig-lib-dir ../lib \
|
||||
-femit-docs=release/docs/std \
|
||||
-fno-emit-bin
|
||||
|
||||
mv release/bin/zig release/
|
||||
rmdir release/bin
|
||||
|
||||
VERSION=$(../build.host/release/bin/zig version)
|
||||
DIRNAME="zig-macos-$ARCH-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv release "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
||||
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="macos-$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/$ARCH-macos-$VERSION.json"
|
||||
|
||||
# `set -x` causes these variables to be mangled.
|
||||
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
|
||||
set +x
|
||||
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
|
||||
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
|
||||
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
|
||||
fi
|
||||
@ -34,6 +34,7 @@ git fetch --tags
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_INSTALL_PREFIX="stage3-release" \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DZIG_TARGET_TRIPLE="$TARGET" \
|
||||
@ -47,15 +48,6 @@ unset CXX
|
||||
|
||||
make $JOBS install
|
||||
|
||||
stage2/bin/zig build \
|
||||
--prefix stage3-release \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
|
||||
stage3-release/bin/zig build test docs \
|
||||
-Denable-macos-sdk \
|
||||
-Dstatic-llvm \
|
||||
|
||||
@ -10,17 +10,6 @@ jobs:
|
||||
- script: ci/azure/macos_script
|
||||
name: main
|
||||
displayName: 'Build and test'
|
||||
- job: BuildMacOS_arm64
|
||||
pool:
|
||||
vmImage: 'macOS-11'
|
||||
timeoutInMinutes: 180
|
||||
steps:
|
||||
- task: DownloadSecureFile@1
|
||||
inputs:
|
||||
secureFile: s3cfg
|
||||
- script: ci/azure/macos_arm64_script
|
||||
name: main
|
||||
displayName: 'Build'
|
||||
- job: BuildWindows
|
||||
timeoutInMinutes: 360
|
||||
pool:
|
||||
@ -155,7 +144,6 @@ jobs:
|
||||
- job: OnMasterSuccess
|
||||
dependsOn:
|
||||
- BuildMacOS
|
||||
- BuildMacOS_arm64
|
||||
- BuildWindows
|
||||
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
|
||||
strategy:
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
#!/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"
|
||||
@ -1,17 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# Probe CPU/brand details.
|
||||
# TODO: `lscpu` is changing package names in EDGE to `util-linux-misc`
|
||||
apk update
|
||||
apk add util-linux
|
||||
echo "lscpu:"
|
||||
lscpu | sed 's,^, : ,'
|
||||
ARCH="$(uname -m)"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
PREFIX="/deps/local"
|
||||
ZIG="$PREFIX/bin/zig"
|
||||
TARGET="$TRIPLEARCH-linux-musl"
|
||||
TARGET="$ARCH-linux-musl"
|
||||
MCPU="baseline"
|
||||
|
||||
export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
@ -30,8 +29,8 @@ cat <<'ENDFILE' >$PREFIX/bin/ranlib
|
||||
/deps/local/bin/zig ranlib $@
|
||||
ENDFILE
|
||||
|
||||
chmod +x $PREFIX/bin/ar
|
||||
chmod +x $PREFIX/bin/ranlib
|
||||
chmod +x "$PREFIX/bin/ar"
|
||||
chmod +x "$PREFIX/bin/ranlib"
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake command below.
|
||||
@ -43,6 +42,7 @@ mkdir build
|
||||
cd build
|
||||
cmake .. \
|
||||
-DCMAKE_PREFIX_PATH="$PREFIX" \
|
||||
-DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_AR="$PREFIX/bin/ar" \
|
||||
-DCMAKE_RANLIB="$PREFIX/bin/ranlib" \
|
||||
@ -56,12 +56,3 @@ cmake .. \
|
||||
unset CC
|
||||
unset CXX
|
||||
samu install
|
||||
|
||||
stage2/bin/zig build \
|
||||
--prefix "$DISTDIR" \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
|
||||
@ -1,6 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
if [ -n "$DRONE_PULL_REQUEST" ]; then
|
||||
exit 0
|
||||
@ -12,16 +18,16 @@ pip3 install s3cmd
|
||||
|
||||
cd build
|
||||
|
||||
mv ../LICENSE "$DISTDIR/"
|
||||
mv ../zig-cache/langref.html "$DISTDIR/"
|
||||
mv "$DISTDIR/bin/zig" "$DISTDIR/"
|
||||
rmdir "$DISTDIR/bin"
|
||||
mv ../LICENSE "$INSTALL_PREFIX/"
|
||||
mv ../zig-cache/langref.html "$INSTALL_PREFIX/"
|
||||
mv "$INSTALL_PREFIX/bin/zig" "$INSTALL_PREFIX/"
|
||||
rmdir "$INSTALL_PREFIX/bin"
|
||||
|
||||
GITBRANCH="$DRONE_BRANCH"
|
||||
VERSION="$("$DISTDIR/zig" version)"
|
||||
DIRNAME="zig-linux-$TRIPLEARCH-$VERSION"
|
||||
VERSION="$("$INSTALL_PREFIX/zig" version)"
|
||||
DIRNAME="zig-linux-$ARCH-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv "$DISTDIR" "$DIRNAME"
|
||||
mv "$INSTALL_PREFIX" "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
@ -35,7 +41,7 @@ echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
|
||||
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
|
||||
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
||||
|
||||
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$TRIPLEARCH-linux-$VERSION.json"
|
||||
s3cmd put -P "$JSONFILE" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json"
|
||||
if [ "$GITBRANCH" = "master" ]; then
|
||||
# avoid leaking oauth token
|
||||
set +x
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-behavior -Dskip-non-native
|
||||
./build/zig build test-compiler-rt -Dskip-non-native
|
||||
./build/zig build test-fmt
|
||||
./build/zig build docs
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-behavior -Dskip-non-native
|
||||
$ZIG build test-compiler-rt -Dskip-non-native
|
||||
$ZIG build test-fmt
|
||||
$ZIG build docs
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build -Dskip-non-native # test building self-hosted without LLVM
|
||||
./build/zig build -Dskip-non-native test-cases
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build -Dskip-non-native # test building self-hosted without LLVM
|
||||
$ZIG build -Dskip-non-native test-cases
|
||||
|
||||
@ -1,11 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-universal-libc -Dskip-non-native
|
||||
./build/zig build test-compare-output -Dskip-non-native
|
||||
./build/zig build test-standalone -Dskip-non-native -Dskip-release-safe
|
||||
./build/zig build test-stack-traces -Dskip-non-native
|
||||
./build/zig build test-cli -Dskip-non-native
|
||||
./build/zig build test-asm-link -Dskip-non-native
|
||||
./build/zig build test-translate-c -Dskip-non-native
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-universal-libc -Dskip-non-native
|
||||
$ZIG build test-compare-output -Dskip-non-native
|
||||
$ZIG build test-standalone -Dskip-non-native -Dskip-release-safe
|
||||
$ZIG build test-stack-traces -Dskip-non-native
|
||||
$ZIG build test-cli -Dskip-non-native
|
||||
$ZIG build test-asm-link -Dskip-non-native
|
||||
$ZIG build test-translate-c -Dskip-non-native
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-std -Dskip-release-safe -Dskip-release-fast -Dskip-release-small -Dskip-non-native
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
./build/zig build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
$ZIG build test-std -Dskip-debug -Dskip-release-fast -Dskip-release-small -Dskip-non-native -Dskip-single-threaded
|
||||
|
||||
@ -1,11 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/drone/linux_script_base
|
||||
set -x
|
||||
set -e
|
||||
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/stage3-release"
|
||||
ZIG="$INSTALL_PREFIX/bin/zig"
|
||||
export ZIG_GLOBAL_CACHE_DIR="$DRONE_WORKSPACE/zig-cache"
|
||||
|
||||
# Empirically, this takes about 55 minutes on the CI, and is the bottleneck
|
||||
# causing timeouts. So this is disabled in favor of running a smaller set
|
||||
# of ReleaseSmall std lib tests.
|
||||
# ./build/zig build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native
|
||||
# $ZIG build test-std -Dskip-debug -Dskip-release-safe -Dskip-release-fast -Dskip-non-native
|
||||
|
||||
./build/zig test lib/std/std.zig -OReleaseSmall
|
||||
./build/zig test lib/std/std.zig -OReleaseSmall -lc
|
||||
$ZIG test lib/std/std.zig -OReleaseSmall
|
||||
$ZIG test lib/std/std.zig -OReleaseSmall -lc
|
||||
|
||||
@ -31,6 +31,8 @@ export TERM=dumb
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=$PREFIX \
|
||||
@ -38,40 +40,38 @@ cmake .. \
|
||||
-DZIG_TARGET_MCPU="$MCPU" \
|
||||
-DZIG_STATIC=ON \
|
||||
-GNinja
|
||||
samu install
|
||||
|
||||
# TODO: eliminate this workaround. Without this, zig does not end up passing
|
||||
# -isystem /usr/include when building libc++, resulting in #include <sys/endian.h>
|
||||
# "file not found" errors.
|
||||
stage2/bin/zig libc >libc.txt
|
||||
echo "include_dir=/usr/include" >>libc.txt
|
||||
echo "sys_include_dir=/usr/include" >>libc.txt
|
||||
echo "crt_dir=/usr/lib" >>libc.txt
|
||||
echo "msvc_lib_dir=" >>libc.txt
|
||||
echo "kernel32_lib_dir=" >>libc.txt
|
||||
echo "gcc_dir=" >>libc.txt
|
||||
ZIG_LIBC_TXT="$(pwd)/libc.txt"
|
||||
|
||||
ZIG_LIBC=libc.txt stage2/bin/zig build \
|
||||
--prefix stage3-release \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Denable-stage1
|
||||
ZIG_LIBC="$ZIG_LIBC_TXT" samu install
|
||||
|
||||
# Here we skip some tests to save time.
|
||||
stage3-release/bin/zig build test docs \
|
||||
stage3/bin/zig build test docs \
|
||||
-Dstatic-llvm \
|
||||
--search-prefix "$PREFIX" \
|
||||
-Dskip-stage1 \
|
||||
-Dskip-non-native
|
||||
|
||||
if [ -f ~/.s3cfg ]; then
|
||||
mv ../LICENSE stage3-release/
|
||||
mv ../zig-cache/langref.html stage3-release/
|
||||
mv stage3-release/bin/zig stage3-release/
|
||||
rmdir stage3-release/bin
|
||||
mv ../LICENSE stage3/
|
||||
mv ../zig-cache/langref.html stage3/
|
||||
mv stage3/bin/zig stage3/
|
||||
rmdir stage3/bin
|
||||
|
||||
GITBRANCH=$(basename $GITHUB_REF)
|
||||
VERSION=$(stage3-release/zig version)
|
||||
VERSION=$(stage3/zig version)
|
||||
DIRNAME="zig-freebsd-x86_64-$VERSION"
|
||||
TARBALL="$DIRNAME.tar.xz"
|
||||
mv stage3-release "$DIRNAME"
|
||||
mv stage3 "$DIRNAME"
|
||||
tar cfJ "$TARBALL" "$DIRNAME"
|
||||
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
20
ci/zinc/build_aarch64_macos
Executable file
20
ci/zinc/build_aarch64_macos
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
|
||||
TARGET="aarch64-macos-none"
|
||||
MCPU="apple_a14"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET"
|
||||
SEARCH_PREFIX="/deps/$TARGET"
|
||||
|
||||
"$RELEASE_STAGING/bin/zig" build \
|
||||
--prefix "$INSTALL_PREFIX" \
|
||||
--search-prefix "$SEARCH_PREFIX" \
|
||||
-Dstatic-llvm \
|
||||
-Drelease \
|
||||
-Dstrip \
|
||||
-Dtarget="$TARGET" \
|
||||
-Dmcpu="$MCPU" \
|
||||
-Denable-stage1
|
||||
10
ci/zinc/configure_git
Executable file
10
ci/zinc/configure_git
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake commands that follow.
|
||||
# This is in its own script because git does not support this command
|
||||
# being run concurrently with itself.
|
||||
git config core.abbrev 9
|
||||
@ -9,17 +9,33 @@ workspace:
|
||||
path: /workspace
|
||||
|
||||
steps:
|
||||
- name: test_stage3_debug
|
||||
image: ci/debian-amd64:11.1-8
|
||||
- name: configure_git
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/linux_test_stage3_debug.sh
|
||||
- ./ci/zinc/configure_git
|
||||
|
||||
- name: test_stage3_debug
|
||||
depends_on:
|
||||
- configure_git
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/linux_test_stage3_debug
|
||||
|
||||
- name: test_stage3_release
|
||||
image: ci/debian-amd64:11.1-8
|
||||
depends_on:
|
||||
- configure_git
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/linux_test_stage3_release.sh
|
||||
- ./ci/zinc/linux_test_stage3_release
|
||||
|
||||
- name: package
|
||||
- name: build_aarch64_macos
|
||||
depends_on:
|
||||
- test_stage3_release
|
||||
image: ci/debian-amd64:11.1-9
|
||||
commands:
|
||||
- ./ci/zinc/build_aarch64_macos
|
||||
|
||||
- name: linux_package
|
||||
depends_on:
|
||||
- test_stage3_debug
|
||||
- test_stage3_release
|
||||
@ -28,13 +44,40 @@ steps:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
image: ci/debian-amd64:11.1-8
|
||||
image: ci/debian-amd64:11.1-9
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: AWS_SECRET_ACCESS_KEY
|
||||
commands:
|
||||
- ./ci/zinc/linux_package
|
||||
|
||||
- name: macos_package
|
||||
depends_on:
|
||||
- test_stage3_debug
|
||||
- build_aarch64_macos
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
image: ci/debian-amd64:11.1-9
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: AWS_ACCESS_KEY_ID
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: AWS_SECRET_ACCESS_KEY
|
||||
commands:
|
||||
- ./ci/zinc/macos_package
|
||||
|
||||
- name: notify_lavahut
|
||||
depends_on:
|
||||
- macos_package
|
||||
- linux_package
|
||||
image: ci/debian-amd64:11.1-9
|
||||
environment:
|
||||
SRHT_OAUTH_TOKEN:
|
||||
from_secret: SRHT_OAUTH_TOKEN
|
||||
commands:
|
||||
- ./ci/zinc/linux_package.sh
|
||||
- ./ci/zinc/notify_lavahut
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
#!/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
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
|
||||
DEPS_LOCAL="/deps/local"
|
||||
WORKSPACE="$DRONE_WORKSPACE"
|
||||
|
||||
DEBUG_STAGING="$WORKSPACE/_debug/staging"
|
||||
RELEASE_STAGING="$WORKSPACE/_release/staging"
|
||||
|
||||
export PATH=$DEPS_LOCAL/bin:$PATH
|
||||
|
||||
# Make the `zig version` number consistent.
|
||||
# This will affect the cmake commands that follow.
|
||||
git config core.abbrev 9
|
||||
@ -1,22 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/zinc/linux_base.sh
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
OS="linux"
|
||||
RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
|
||||
VERSION=$($RELEASE_STAGING/bin/zig version)
|
||||
BASENAME="zig-$OS-$ARCH-$VERSION"
|
||||
TARBALL="$BASENAME.tar.xz"
|
||||
|
||||
# This runs concurrently with the macos_package script, so it should not make
|
||||
# any changes to the filesystem that will cause problems for the other script.
|
||||
|
||||
cp -r "$RELEASE_STAGING" "$BASENAME"
|
||||
|
||||
# Remove the unnecessary bin dir in $prefix/bin/zig
|
||||
mv $RELEASE_STAGING/bin/zig $RELEASE_STAGING/
|
||||
rmdir $RELEASE_STAGING/bin
|
||||
mv $BASENAME/bin/zig $BASENAME/
|
||||
rmdir $BASENAME/bin
|
||||
|
||||
# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
|
||||
mv $RELEASE_STAGING/lib/zig $RELEASE_STAGING/lib2
|
||||
rmdir $RELEASE_STAGING/lib
|
||||
mv $RELEASE_STAGING/lib2 $RELEASE_STAGING/lib
|
||||
mv $BASENAME/lib/zig $BASENAME/lib2
|
||||
rmdir $BASENAME/lib
|
||||
mv $BASENAME/lib2 $BASENAME/lib
|
||||
|
||||
VERSION=$($RELEASE_STAGING/zig version)
|
||||
BASENAME="zig-linux-$ARCH-$VERSION"
|
||||
TARBALL="$BASENAME.tar.xz"
|
||||
mv "$RELEASE_STAGING" "$BASENAME"
|
||||
tar cfJ "$TARBALL" "$BASENAME"
|
||||
ls -l "$TARBALL"
|
||||
|
||||
SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
|
||||
BYTESIZE=$(wc -c < $TARBALL)
|
||||
@ -31,15 +39,7 @@ echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
# Publish manifest.
|
||||
s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-linux-$VERSION.json"
|
||||
|
||||
# Avoid leaking oauth token.
|
||||
set +x
|
||||
|
||||
cd $WORKSPACE
|
||||
./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
|
||||
|
||||
set -x
|
||||
s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json"
|
||||
|
||||
# Explicit exit helps show last command duration.
|
||||
exit
|
||||
@ -1,11 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/zinc/linux_base.sh
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
DEPS_LOCAL="/deps/local"
|
||||
OLD_ZIG="$DEPS_LOCAL/bin/zig"
|
||||
TARGET="${ARCH}-linux-musl"
|
||||
MCPU="baseline"
|
||||
|
||||
export PATH=$DEPS_LOCAL/bin:$PATH
|
||||
|
||||
echo "building stage3-debug with zig version $($OLD_ZIG version)"
|
||||
|
||||
# Override the cache directories so that we don't clobber with the release
|
||||
@ -1,11 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
. ./ci/zinc/linux_base.sh
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="$(uname -m)"
|
||||
DEPS_LOCAL="/deps/local"
|
||||
RELEASE_STAGING="$DRONE_WORKSPACE/_release/staging"
|
||||
OLD_ZIG="$DEPS_LOCAL/bin/zig"
|
||||
TARGET="${ARCH}-linux-musl"
|
||||
MCPU="baseline"
|
||||
|
||||
export PATH=$DEPS_LOCAL/bin:$PATH
|
||||
|
||||
echo "building stage3-release with zig version $($OLD_ZIG version)"
|
||||
|
||||
export CC="$OLD_ZIG cc -target $TARGET -mcpu=$MCPU"
|
||||
@ -39,7 +45,6 @@ ninja install
|
||||
# Produce the experimental std lib documentation.
|
||||
mkdir -p "$RELEASE_STAGING/docs/std"
|
||||
"$RELEASE_STAGING/bin/zig" test ../lib/std/std.zig \
|
||||
--zig-lib-dir lib \
|
||||
-femit-docs=$RELEASE_STAGING/docs/std \
|
||||
-fno-emit-bin
|
||||
|
||||
49
ci/zinc/macos_package
Executable file
49
ci/zinc/macos_package
Executable file
@ -0,0 +1,49 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
set -e
|
||||
|
||||
ARCH="aarch64"
|
||||
OS=macos
|
||||
ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging"
|
||||
VERSION=$($ZIG_PREFIX/bin/zig version)
|
||||
TARGET="$ARCH-$OS-none"
|
||||
INSTALL_PREFIX="$DRONE_WORKSPACE/$TARGET"
|
||||
BASENAME="zig-$OS-$ARCH-$VERSION"
|
||||
TARBALL="$BASENAME.tar.xz"
|
||||
|
||||
# This runs concurrently with the linux_package script, so it should not make
|
||||
# any changes to the filesystem that will cause problems for the other script.
|
||||
|
||||
# Remove the unnecessary bin dir in $prefix/bin/zig
|
||||
mv $INSTALL_PREFIX/bin/zig $INSTALL_PREFIX/
|
||||
rmdir $INSTALL_PREFIX/bin
|
||||
|
||||
# Remove the unnecessary zig dir in $prefix/lib/zig/std/std.zig
|
||||
mv $INSTALL_PREFIX/lib/zig $INSTALL_PREFIX/lib2
|
||||
rmdir $INSTALL_PREFIX/lib
|
||||
mv $INSTALL_PREFIX/lib2 $INSTALL_PREFIX/lib
|
||||
|
||||
cp -r "$ZIG_PREFIX/docs" "$INSTALL_PREFIX/"
|
||||
cp "$ZIG_PREFIX/LICENSE" "$INSTALL_PREFIX/"
|
||||
|
||||
mv "$INSTALL_PREFIX" "$BASENAME"
|
||||
tar cfJ "$TARBALL" "$BASENAME"
|
||||
|
||||
SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
|
||||
BYTESIZE=$(wc -c < $TARBALL)
|
||||
|
||||
MANIFEST="manifest.json"
|
||||
touch $MANIFEST
|
||||
echo "{\"tarball\": \"$TARBALL\"," >>$MANIFEST
|
||||
echo "\"shasum\": \"$SHASUM\"," >>$MANIFEST
|
||||
echo "\"size\": \"$BYTESIZE\"}" >>$MANIFEST
|
||||
|
||||
# Publish artifact.
|
||||
s3cmd put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
||||
|
||||
# Publish manifest.
|
||||
s3cmd put -P --add-header="cache-control: max-age=0, must-revalidate" "$MANIFEST" "s3://ziglang.org/builds/$ARCH-$OS-$VERSION.json"
|
||||
|
||||
# Explicit exit helps show last command duration.
|
||||
exit
|
||||
9
ci/zinc/notify_lavahut
Executable file
9
ci/zinc/notify_lavahut
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set +x # Avoid leaking oauth token.
|
||||
set -e
|
||||
|
||||
ZIG_PREFIX="$DRONE_WORKSPACE/_release/staging"
|
||||
VERSION=$($ZIG_PREFIX/bin/zig version)
|
||||
cd $DRONE_WORKSPACE
|
||||
./ci/srht/on_master_success "$VERSION" "$SRHT_OAUTH_TOKEN"
|
||||
Loading…
x
Reference in New Issue
Block a user