diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7a278e070e82ecff35cd505b46bf326eb2be2556..52b047dc36bab5dff310d07f12dd2098cd870c95 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,16 +15,28 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build and Test - run: sh ./ci/linux/build-x86_64-debug.sh - - name: Print Version - run: echo "$(build-debug/stage3-debug/bin/zig version)" + run: sh ci/x86_64-linux-debug.sh x86_64-linux-release: runs-on: [self-hosted, Linux, x86_64] steps: - name: Checkout uses: actions/checkout@v3 - name: Build and Test - run: sh ./ci/linux/build-x86_64-release.sh + run: sh ci/x86_64-linux-release.sh + aarch64-linux-debug: + runs-on: [self-hosted, Linux, aarch64] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build and Test + run: sh ci/aarch64-linux-debug.sh + aarch64-linux-release: + runs-on: [self-hosted, Linux, aarch64] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build and Test + run: sh ci/aarch64-linux-release.sh x86_64-macos: runs-on: "macos-11" env: @@ -33,23 +45,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build and Test - run: ./ci/macos/build-x86_64.sh - x86_64-windows: - runs-on: windows-latest - env: - ARCH: "x86_64" - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build and Test - run: ./ci/windows/build.ps1 - aarch64-linux: - runs-on: [self-hosted, Linux, aarch64] - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Build and Test - run: sh ./ci/linux/build-aarch64.sh + run: ci/x86_64-macos.sh aarch64-macos: runs-on: [self-hosted, macOS, aarch64] env: @@ -58,4 +54,13 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Build and Test - run: ./ci/macos/build-aarch64.sh + run: ci/aarch64-macos.sh + x86_64-windows: + runs-on: windows-latest + env: + ARCH: "x86_64" + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build and Test + run: ci/x86_64-windows.ps1 diff --git a/ci/aarch64-linux-debug.sh b/ci/aarch64-linux-debug.sh new file mode 100644 index 0000000000000000000000000000000000000000..13bcef5aa9daff7aa4658b5343759ddaeb91b040 --- /dev/null +++ b/ci/aarch64-linux-debug.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +# Requires cmake ninja-build + +set -x +set -e + +ARCH="$(uname -m)" +TARGET="$ARCH-linux-musl" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" +PREFIX="$HOME/deps/$CACHE_BASENAME" +ZIG="$PREFIX/bin/zig" + +export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH" + +# 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 + +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +rm -rf build-debug +mkdir build-debug +cd build-debug +cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-debug" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +# Now cmake will use zig as the C/C++ compiler. We reset the environment variables +# so that installation and testing do not get affected by them. +unset CC +unset CXX + +ninja install + +echo "Looking for non-conforming code formatting..." +stage3-debug/bin/zig fmt --check .. \ + --exclude ../test/cases/ \ + --exclude ../build-debug + +# simultaneously test building self-hosted without LLVM and with 32-bit arm +stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf + +# TODO: add -fqemu back to this line + +stage3-debug/bin/zig build test docs \ + -fwasmtime \ + -Dstatic-llvm \ + -Dtarget=native-native-musl \ + --search-prefix "$PREFIX" \ + --zig-lib-dir "$(pwd)/../lib" + +# Look for HTML errors. +tidy --drop-empty-elements no -qe ../zig-cache/langref.html + +# Produce the experimental std lib documentation. +stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/aarch64-linux-release.sh b/ci/aarch64-linux-release.sh new file mode 100644 index 0000000000000000000000000000000000000000..2f57e06f05a2435bb9e45fb8d4e567d8d719460b --- /dev/null +++ b/ci/aarch64-linux-release.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +# Requires cmake ninja-build + +set -x +set -e + +ARCH="$(uname -m)" +TARGET="$ARCH-linux-musl" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" +PREFIX="$HOME/deps/$CACHE_BASENAME" +ZIG="$PREFIX/bin/zig" + +export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH" + +# 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 + +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +rm -rf build-release +mkdir build-release +cd build-release +cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-release" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +# Now cmake will use zig as the C/C++ compiler. We reset the environment variables +# so that installation and testing do not get affected by them. +unset CC +unset CXX + +ninja install + +echo "Looking for non-conforming code formatting..." +stage3-release/bin/zig fmt --check .. \ + --exclude ../test/cases/ \ + --exclude ../build-release + +# simultaneously test building self-hosted without LLVM and with 32-bit arm +stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf + +# TODO: add -fqemu back to this line + +stage3-release/bin/zig build test docs \ + -fwasmtime \ + -Dstatic-llvm \ + -Dtarget=native-native-musl \ + --search-prefix "$PREFIX" \ + --zig-lib-dir "$(pwd)/../lib" + +# Look for HTML errors. +tidy --drop-empty-elements no -qe ../zig-cache/langref.html + +# Produce the experimental std lib documentation. +stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/aarch64-macos.sh b/ci/aarch64-macos.sh new file mode 100755 index 0000000000000000000000000000000000000000..52f3aad6966e303931c5310d19e9ac7e387d9797 --- /dev/null +++ b/ci/aarch64-macos.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +set -x +set -e + +# Script assumes the presence of the following: +# s3cmd + +ZIGDIR="$(pwd)" +TARGET="$ARCH-macos-none" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" +PREFIX="$HOME/$CACHE_BASENAME" +ZIG="$PREFIX/bin/zig" + +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 + +mkdir build +cd build +PATH="$HOME/local/bin:$PATH" cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-release" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ + -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +$HOME/local/bin/ninja install + +stage3-release/bin/zig build test docs \ + --zig-lib-dir "$(pwd)/../lib" \ + -Denable-macos-sdk \ + -Dstatic-llvm \ + -Dskip-non-native \ + --search-prefix "$PREFIX" + +# Produce the experimental std lib documentation. +stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/linux/build-aarch64.sh b/ci/linux/build-aarch64.sh deleted file mode 100644 index 2f57e06f05a2435bb9e45fb8d4e567d8d719460b..0000000000000000000000000000000000000000 --- a/ci/linux/build-aarch64.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# Requires cmake ninja-build - -set -x -set -e - -ARCH="$(uname -m)" -TARGET="$ARCH-linux-musl" -MCPU="baseline" -CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" -PREFIX="$HOME/deps/$CACHE_BASENAME" -ZIG="$PREFIX/bin/zig" - -export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH" - -# 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 - -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" - -rm -rf build-release -mkdir build-release -cd build-release -cmake .. \ - -DCMAKE_INSTALL_PREFIX="stage3-release" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Release \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -GNinja - -# Now cmake will use zig as the C/C++ compiler. We reset the environment variables -# so that installation and testing do not get affected by them. -unset CC -unset CXX - -ninja install - -echo "Looking for non-conforming code formatting..." -stage3-release/bin/zig fmt --check .. \ - --exclude ../test/cases/ \ - --exclude ../build-release - -# simultaneously test building self-hosted without LLVM and with 32-bit arm -stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf - -# TODO: add -fqemu back to this line - -stage3-release/bin/zig build test docs \ - -fwasmtime \ - -Dstatic-llvm \ - -Dtarget=native-native-musl \ - --search-prefix "$PREFIX" \ - --zig-lib-dir "$(pwd)/../lib" - -# Look for HTML errors. -tidy --drop-empty-elements no -qe ../zig-cache/langref.html - -# Produce the experimental std lib documentation. -stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/linux/build-x86_64-debug.sh b/ci/linux/build-x86_64-debug.sh deleted file mode 100755 index 053b9ab831008c9771775f58ee44599280f9af35..0000000000000000000000000000000000000000 --- a/ci/linux/build-x86_64-debug.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# Requires cmake ninja-build - -set -x -set -e - -ARCH="$(uname -m)" -TARGET="$ARCH-linux-musl" -MCPU="baseline" -CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" -PREFIX="$HOME/deps/$CACHE_BASENAME" -ZIG="$PREFIX/bin/zig" - -export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" - -# 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 - -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" - -rm -rf build-debug -mkdir build-debug -cd build-debug -cmake .. \ - -DCMAKE_INSTALL_PREFIX="stage3-debug" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Debug \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -GNinja - -# Now cmake will use zig as the C/C++ compiler. We reset the environment variables -# so that installation and testing do not get affected by them. -unset CC -unset CXX - -ninja install - -echo "Looking for non-conforming code formatting..." -stage3-debug/bin/zig fmt --check .. \ - --exclude ../test/cases/ \ - --exclude ../build-debug \ - --exclude ../build-release - -# simultaneously test building self-hosted without LLVM and with 32-bit arm -stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf - -stage3-debug/bin/zig build test docs \ - -fqemu \ - -fwasmtime \ - -Dstatic-llvm \ - -Dtarget=native-native-musl \ - --search-prefix "$PREFIX" \ - --zig-lib-dir "$(pwd)/../lib" - -# Look for HTML errors. -tidy --drop-empty-elements no -qe ../zig-cache/langref.html - -# Produce the experimental std lib documentation. -stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/linux/build-x86_64-release.sh b/ci/linux/build-x86_64-release.sh deleted file mode 100755 index fbcf86e4182461a7ca6acbe4af83b9d8130c5d18..0000000000000000000000000000000000000000 --- a/ci/linux/build-x86_64-release.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh - -# Requires cmake ninja-build - -set -x -set -e - -ARCH="$(uname -m)" -TARGET="$ARCH-linux-musl" -MCPU="baseline" -CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" -PREFIX="$HOME/deps/$CACHE_BASENAME" -ZIG="$PREFIX/bin/zig" - -export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" - -# 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 - -export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" -export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" - -rm -rf build-release -mkdir build-release -cd build-release -cmake .. \ - -DCMAKE_INSTALL_PREFIX="stage3-release" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Release \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -GNinja - -# Now cmake will use zig as the C/C++ compiler. We reset the environment variables -# so that installation and testing do not get affected by them. -unset CC -unset CXX - -ninja install - -echo "Looking for non-conforming code formatting..." -stage3-release/bin/zig fmt --check .. \ - --exclude ../test/cases/ \ - --exclude ../build-debug \ - --exclude ../build-release - -# simultaneously test building self-hosted without LLVM and with 32-bit arm -stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf - -stage3-release/bin/zig build test docs \ - -fqemu \ - -fwasmtime \ - -Dstatic-llvm \ - -Dtarget=native-native-musl \ - --search-prefix "$PREFIX" \ - --zig-lib-dir "$(pwd)/../lib" - -# Look for HTML errors. -tidy --drop-empty-elements no -qe ../zig-cache/langref.html - -# Produce the experimental std lib documentation. -stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib - -stage3-release/bin/zig build \ - --prefix stage4-release \ - -Denable-llvm \ - -Denable-stage1 \ - -Dno-lib \ - -Drelease \ - -Dstrip \ - -Dtarget=$TARGET \ - -Duse-zig-libcxx \ - -Dversion-string="$(stage3-release/bin/zig version)" - -# diff returns an error code if the files differ. -echo "If the following command fails, it means nondeterminism has been" -echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." -diff stage3-release/bin/zig stage4-release/bin/zig diff --git a/ci/macos/build-aarch64.sh b/ci/macos/build-aarch64.sh deleted file mode 100755 index 52f3aad6966e303931c5310d19e9ac7e387d9797..0000000000000000000000000000000000000000 --- a/ci/macos/build-aarch64.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -set -x -set -e - -# Script assumes the presence of the following: -# s3cmd - -ZIGDIR="$(pwd)" -TARGET="$ARCH-macos-none" -MCPU="baseline" -CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" -PREFIX="$HOME/$CACHE_BASENAME" -ZIG="$PREFIX/bin/zig" - -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 - -mkdir build -cd build -PATH="$HOME/local/bin:$PATH" cmake .. \ - -DCMAKE_INSTALL_PREFIX="stage3-release" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ - -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON \ - -GNinja - -$HOME/local/bin/ninja install - -stage3-release/bin/zig build test docs \ - --zig-lib-dir "$(pwd)/../lib" \ - -Denable-macos-sdk \ - -Dstatic-llvm \ - -Dskip-non-native \ - --search-prefix "$PREFIX" - -# Produce the experimental std lib documentation. -stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/macos/build-x86_64.sh b/ci/macos/build-x86_64.sh deleted file mode 100755 index 1a30b10d3a471d8b03114d96f81136664d515e97..0000000000000000000000000000000000000000 --- a/ci/macos/build-x86_64.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -set -x -set -e - -# Script assumes the presence of the following: -# s3cmd - -ZIGDIR="$(pwd)" -TARGET="$ARCH-macos-none" -MCPU="baseline" -CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" -PREFIX="$HOME/$CACHE_BASENAME" -JOBS="-j3" - -rm -rf $PREFIX -cd $HOME - -curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" -tar xf "$CACHE_BASENAME.tar.xz" - -ZIG="$PREFIX/bin/zig" - -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 - -mkdir build -cd build -cmake .. \ - -DCMAKE_INSTALL_PREFIX="stage3-release" \ - -DCMAKE_PREFIX_PATH="$PREFIX" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ - -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ - -DZIG_TARGET_TRIPLE="$TARGET" \ - -DZIG_TARGET_MCPU="$MCPU" \ - -DZIG_STATIC=ON - -make $JOBS install - -stage3-release/bin/zig build test docs \ - --zig-lib-dir "$(pwd)/../lib" \ - -Denable-macos-sdk \ - -Dstatic-llvm \ - -Dskip-non-native \ - --search-prefix "$PREFIX" - -# Produce the experimental std lib documentation. -stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/windows/build.ps1 b/ci/windows/build.ps1 deleted file mode 100644 index 2e4940275067e60aa488fbef5a1f559c74720179..0000000000000000000000000000000000000000 --- a/ci/windows/build.ps1 +++ /dev/null @@ -1,63 +0,0 @@ -$TARGET = "$($Env:ARCH)-windows-gnu" -$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.25+499dddb4c" -$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" - -Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" - -Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" - -Write-Output "Extracting..." - -Add-Type -AssemblyName System.IO.Compression.FileSystem ; -[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") - -Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib" -Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release" -Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" - -function CheckLastExitCode { - if (!$?) { - exit 1 - } - return 0 -} - -# Make the `zig version` number consistent. -# This will affect the `zig build` command below which uses `git describe`. -git config core.abbrev 9 -git fetch --tags - -if ((git rev-parse --is-shallow-repository) -eq "true") { - git fetch --unshallow # `git describe` won't work on a shallow repo -} - -Write-Output "Building Zig..." - -& "$ZIGPREFIXPATH\bin\zig.exe" build ` - --prefix "$ZIGINSTALLDIR" ` - --search-prefix "$ZIGPREFIXPATH" ` - --zig-lib-dir "$ZIGLIBDIR" ` - -Denable-stage1 ` - -Dstatic-llvm ` - -Drelease ` - -Duse-zig-libcxx ` - -Dtarget="$TARGET" -CheckLastExitCode - -Write-Output " zig build test docs..." - -& "$ZIGINSTALLDIR\bin\zig.exe" build test docs ` - --search-prefix "$ZIGPREFIXPATH" ` - -Dstatic-llvm ` - -Dskip-non-native ` - -Denable-symlinks-windows -CheckLastExitCode - -# Produce the experimental std lib documentation. -Write-Output "zig test std/std.zig..." - -& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" ` - --zig-lib-dir "$ZIGLIBDIR" ` - -femit-docs ` - -fno-emit-bin -CheckLastExitCode diff --git a/ci/x86_64-linux-debug.sh b/ci/x86_64-linux-debug.sh new file mode 100755 index 0000000000000000000000000000000000000000..a5182973a64d3a9d92973dcbc0458c11e4a57ea8 --- /dev/null +++ b/ci/x86_64-linux-debug.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +# Requires cmake ninja-build + +set -x +set -e + +ARCH="$(uname -m)" +TARGET="$ARCH-linux-musl" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" +PREFIX="$HOME/deps/$CACHE_BASENAME" +ZIG="$PREFIX/bin/zig" + +export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" + +# 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 + +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +rm -rf build-debug +mkdir build-debug +cd build-debug +cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-debug" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +# Now cmake will use zig as the C/C++ compiler. We reset the environment variables +# so that installation and testing do not get affected by them. +unset CC +unset CXX + +ninja install + +echo "Looking for non-conforming code formatting..." +stage3-debug/bin/zig fmt --check .. \ + --exclude ../test/cases/ \ + --exclude ../build-debug + +# simultaneously test building self-hosted without LLVM and with 32-bit arm +stage3-debug/bin/zig build -Dtarget=arm-linux-musleabihf + +stage3-debug/bin/zig build test docs \ + -fqemu \ + -fwasmtime \ + -Dstatic-llvm \ + -Dtarget=native-native-musl \ + --search-prefix "$PREFIX" \ + --zig-lib-dir "$(pwd)/../lib" + +# Look for HTML errors. +tidy --drop-empty-elements no -qe ../zig-cache/langref.html + +# Produce the experimental std lib documentation. +stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/x86_64-linux-release.sh b/ci/x86_64-linux-release.sh new file mode 100755 index 0000000000000000000000000000000000000000..fbcf86e4182461a7ca6acbe4af83b9d8130c5d18 --- /dev/null +++ b/ci/x86_64-linux-release.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +# Requires cmake ninja-build + +set -x +set -e + +ARCH="$(uname -m)" +TARGET="$ARCH-linux-musl" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.256+271cc52a1" +PREFIX="$HOME/deps/$CACHE_BASENAME" +ZIG="$PREFIX/bin/zig" + +export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-6.1.0.1/bin:$PATH" + +# 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 + +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + +rm -rf build-release +mkdir build-release +cd build-release +cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-release" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON \ + -GNinja + +# Now cmake will use zig as the C/C++ compiler. We reset the environment variables +# so that installation and testing do not get affected by them. +unset CC +unset CXX + +ninja install + +echo "Looking for non-conforming code formatting..." +stage3-release/bin/zig fmt --check .. \ + --exclude ../test/cases/ \ + --exclude ../build-debug \ + --exclude ../build-release + +# simultaneously test building self-hosted without LLVM and with 32-bit arm +stage3-release/bin/zig build -Dtarget=arm-linux-musleabihf + +stage3-release/bin/zig build test docs \ + -fqemu \ + -fwasmtime \ + -Dstatic-llvm \ + -Dtarget=native-native-musl \ + --search-prefix "$PREFIX" \ + --zig-lib-dir "$(pwd)/../lib" + +# Look for HTML errors. +tidy --drop-empty-elements no -qe ../zig-cache/langref.html + +# Produce the experimental std lib documentation. +stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib + +stage3-release/bin/zig build \ + --prefix stage4-release \ + -Denable-llvm \ + -Denable-stage1 \ + -Dno-lib \ + -Drelease \ + -Dstrip \ + -Dtarget=$TARGET \ + -Duse-zig-libcxx \ + -Dversion-string="$(stage3-release/bin/zig version)" + +# diff returns an error code if the files differ. +echo "If the following command fails, it means nondeterminism has been" +echo "introduced, making stage3 and stage4 no longer byte-for-byte identical." +diff stage3-release/bin/zig stage4-release/bin/zig diff --git a/ci/x86_64-macos.sh b/ci/x86_64-macos.sh new file mode 100755 index 0000000000000000000000000000000000000000..1a30b10d3a471d8b03114d96f81136664d515e97 --- /dev/null +++ b/ci/x86_64-macos.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +set -x +set -e + +# Script assumes the presence of the following: +# s3cmd + +ZIGDIR="$(pwd)" +TARGET="$ARCH-macos-none" +MCPU="baseline" +CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.10.0-dev.4560+828735ac0" +PREFIX="$HOME/$CACHE_BASENAME" +JOBS="-j3" + +rm -rf $PREFIX +cd $HOME + +curl -L -O "https://ziglang.org/deps/$CACHE_BASENAME.tar.xz" +tar xf "$CACHE_BASENAME.tar.xz" + +ZIG="$PREFIX/bin/zig" + +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 + +mkdir build +cd build +cmake .. \ + -DCMAKE_INSTALL_PREFIX="stage3-release" \ + -DCMAKE_PREFIX_PATH="$PREFIX" \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_C_COMPILER="$ZIG;cc;-target;$TARGET;-mcpu=$MCPU" \ + -DCMAKE_CXX_COMPILER="$ZIG;c++;-target;$TARGET;-mcpu=$MCPU" \ + -DZIG_TARGET_TRIPLE="$TARGET" \ + -DZIG_TARGET_MCPU="$MCPU" \ + -DZIG_STATIC=ON + +make $JOBS install + +stage3-release/bin/zig build test docs \ + --zig-lib-dir "$(pwd)/../lib" \ + -Denable-macos-sdk \ + -Dstatic-llvm \ + -Dskip-non-native \ + --search-prefix "$PREFIX" + +# Produce the experimental std lib documentation. +stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib diff --git a/ci/x86_64-windows.ps1 b/ci/x86_64-windows.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..2e4940275067e60aa488fbef5a1f559c74720179 --- /dev/null +++ b/ci/x86_64-windows.ps1 @@ -0,0 +1,63 @@ +$TARGET = "$($Env:ARCH)-windows-gnu" +$ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.25+499dddb4c" +$ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip" + +Write-Output "Downloading $ZIG_LLVM_CLANG_LLD_URL" + +Invoke-WebRequest -Uri "$ZIG_LLVM_CLANG_LLD_URL" -OutFile "$ZIG_LLVM_CLANG_LLD_NAME.zip" + +Write-Output "Extracting..." + +Add-Type -AssemblyName System.IO.Compression.FileSystem ; +[System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/$ZIG_LLVM_CLANG_LLD_NAME.zip", "$PWD") + +Set-Variable -Name ZIGLIBDIR -Value "$(Get-Location)\lib" +Set-Variable -Name ZIGINSTALLDIR -Value "$(Get-Location)\stage3-release" +Set-Variable -Name ZIGPREFIXPATH -Value "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME" + +function CheckLastExitCode { + if (!$?) { + exit 1 + } + return 0 +} + +# Make the `zig version` number consistent. +# This will affect the `zig build` command below which uses `git describe`. +git config core.abbrev 9 +git fetch --tags + +if ((git rev-parse --is-shallow-repository) -eq "true") { + git fetch --unshallow # `git describe` won't work on a shallow repo +} + +Write-Output "Building Zig..." + +& "$ZIGPREFIXPATH\bin\zig.exe" build ` + --prefix "$ZIGINSTALLDIR" ` + --search-prefix "$ZIGPREFIXPATH" ` + --zig-lib-dir "$ZIGLIBDIR" ` + -Denable-stage1 ` + -Dstatic-llvm ` + -Drelease ` + -Duse-zig-libcxx ` + -Dtarget="$TARGET" +CheckLastExitCode + +Write-Output " zig build test docs..." + +& "$ZIGINSTALLDIR\bin\zig.exe" build test docs ` + --search-prefix "$ZIGPREFIXPATH" ` + -Dstatic-llvm ` + -Dskip-non-native ` + -Denable-symlinks-windows +CheckLastExitCode + +# Produce the experimental std lib documentation. +Write-Output "zig test std/std.zig..." + +& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" ` + --zig-lib-dir "$ZIGLIBDIR" ` + -femit-docs ` + -fno-emit-bin +CheckLastExitCode