Commit 8583e88db5

Andrew Kelley <andrew@ziglang.org>
2023-01-09 23:47:54
CI: update to github actions in the 0.10.x branch
1 parent da96e7e
.github/workflows/ci.yaml
@@ -1,9 +1,8 @@
 name: ci
 on:
-  pull_request:
   push:
     branches: 
-      - master
+      - 0.10.x
 concurrency: 
   # Cancels pending runs when a PR gets updated.
   group: ${{ github.head_ref || github.run_id }}-${{ github.actor }}
@@ -39,22 +38,13 @@ jobs:
         run: sh ci/aarch64-linux-release.sh
   x86_64-macos:
     runs-on: "macos-11"
-    env: 
+    env:
       ARCH: "x86_64"
     steps:
       - name: Checkout
         uses: actions/checkout@v3
       - name: Build and Test
         run: ci/x86_64-macos.sh
-  aarch64-macos:
-    runs-on: [self-hosted, macOS, aarch64]
-    env: 
-      ARCH: "aarch64"
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v3
-      - name: Build and Test
-        run: ci/aarch64-macos.sh
   x86_64-windows:
     runs-on: windows-latest
     env: 
ci/aarch64-linux-debug.sh
@@ -8,7 +8,7 @@ set -e
 ARCH="$(uname -m)"
 TARGET="$ARCH-linux-musl"
 MCPU="baseline"
-CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
+CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.971+19056cb68"
 PREFIX="$HOME/deps/$CACHE_BASENAME"
 ZIG="$PREFIX/bin/zig"
 
@@ -57,8 +57,6 @@ stage3-debug/bin/zig fmt --check .. \
 # 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 \
@@ -67,7 +65,7 @@ stage3-debug/bin/zig build test docs \
   --zig-lib-dir "$(pwd)/../lib"
 
 # Look for HTML errors.
-tidy --drop-empty-elements no -qe ../zig-cache/langref.html
+tidy --drop-empty-elements no -qe "$ZIG_LOCAL_CACHE_DIR/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
ci/aarch64-linux-release.sh
@@ -8,9 +8,9 @@ set -e
 ARCH="$(uname -m)"
 TARGET="$ARCH-linux-musl"
 MCPU="baseline"
-CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
+CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.971+19056cb68"
 PREFIX="$HOME/deps/$CACHE_BASENAME"
-ZIG="$PREFIX/bin/zig" 
+ZIG="$PREFIX/bin/zig"
 
 export PATH="$HOME/deps/wasmtime-v2.0.2-$ARCH-linux:$PATH"
 
@@ -57,8 +57,6 @@ stage3-release/bin/zig fmt --check .. \
 # 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 \
@@ -67,10 +65,7 @@ stage3-release/bin/zig build test docs \
   --zig-lib-dir "$(pwd)/../lib"
 
 # Look for HTML errors.
-tidy --drop-empty-elements no -qe ../zig-cache/langref.html
+tidy --drop-empty-elements no -qe "$ZIG_LOCAL_CACHE_DIR/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 "$(pwd)/../lib"
+stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/aarch64-macos.sh
@@ -4,12 +4,12 @@ set -x
 set -e
 
 # Script assumes the presence of the following:
-# s3cmd 
+# s3cmd
 
 ZIGDIR="$(pwd)"
 TARGET="$ARCH-macos-none"
 MCPU="baseline"
-CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
+CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.534+b0b1cc356-1"
 PREFIX="$HOME/$CACHE_BASENAME"
 ZIG="$PREFIX/bin/zig"
 
@@ -51,8 +51,20 @@ stage3-release/bin/zig build test docs \
   --search-prefix "$PREFIX"
 
 # Produce the experimental std lib documentation.
-mkdir -p "stage3-release/doc/std"
-stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \
-  --zig-lib-dir "$(pwd)/../lib" \
-  -femit-docs="$(pwd)/stage3-release/doc/std" \
-  -fno-emit-bin
+stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
+
+# Ensure that stage3 and stage4 are byte-for-byte identical.
+stage3-release/bin/zig build \
+  --prefix stage4-release \
+  -Denable-llvm \
+  -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
ci/x86_64-linux-debug.sh
@@ -8,7 +8,7 @@ set -e
 ARCH="$(uname -m)"
 TARGET="$ARCH-linux-musl"
 MCPU="baseline"
-CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
+CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.971+19056cb68"
 PREFIX="$HOME/deps/$CACHE_BASENAME"
 ZIG="$PREFIX/bin/zig"
 
@@ -66,10 +66,7 @@ stage3-debug/bin/zig build test docs \
   --zig-lib-dir "$(pwd)/../lib"
 
 # Look for HTML errors.
-tidy --drop-empty-elements no -qe ../zig-cache/langref.html
+tidy --drop-empty-elements no -qe "$ZIG_LOCAL_CACHE_DIR/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 "$(pwd)/../lib"
+stage3-debug/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/x86_64-linux-release.sh
@@ -8,9 +8,9 @@ set -e
 ARCH="$(uname -m)"
 TARGET="$ARCH-linux-musl"
 MCPU="baseline"
-CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
+CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.971+19056cb68"
 PREFIX="$HOME/deps/$CACHE_BASENAME"
-ZIG="$PREFIX/bin/zig" 
+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"
 
@@ -67,26 +67,7 @@ stage3-release/bin/zig build test docs \
   --zig-lib-dir "$(pwd)/../lib"
 
 # Look for HTML errors.
-tidy --drop-empty-elements no -qe ../zig-cache/langref.html
+tidy --drop-empty-elements no -qe "$ZIG_LOCAL_CACHE_DIR/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 "$(pwd)/../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
+stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/x86_64-macos.sh
@@ -4,12 +4,12 @@ set -x
 set -e
 
 # Script assumes the presence of the following:
-# s3cmd 
+# s3cmd
 
 ZIGDIR="$(pwd)"
 TARGET="$ARCH-macos-none"
 MCPU="baseline"
-CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
+CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.11.0-dev.534+b0b1cc356"
 PREFIX="$HOME/$CACHE_BASENAME"
 JOBS="-j3"
 
@@ -59,8 +59,4 @@ stage3-release/bin/zig build test docs \
   --search-prefix "$PREFIX"
 
 # Produce the experimental std lib documentation.
-mkdir -p "stage3-release/doc/std"
-stage3-release/bin/zig test "$(pwd)/../lib/std/std.zig" \
-  --zig-lib-dir "$(pwd)/../lib" \
-  -femit-docs="$(pwd)/stage3-release/doc/std" \
-  -fno-emit-bin
+stage3-release/bin/zig test ../lib/std/std.zig -femit-docs -fno-emit-bin --zig-lib-dir ../lib
ci/x86_64-windows.ps1
@@ -1,20 +1,18 @@
 $TARGET = "$($Env:ARCH)-windows-gnu"
 $ZIG_LLVM_CLANG_LLD_NAME = "zig+llvm+lld+clang-$TARGET-0.11.0-dev.448+e6e459e9e"
+$MCPU = "baseline"
 $ZIG_LLVM_CLANG_LLD_URL = "https://ziglang.org/deps/$ZIG_LLVM_CLANG_LLD_NAME.zip"
+$PREFIX_PATH = "$(Get-Location)\$ZIG_LLVM_CLANG_LLD_NAME"
+$ZIG = "$PREFIX_PATH\bin\zig.exe"
+$ZIG_LIB_DIR = "$(Get-Location)\lib"
 
 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 ; 
+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
@@ -31,35 +29,41 @@ 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..."
+Write-Output "Building from source..."
+Remove-Item -Path 'build-release' -Recurse -Force -ErrorAction Ignore
+New-Item -Path 'build-release' -ItemType Directory
+Set-Location -Path 'build-release'
 
-& "$ZIGPREFIXPATH\bin\zig.exe" build `
-    --prefix "$ZIGINSTALLDIR" `
-    --search-prefix "$ZIGPREFIXPATH" `
-    --zig-lib-dir "$ZIGLIBDIR" `
-    -Denable-stage1 `
-    -Dstatic-llvm `
-    -Drelease `
-    -Duse-zig-libcxx `
-    -Dtarget="$TARGET"
+# CMake gives a syntax error when file paths with backward slashes are used.
+# Here, we use forward slashes only to work around this.
+& cmake .. `
+  -GNinja `
+  -DCMAKE_INSTALL_PREFIX="stage3-release" `
+  -DCMAKE_PREFIX_PATH="$($PREFIX_PATH -Replace "\\", "/")" `
+  -DCMAKE_BUILD_TYPE=Release `
+  -DCMAKE_C_COMPILER="$($ZIG -Replace "\\", "/");cc;-target;$TARGET;-mcpu=$MCPU" `
+  -DCMAKE_CXX_COMPILER="$($ZIG -Replace "\\", "/");c++;-target;$TARGET;-mcpu=$MCPU" `
+  -DZIG_TARGET_TRIPLE="$TARGET" `
+  -DZIG_TARGET_MCPU="$MCPU" `
+  -DZIG_STATIC=ON
 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
+ninja install
 CheckLastExitCode
 
-# Produce the experimental std lib documentation.
-mkdir "$ZIGINSTALLDIR\doc\std" -force
-
-Write-Output "zig test std/std.zig..."
+Write-Output "Main test suite..."
+& "stage3-release\bin\zig.exe" build test docs `
+  --zig-lib-dir "$ZIG_LIB_DIR" `
+  --search-prefix "$PREFIX_PATH" `
+  -Dstatic-llvm `
+  -Dskip-non-native `
+  -Denable-symlinks-windows
+CheckLastExitCode
 
-& "$ZIGINSTALLDIR\bin\zig.exe" test "$ZIGLIBDIR\std\std.zig" `
-    --zig-lib-dir "$ZIGLIBDIR" `
-    -femit-docs="$ZIGINSTALLDIR\doc\std" `
-    -fno-emit-bin
+Write-Output "Testing Autodocs..."
+& "stage3-release\bin\zig.exe" test "..\lib\std\std.zig" `
+  --zig-lib-dir "$ZIG_LIB_DIR" `
+  -femit-docs `
+  -fno-emit-bin
 CheckLastExitCode
+