authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-01 00:38:21-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-12-01 00:38:21-07:00
logfc3142aa9a54f014c07aac6ac2aab75f57c5a75f
tree6c6815cb514bb4045a7061b1224bb0f711d11908
parentc37afa2811677b7602cdde8120049358c0d8c467
parent8f079bad1f623b8da2bf327f7d8fd85cbecd1e39

Merge branch 'ci-add-debug-aarch64-linux'


15 files changed, 481 insertions(+), 403 deletions(-)

.github/workflows/ci.yaml+23-18
......@@ -15,41 +15,37 @@ jobs:
1515 - name: Checkout
1616 uses: actions/checkout@v3
1717 - name: Build and Test
18 run: sh ./ci/linux/build-x86_64-debug.sh
19 - name: Print Version
20 run: echo "$(build-debug/stage3-debug/bin/zig version)"
18 run: sh ci/x86_64-linux-debug.sh
2119 x86_64-linux-release:
2220 runs-on: [self-hosted, Linux, x86_64]
2321 steps:
2422 - name: Checkout
2523 uses: actions/checkout@v3
2624 - name: Build and Test
27 run: sh ./ci/linux/build-x86_64-release.sh
28 x86_64-macos:
29 runs-on: "macos-11"
30 env:
31 ARCH: "x86_64"
25 run: sh ci/x86_64-linux-release.sh
26 aarch64-linux-debug:
27 runs-on: [self-hosted, Linux, aarch64]
3228 steps:
3329 - name: Checkout
3430 uses: actions/checkout@v3
3531 - name: Build and Test
36 run: ./ci/macos/build-x86_64.sh
37 x86_64-windows:
38 runs-on: windows-latest
39 env:
40 ARCH: "x86_64"
32 run: sh ci/aarch64-linux-debug.sh
33 aarch64-linux-release:
34 runs-on: [self-hosted, Linux, aarch64]
4135 steps:
4236 - name: Checkout
4337 uses: actions/checkout@v3
4438 - name: Build and Test
45 run: ./ci/windows/build.ps1
46 aarch64-linux:
47 runs-on: [self-hosted, Linux, aarch64]
39 run: sh ci/aarch64-linux-release.sh
40 x86_64-macos:
41 runs-on: "macos-11"
42 env:
43 ARCH: "x86_64"
4844 steps:
4945 - name: Checkout
5046 uses: actions/checkout@v3
5147 - name: Build and Test
52 run: sh ./ci/linux/build-aarch64.sh
48 run: ci/x86_64-macos.sh
5349 aarch64-macos:
5450 runs-on: [self-hosted, macOS, aarch64]
5551 env:
......@@ -58,4 +54,13 @@ jobs:
5854 - name: Checkout
5955 uses: actions/checkout@v3
6056 - name: Build and Test
61 run: ./ci/macos/build-aarch64.sh
57 run: ci/aarch64-macos.sh
58 x86_64-windows:
59 runs-on: windows-latest
60 env:
61 ARCH: "x86_64"
62 steps:
63 - name: Checkout
64 uses: actions/checkout@v3
65 - name: Build and Test
66 run: ci/x86_64-windows.ps1
ci/aarch64-linux-debug.sh created+66
......@@ -0,0 +1,66 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true
21git fetch --tags
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26rm -rf build-debug
27mkdir build-debug
28cd build-debug
29cmake .. \
30 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
31 -DCMAKE_PREFIX_PATH="$PREFIX" \
32 -DCMAKE_BUILD_TYPE=Debug \
33 -DZIG_TARGET_TRIPLE="$TARGET" \
34 -DZIG_TARGET_MCPU="$MCPU" \
35 -DZIG_STATIC=ON \
36 -GNinja
37
38# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
39# so that installation and testing do not get affected by them.
40unset CC
41unset CXX
42
43ninja install
44
45echo "Looking for non-conforming code formatting..."
46stage3-debug/bin/zig fmt --check .. \
47 --exclude ../test/cases/ \
48 --exclude ../build-debug
49
50# simultaneously test building self-hosted without LLVM and with 32-bit arm
51stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf
52
53# TODO: add -fqemu back to this line
54
55stage3-debug/bin/zig build test docs \
56 -fwasmtime \
57 -Dstatic-llvm \
58 -Dtarget=native-native-musl \
59 --search-prefix "$PREFIX" \
60 --zig-lib-dir "$(pwd)/../lib"
61
62# Look for HTML errors.
63tidy --drop-empty-elements no -qe ../zig-cache/langref.html
64
65# Produce the experimental std lib documentation.
66stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/aarch64-linux-release.sh created+66
......@@ -0,0 +1,66 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true
21git fetch --tags
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26rm -rf build-release
27mkdir build-release
28cd build-release
29cmake .. \
30 -DCMAKE_INSTALL_PREFIX="stage3-release" \
31 -DCMAKE_PREFIX_PATH="$PREFIX" \
32 -DCMAKE_BUILD_TYPE=Release \
33 -DZIG_TARGET_TRIPLE="$TARGET" \
34 -DZIG_TARGET_MCPU="$MCPU" \
35 -DZIG_STATIC=ON \
36 -GNinja
37
38# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
39# so that installation and testing do not get affected by them.
40unset CC
41unset CXX
42
43ninja install
44
45echo "Looking for non-conforming code formatting..."
46stage3-release/bin/zig fmt --check .. \
47 --exclude ../test/cases/ \
48 --exclude ../build-release
49
50# simultaneously test building self-hosted without LLVM and with 32-bit arm
51stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf
52
53# TODO: add -fqemu back to this line
54
55stage3-release/bin/zig build test docs \
56 -fwasmtime \
57 -Dstatic-llvm \
58 -Dtarget=native-native-musl \
59 --search-prefix "$PREFIX" \
60 --zig-lib-dir "$(pwd)/../lib"
61
62# Look for HTML errors.
63tidy --drop-empty-elements no -qe ../zig-cache/langref.html
64
65# Produce the experimental std lib documentation.
66stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/aarch64-macos.sh created+47
......@@ -0,0 +1,47 @@
1#!/bin/sh
2
3set -x
4set -e
5
6# Script assumes the presence of the following:
7# s3cmd
8
9ZIGDIR="$(pwd)"
10TARGET="$ARCH-macos-none"
11MCPU="baseline"
12CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0"
13PREFIX="$HOME/$CACHE_BASENAME"
14ZIG="$PREFIX/bin/zig"
15
16cd $ZIGDIR
17
18# Make the `zig version` number consistent.
19# This will affect the cmake command below.
20git config core.abbrev 9
21git fetch --unshallow || true
22git fetch --tags
23
24mkdir build
25cd build
26PATH="$HOME/local/bin:$PATH" cmake .. \
27 -DCMAKE_INSTALL_PREFIX="stage3-release" \
28 -DCMAKE_PREFIX_PATH="$PREFIX" \
29 -DCMAKE_BUILD_TYPE=Release \
30 -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \
31 -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \
32 -DZIG_TARGET_TRIPLE="$TARGET" \
33 -DZIG_TARGET_MCPU="$MCPU" \
34 -DZIG_STATIC=ON \
35 -GNinja
36
37$HOME/local/bin/ninja install
38
39stage3-release/bin/zig build test docs \
40 --zig-lib-dir "$(pwd)/../lib" \
41 -Denable-macos-sdk \
42 -Dstatic-llvm \
43 -Dskip-non-native \
44 --search-prefix "$PREFIX"
45
46# Produce the experimental std lib documentation.
47stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/linux/build-aarch64.sh deleted-66
......@@ -1,66 +0,0 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true
21git fetch --tags
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26rm -rf build-release
27mkdir build-release
28cd build-release
29cmake .. \
30 -DCMAKE_INSTALL_PREFIX="stage3-release" \
31 -DCMAKE_PREFIX_PATH="$PREFIX" \
32 -DCMAKE_BUILD_TYPE=Release \
33 -DZIG_TARGET_TRIPLE="$TARGET" \
34 -DZIG_TARGET_MCPU="$MCPU" \
35 -DZIG_STATIC=ON \
36 -GNinja
37
38# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
39# so that installation and testing do not get affected by them.
40unset CC
41unset CXX
42
43ninja install
44
45echo "Looking for non-conforming code formatting..."
46stage3-release/bin/zig fmt --check .. \
47 --exclude ../test/cases/ \
48 --exclude ../build-release
49
50# simultaneously test building self-hosted without LLVM and with 32-bit arm
51stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf
52
53# TODO: add -fqemu back to this line
54
55stage3-release/bin/zig build test docs \
56 -fwasmtime \
57 -Dstatic-llvm \
58 -Dtarget=native-native-musl \
59 --search-prefix "$PREFIX" \
60 --zig-lib-dir "$(pwd)/../lib"
61
62# Look for HTML errors.
63tidy --drop-empty-elements no -qe ../zig-cache/langref.html
64
65# Produce the experimental std lib documentation.
66stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/linux/build-x86_64-debug.sh deleted-66
......@@ -1,66 +0,0 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true
21git fetch --tags
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26rm -rf build-debug
27mkdir build-debug
28cd build-debug
29cmake .. \
30 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
31 -DCMAKE_PREFIX_PATH="$PREFIX" \
32 -DCMAKE_BUILD_TYPE=Debug \
33 -DZIG_TARGET_TRIPLE="$TARGET" \
34 -DZIG_TARGET_MCPU="$MCPU" \
35 -DZIG_STATIC=ON \
36 -GNinja
37
38# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
39# so that installation and testing do not get affected by them.
40unset CC
41unset CXX
42
43ninja install
44
45echo "Looking for non-conforming code formatting..."
46stage3-debug/bin/zig fmt --check .. \
47 --exclude ../test/cases/ \
48 --exclude ../build-debug \
49 --exclude ../build-release
50
51# simultaneously test building self-hosted without LLVM and with 32-bit arm
52stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf
53
54stage3-debug/bin/zig build test docs \
55 -fqemu \
56 -fwasmtime \
57 -Dstatic-llvm \
58 -Dtarget=native-native-musl \
59 --search-prefix "$PREFIX" \
60 --zig-lib-dir "$(pwd)/../lib"
61
62# Look for HTML errors.
63tidy --drop-empty-elements no -qe ../zig-cache/langref.html
64
65# Produce the experimental std lib documentation.
66stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/linux/build-x86_64-release.sh deleted-82
......@@ -1,82 +0,0 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true
21git fetch --tags
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26rm -rf build-release
27mkdir build-release
28cd build-release
29cmake .. \
30 -DCMAKE_INSTALL_PREFIX="stage3-release" \
31 -DCMAKE_PREFIX_PATH="$PREFIX" \
32 -DCMAKE_BUILD_TYPE=Release \
33 -DZIG_TARGET_TRIPLE="$TARGET" \
34 -DZIG_TARGET_MCPU="$MCPU" \
35 -DZIG_STATIC=ON \
36 -GNinja
37
38# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
39# so that installation and testing do not get affected by them.
40unset CC
41unset CXX
42
43ninja install
44
45echo "Looking for non-conforming code formatting..."
46stage3-release/bin/zig fmt --check .. \
47 --exclude ../test/cases/ \
48 --exclude ../build-debug \
49 --exclude ../build-release
50
51# simultaneously test building self-hosted without LLVM and with 32-bit arm
52stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf
53
54stage3-release/bin/zig build test docs \
55 -fqemu \
56 -fwasmtime \
57 -Dstatic-llvm \
58 -Dtarget=native-native-musl \
59 --search-prefix "$PREFIX" \
60 --zig-lib-dir "$(pwd)/../lib"
61
62# Look for HTML errors.
63tidy --drop-empty-elements no -qe ../zig-cache/langref.html
64
65# Produce the experimental std lib documentation.
66stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
67
68stage3-release/bin/zig build \
69 --prefix stage4-release \
70 -Denable-llvm \
71 -Denable-stage1 \
72 -Dno-lib \
73 -Drelease \
74 -Dstrip \
75 -Dtarget=$TARGET \
76 -Duse-zig-libcxx \
77 -Dversion-string="$(stage3-release/bin/zig version)"
78
79# diff returns an error code if the files differ.
80echo "If the following command fails, it means nondeterminism has been"
81echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
82diff stage3-release/bin/zig stage4-release/bin/zig
ci/macos/build-aarch64.sh deleted-47
......@@ -1,47 +0,0 @@
1#!/bin/sh
2
3set -x
4set -e
5
6# Script assumes the presence of the following:
7# s3cmd
8
9ZIGDIR="$(pwd)"
10TARGET="$ARCH-macos-none"
11MCPU="baseline"
12CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0"
13PREFIX="$HOME/$CACHE_BASENAME"
14ZIG="$PREFIX/bin/zig"
15
16cd $ZIGDIR
17
18# Make the `zig version` number consistent.
19# This will affect the cmake command below.
20git config core.abbrev 9
21git fetch --unshallow || true
22git fetch --tags
23
24mkdir build
25cd build
26PATH="$HOME/local/bin:$PATH" cmake .. \
27 -DCMAKE_INSTALL_PREFIX="stage3-release" \
28 -DCMAKE_PREFIX_PATH="$PREFIX" \
29 -DCMAKE_BUILD_TYPE=Release \
30 -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \
31 -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \
32 -DZIG_TARGET_TRIPLE="$TARGET" \
33 -DZIG_TARGET_MCPU="$MCPU" \
34 -DZIG_STATIC=ON \
35 -GNinja
36
37$HOME/local/bin/ninja install
38
39stage3-release/bin/zig build test docs \
40 --zig-lib-dir "$(pwd)/../lib" \
41 -Denable-macos-sdk \
42 -Dstatic-llvm \
43 -Dskip-non-native \
44 --search-prefix "$PREFIX"
45
46# Produce the experimental std lib documentation.
47stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/macos/build-x86_64.sh deleted-54
......@@ -1,54 +0,0 @@
1#!/bin/sh
2
3set -x
4set -e
5
6# Script assumes the presence of the following:
7# s3cmd
8
9ZIGDIR="$(pwd)"
10TARGET="$ARCH-macos-none"
11MCPU="baseline"
12CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0"
13PREFIX="$HOME/$CACHE_BASENAME"
14JOBS="-j3"
15
16rm -rf $PREFIX
17cd $HOME
18
19curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
20tar xf "$CACHE_BASENAME.tar.xz"
21
22ZIG="$PREFIX/bin/zig"
23
24cd $ZIGDIR
25
26# Make the `zig version` number consistent.
27# This will affect the cmake command below.
28git config core.abbrev 9
29git fetch --unshallow || true
30git fetch --tags
31
32mkdir build
33cd build
34cmake .. \
35 -DCMAKE_INSTALL_PREFIX="stage3-release" \
36 -DCMAKE_PREFIX_PATH="$PREFIX" \
37 -DCMAKE_BUILD_TYPE=Release \
38 -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \
39 -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \
40 -DZIG_TARGET_TRIPLE="$TARGET" \
41 -DZIG_TARGET_MCPU="$MCPU" \
42 -DZIG_STATIC=ON
43
44make $JOBS install
45
46stage3-release/bin/zig build test docs \
47 --zig-lib-dir "$(pwd)/../lib" \
48 -Denable-macos-sdk \
49 -Dstatic-llvm \
50 -Dskip-non-native \
51 --search-prefix "$PREFIX"
52
53# Produce the experimental std lib documentation.
54stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/windows/build.ps1 deleted-63
......@@ -1,63 +0,0 @@
1$TARGET = "$($Env:ARCH)-windows-gnu"
2$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.25+499dddb4c"
3$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
4
5Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
6
7Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip"
8
9Write-Output "Extracting..."
10
11Add-Type -AssemblyName System.IO.Compression.FileSystem ;
12[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD")
13
14Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib"
15Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release"
16Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
17
18function CheckLastExitCode {
19 if (!$?) {
20 exit 1
21 }
22 return 0
23}
24
25# Make the `zig version` number consistent.
26# This will affect the `zig build` command below which uses `git describe`.
27git config core.abbrev 9
28git fetch --tags
29
30if ((git rev-parse --is-shallow-repository) -eq "true") {
31 git fetch --unshallow # `git describe` won't work on a shallow repo
32}
33
34Write-Output "Building Zig..."
35
36& "$ZIGPREFIXPATH\bin\zig.exe" build `
37 --prefix "$ZIGINSTALLDIR" `
38 --search-prefix "$ZIGPREFIXPATH" `
39 --zig-lib-dir "$ZIGLIBDIR" `
40 -Denable-stage1 `
41 -Dstatic-llvm `
42 -Drelease `
43 -Duse-zig-libcxx `
44 -Dtarget="$TARGET"
45CheckLastExitCode
46
47Write-Output " zig build test docs..."
48
49& "$ZIGINSTALLDIR\bin\zig.exe" build test docs `
50 --search-prefix "$ZIGPREFIXPATH" `
51 -Dstatic-llvm `
52 -Dskip-non-native `
53 -Denable-symlinks-windows
54CheckLastExitCode
55
56# Produce the experimental std lib documentation.
57Write-Output "zig test std/std.zig..."
58
59& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" `
60 --zig-lib-dir "$ZIGLIBDIR" `
61 -femit-docs `
62 -fno-emit-bin
63CheckLastExitCode
ci/x86_64-linux-debug.sh created+65
......@@ -0,0 +1,65 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true
21git fetch --tags
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26rm -rf build-debug
27mkdir build-debug
28cd build-debug
29cmake .. \
30 -DCMAKE_INSTALL_PREFIX="stage3-debug" \
31 -DCMAKE_PREFIX_PATH="$PREFIX" \
32 -DCMAKE_BUILD_TYPE=Debug \
33 -DZIG_TARGET_TRIPLE="$TARGET" \
34 -DZIG_TARGET_MCPU="$MCPU" \
35 -DZIG_STATIC=ON \
36 -GNinja
37
38# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
39# so that installation and testing do not get affected by them.
40unset CC
41unset CXX
42
43ninja install
44
45echo "Looking for non-conforming code formatting..."
46stage3-debug/bin/zig fmt --check .. \
47 --exclude ../test/cases/ \
48 --exclude ../build-debug
49
50# simultaneously test building self-hosted without LLVM and with 32-bit arm
51stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf
52
53stage3-debug/bin/zig build test docs \
54 -fqemu \
55 -fwasmtime \
56 -Dstatic-llvm \
57 -Dtarget=native-native-musl \
58 --search-prefix "$PREFIX" \
59 --zig-lib-dir "$(pwd)/../lib"
60
61# Look for HTML errors.
62tidy --drop-empty-elements no -qe ../zig-cache/langref.html
63
64# Produce the experimental std lib documentation.
65stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/x86_64-linux-release.sh created+82
......@@ -0,0 +1,82 @@
1#!/bin/sh
2
3# Requires cmake ninja-build
4
5set -x
6set -e
7
8ARCH="$(uname -m)"
9TARGET="$ARCH-linux-musl"
10MCPU="baseline"
11CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1"
12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"
14
15export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH"
16
17# Make the `zig version` number consistent.
18# This will affect the cmake command below.
19git config core.abbrev 9
20git fetch --unshallow || true
21git fetch --tags
22
23export CC="$ZIG cc -target $TARGET -mcpu=$MCPU"
24export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU"
25
26rm -rf build-release
27mkdir build-release
28cd build-release
29cmake .. \
30 -DCMAKE_INSTALL_PREFIX="stage3-release" \
31 -DCMAKE_PREFIX_PATH="$PREFIX" \
32 -DCMAKE_BUILD_TYPE=Release \
33 -DZIG_TARGET_TRIPLE="$TARGET" \
34 -DZIG_TARGET_MCPU="$MCPU" \
35 -DZIG_STATIC=ON \
36 -GNinja
37
38# Now cmake will use zig as the C/C++ compiler. We reset the environment variables
39# so that installation and testing do not get affected by them.
40unset CC
41unset CXX
42
43ninja install
44
45echo "Looking for non-conforming code formatting..."
46stage3-release/bin/zig fmt --check .. \
47 --exclude ../test/cases/ \
48 --exclude ../build-debug \
49 --exclude ../build-release
50
51# simultaneously test building self-hosted without LLVM and with 32-bit arm
52stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf
53
54stage3-release/bin/zig build test docs \
55 -fqemu \
56 -fwasmtime \
57 -Dstatic-llvm \
58 -Dtarget=native-native-musl \
59 --search-prefix "$PREFIX" \
60 --zig-lib-dir "$(pwd)/../lib"
61
62# Look for HTML errors.
63tidy --drop-empty-elements no -qe ../zig-cache/langref.html
64
65# Produce the experimental std lib documentation.
66stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
67
68stage3-release/bin/zig build \
69 --prefix stage4-release \
70 -Denable-llvm \
71 -Denable-stage1 \
72 -Dno-lib \
73 -Drelease \
74 -Dstrip \
75 -Dtarget=$TARGET \
76 -Duse-zig-libcxx \
77 -Dversion-string="$(stage3-release/bin/zig version)"
78
79# diff returns an error code if the files differ.
80echo "If the following command fails, it means nondeterminism has been"
81echo "introduced, making stage3 and stage4 no longer byte-for-byte identical."
82diff stage3-release/bin/zig stage4-release/bin/zig
ci/x86_64-macos.sh created+54
......@@ -0,0 +1,54 @@
1#!/bin/sh
2
3set -x
4set -e
5
6# Script assumes the presence of the following:
7# s3cmd
8
9ZIGDIR="$(pwd)"
10TARGET="$ARCH-macos-none"
11MCPU="baseline"
12CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0"
13PREFIX="$HOME/$CACHE_BASENAME"
14JOBS="-j3"
15
16rm -rf $PREFIX
17cd $HOME
18
19curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz"
20tar xf "$CACHE_BASENAME.tar.xz"
21
22ZIG="$PREFIX/bin/zig"
23
24cd $ZIGDIR
25
26# Make the `zig version` number consistent.
27# This will affect the cmake command below.
28git config core.abbrev 9
29git fetch --unshallow || true
30git fetch --tags
31
32mkdir build
33cd build
34cmake .. \
35 -DCMAKE_INSTALL_PREFIX="stage3-release" \
36 -DCMAKE_PREFIX_PATH="$PREFIX" \
37 -DCMAKE_BUILD_TYPE=Release \
38 -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \
39 -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \
40 -DZIG_TARGET_TRIPLE="$TARGET" \
41 -DZIG_TARGET_MCPU="$MCPU" \
42 -DZIG_STATIC=ON
43
44make $JOBS install
45
46stage3-release/bin/zig build test docs \
47 --zig-lib-dir "$(pwd)/../lib" \
48 -Denable-macos-sdk \
49 -Dstatic-llvm \
50 -Dskip-non-native \
51 --search-prefix "$PREFIX"
52
53# Produce the experimental std lib documentation.
54stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/x86_64-windows.ps1 created+63
......@@ -0,0 +1,63 @@
1$TARGET = "$($Env:ARCH)-windows-gnu"
2$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.25+499dddb4c"
3$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
4
5Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL"
6
7Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip"
8
9Write-Output "Extracting..."
10
11Add-Type -AssemblyName System.IO.Compression.FileSystem ;
12[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD")
13
14Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib"
15Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release"
16Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
17
18function CheckLastExitCode {
19 if (!$?) {
20 exit 1
21 }
22 return 0
23}
24
25# Make the `zig version` number consistent.
26# This will affect the `zig build` command below which uses `git describe`.
27git config core.abbrev 9
28git fetch --tags
29
30if ((git rev-parse --is-shallow-repository) -eq "true") {
31 git fetch --unshallow # `git describe` won't work on a shallow repo
32}
33
34Write-Output "Building Zig..."
35
36& "$ZIGPREFIXPATH\bin\zig.exe" build `
37 --prefix "$ZIGINSTALLDIR" `
38 --search-prefix "$ZIGPREFIXPATH" `
39 --zig-lib-dir "$ZIGLIBDIR" `
40 -Denable-stage1 `
41 -Dstatic-llvm `
42 -Drelease `
43 -Duse-zig-libcxx `
44 -Dtarget="$TARGET"
45CheckLastExitCode
46
47Write-Output " zig build test docs..."
48
49& "$ZIGINSTALLDIR\bin\zig.exe" build test docs `
50 --search-prefix "$ZIGPREFIXPATH" `
51 -Dstatic-llvm `
52 -Dskip-non-native `
53 -Denable-symlinks-windows
54CheckLastExitCode
55
56# Produce the experimental std lib documentation.
57Write-Output "zig test std/std.zig..."
58
59& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" `
60 --zig-lib-dir "$ZIGLIBDIR" `
61 -femit-docs `
62 -fno-emit-bin
63CheckLastExitCode
doc/langref.html.in+15-7
......@@ -7029,8 +7029,7 @@ test "fibonacci" {
70297029 undefined behavior, which is always a compile error if the compiler knows it happened.
70307030 But what would have happened if we used a signed integer?
70317031 </p>
7032 {#code_begin|test_err|evaluation exceeded 1000 backwards branches#}
7033 {#backend_stage1#}
7032 {#code_begin|syntax#}
70347033const assert = @import("std").debug.assert;
70357034
70367035fn fibonacci(index: i32) i32 {
......@@ -7045,13 +7044,22 @@ test "fibonacci" {
70457044}
70467045 {#code_end#}
70477046 <p>
7048 The compiler noticed that evaluating this function at compile-time took a long time,
7049 and thus emitted a compile error and gave up. If the programmer wants to increase
7050 the budget for compile-time computation, they can use a built-in function called
7051 {#link|@setEvalBranchQuota#} to change the default number 1000 to something else.
7047 The compiler is supposed to notice that evaluating this function at
7048 compile-time took more than 1000 branches, and thus emits an error and
7049 gives up. If the programmer wants to increase the budget for compile-time
7050 computation, they can use a built-in function called
7051 {#link|@setEvalBranchQuota#} to change the default number 1000 to
7052 something else.
7053 </p>
7054 <p>
7055 However, there is a <a href="https://github.com/ziglang/zig/issues/13724">design
7056 flaw in the compiler</a> causing it to stack overflow instead of having the proper
7057 behavior here. I'm terribly sorry about that. I hope to get this resolved
7058 before the next release.
70527059 </p>
70537060 <p>
7054 What if we fix the base case, but put the wrong value in the {#syntax#}expect{#endsyntax#} line?
7061 What if we fix the base case, but put the wrong value in the
7062 {#syntax#}expect{#endsyntax#} line?
70557063 </p>
70567064 {#code_begin|test_err|reached unreachable#}
70577065const assert = @import("std").debug.assert;