From 1cbfdb42449f25cf996f4492736dbf8722ab3f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 28 Jan 2025 20:39:31 +0100 Subject: [PATCH] ci: Set ZIG_GLOBAL_CACHE_DIR and ZIG_LOCAL_CACHE_DIR earlier. Otherwise the disk just keeps getting filled up. Also remove some pointless cleanup commands since the actions/checkout workflow step already cleans the repository by default. --- ci/aarch64-linux-debug.sh | 16 ++++++---------- ci/aarch64-linux-release.sh | 16 ++++++---------- ci/aarch64-macos-debug.sh | 7 +++---- ci/aarch64-macos-release.sh | 7 +++---- ci/aarch64-windows.ps1 | 9 ++++----- ci/x86_64-linux-debug.sh | 22 ++++++++-------------- ci/x86_64-linux-release.sh | 22 ++++++++-------------- ci/x86_64-macos-release.sh | 15 ++++++--------- ci/x86_64-windows-debug.ps1 | 9 ++++----- ci/x86_64-windows-release.ps1 | 9 ++++----- 10 files changed, 52 insertions(+), 80 deletions(-) diff --git a/ci/aarch64-linux-debug.sh b/ci/aarch64-linux-debug.sh index 47f75c462476d040243e1cda1f2c80a6cfa26b34..220aaf12d9f74e95c2ed898a3046d23bc4792369 100644 --- a/ci/aarch64-linux-debug.sh +++ b/ci/aarch64-linux-debug.sh @@ -19,19 +19,18 @@ export PATH="$HOME/local/bin:$PATH" 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 - # Override the cache directories because they won't actually help other CI runs # which will be testing alternate versions of zig, and ultimately would just # fill up space on the hard drive for no reason. export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" +mkdir build-debug +cd build-debug + +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + cmake .. \ -DCMAKE_INSTALL_PREFIX="stage3-debug" \ -DCMAKE_PREFIX_PATH="$PREFIX" \ @@ -66,12 +65,9 @@ stage3-debug/bin/zig build test docs \ # Ensure that updating the wasm binary from this commit will result in a viable build. stage3-debug/bin/zig build update-zig1 -rm -rf ../build-new mkdir ../build-new cd ../build-new -export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" -export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" diff --git a/ci/aarch64-linux-release.sh b/ci/aarch64-linux-release.sh index a41255b4547671017d2e1fea1190260bc4cea35e..69eed679e3c6041d9fff2d591bac7e2fa110debd 100644 --- a/ci/aarch64-linux-release.sh +++ b/ci/aarch64-linux-release.sh @@ -19,19 +19,18 @@ export PATH="$HOME/local/bin:$PATH" 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 - # Override the cache directories because they won't actually help other CI runs # which will be testing alternate versions of zig, and ultimately would just # fill up space on the hard drive for no reason. export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" +mkdir build-release +cd build-release + +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" + cmake .. \ -DCMAKE_INSTALL_PREFIX="stage3-release" \ -DCMAKE_PREFIX_PATH="$PREFIX" \ @@ -82,12 +81,9 @@ diff stage3-release/bin/zig stage4-release/bin/zig # Ensure that updating the wasm binary from this commit will result in a viable build. stage3-release/bin/zig build update-zig1 -rm -rf ../build-new mkdir ../build-new cd ../build-new -export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" -export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" diff --git a/ci/aarch64-macos-debug.sh b/ci/aarch64-macos-debug.sh index 4d44401a9924447587d08030dad5ec929b0f0772..474f0c5cea2847e41d65139fc304dafd4afa89f1 100755 --- a/ci/aarch64-macos-debug.sh +++ b/ci/aarch64-macos-debug.sh @@ -26,16 +26,15 @@ cd $ZIGDIR git fetch --unshallow || true git fetch --tags -rm -rf build-debug -mkdir build-debug -cd build-debug - # Override the cache directories because they won't actually help other CI runs # which will be testing alternate versions of zig, and ultimately would just # fill up space on the hard drive for no reason. export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" +mkdir build-debug +cd build-debug + PATH="$HOME/local/bin:$PATH" cmake .. \ -DCMAKE_INSTALL_PREFIX="stage3-debug" \ -DCMAKE_PREFIX_PATH="$PREFIX" \ diff --git a/ci/aarch64-macos-release.sh b/ci/aarch64-macos-release.sh index e8ce56eaea2d80a26cb3a24a3c75b938a15e3029..dac793075a6b401566b7fb43a2626643e7814aa2 100755 --- a/ci/aarch64-macos-release.sh +++ b/ci/aarch64-macos-release.sh @@ -26,16 +26,15 @@ cd $ZIGDIR git fetch --unshallow || true git fetch --tags -rm -rf build-release -mkdir build-release -cd build-release - # Override the cache directories because they won't actually help other CI runs # which will be testing alternate versions of zig, and ultimately would just # fill up space on the hard drive for no reason. export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" +mkdir build-release +cd build-release + PATH="$HOME/local/bin:$PATH" cmake .. \ -DCMAKE_INSTALL_PREFIX="stage3-release" \ -DCMAKE_PREFIX_PATH="$PREFIX" \ diff --git a/ci/aarch64-windows.ps1 b/ci/aarch64-windows.ps1 index b0e7c474ca8c41299d4f1628b65f2d153a29157d..44140506a743765a87a0f1183f6d59eccf81d890 100644 --- a/ci/aarch64-windows.ps1 +++ b/ci/aarch64-windows.ps1 @@ -30,17 +30,16 @@ if ((git rev-parse --is-shallow-repository) -eq "true") { git fetch --unshallow # `git describe` won't work on a shallow repo } -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' - # Override the cache directories because they won't actually help other CI runs # which will be testing alternate versions of zig, and ultimately would just # fill up space on the hard drive for no reason. $Env:ZIG_GLOBAL_CACHE_DIR="$(Get-Location)\zig-global-cache" $Env:ZIG_LOCAL_CACHE_DIR="$(Get-Location)\zig-local-cache" +Write-Output "Building from source..." +New-Item -Path 'build-release' -ItemType Directory +Set-Location -Path 'build-release' + # CMake gives a syntax error when file paths with backward slashes are used. # Here, we use forward slashes only to work around this. & cmake .. ` diff --git a/ci/x86_64-linux-debug.sh b/ci/x86_64-linux-debug.sh index 81c286d428da8d675644b20c047af55cbf9a8208..1ef474577959c32833d9dd0f127611237cc7f3bc 100755 --- a/ci/x86_64-linux-debug.sh +++ b/ci/x86_64-linux-debug.sh @@ -19,26 +19,23 @@ export PATH="$HOME/deps/wasmtime-v29.0.0-$ARCH-linux:$HOME/deps/qemu-linux-x86_6 git fetch --unshallow || true git fetch --tags +# Override the cache directories because they won't actually help other CI runs +# which will be testing alternate versions of zig, and ultimately would just +# fill up space on the hard drive for no reason. +export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" + # Test building from source without LLVM. -git clean -fd -rm -rf zig-out cc -o bootstrap bootstrap.c ./bootstrap ./zig2 build -Dno-lib ./zig-out/bin/zig test test/behavior.zig -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 -# Override the cache directories because they won't actually help other CI runs -# which will be testing alternate versions of zig, and ultimately would just -# fill up space on the hard drive for no reason. -export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" -export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" cmake .. \ -DCMAKE_INSTALL_PREFIX="stage3-debug" \ @@ -76,12 +73,9 @@ stage3-debug/bin/zig build test docs \ # Ensure that updating the wasm binary from this commit will result in a viable build. stage3-debug/bin/zig build update-zig1 -rm -rf ../build-new mkdir ../build-new cd ../build-new -export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" -export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" diff --git a/ci/x86_64-linux-release.sh b/ci/x86_64-linux-release.sh index a1041e7fb8f8ebfd15759eee53c3cae2ad7c1dd4..d6c0cc5701b3b977b6ffb365d96d7e0422857de6 100755 --- a/ci/x86_64-linux-release.sh +++ b/ci/x86_64-linux-release.sh @@ -19,26 +19,23 @@ export PATH="$HOME/deps/wasmtime-v29.0.0-$ARCH-linux:$HOME/deps/qemu-linux-x86_6 git fetch --unshallow || true git fetch --tags +# Override the cache directories because they won't actually help other CI runs +# which will be testing alternate versions of zig, and ultimately would just +# fill up space on the hard drive for no reason. +export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" + # Test building from source without LLVM. -git clean -fd -rm -rf zig-out cc -o bootstrap bootstrap.c ./bootstrap ./zig2 build -Dno-lib ./zig-out/bin/zig test test/behavior.zig -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 -# Override the cache directories because they won't actually help other CI runs -# which will be testing alternate versions of zig, and ultimately would just -# fill up space on the hard drive for no reason. -export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" -export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" +export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" +export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" cmake .. \ -DCMAKE_INSTALL_PREFIX="stage3-release" \ @@ -92,12 +89,9 @@ diff stage3-release/bin/zig stage4-release/bin/zig # Ensure that updating the wasm binary from this commit will result in a viable build. stage3-release/bin/zig build update-zig1 -rm -rf ../build-new mkdir ../build-new cd ../build-new -export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" -export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" export CC="$ZIG cc -target $TARGET -mcpu=$MCPU" export CXX="$ZIG c++ -target $TARGET -mcpu=$MCPU" diff --git a/ci/x86_64-macos-release.sh b/ci/x86_64-macos-release.sh index 838952b181bbba095b643227ab394c4d811c1945..30b37819155eb8e4322686255880ee7a6a2b686e 100755 --- a/ci/x86_64-macos-release.sh +++ b/ci/x86_64-macos-release.sh @@ -24,24 +24,21 @@ cd $ZIGDIR git fetch --unshallow || true git fetch --tags +# Override the cache directories because they won't actually help other CI runs +# which will be testing alternate versions of zig, and ultimately would just +# fill up space on the hard drive for no reason. +export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" +export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" + # Test building from source without LLVM. -git clean -fd -rm -rf zig-out cc -o bootstrap bootstrap.c ./bootstrap ./zig2 build -Dno-lib ./zig-out/bin/zig test test/behavior.zig -rm -rf build mkdir build cd build -# Override the cache directories because they won't actually help other CI runs -# which will be testing alternate versions of zig, and ultimately would just -# fill up space on the hard drive for no reason. -export ZIG_GLOBAL_CACHE_DIR="$PWD/zig-global-cache" -export ZIG_LOCAL_CACHE_DIR="$PWD/zig-local-cache" - cmake .. \ -DCMAKE_PREFIX_PATH="$PREFIX" \ -DCMAKE_BUILD_TYPE=Release \ diff --git a/ci/x86_64-windows-debug.ps1 b/ci/x86_64-windows-debug.ps1 index 8fd4db222c52278f207cd613e4fda38f2d74742e..048ad3f15fd332e39134c2586ce91421ef05703c 100644 --- a/ci/x86_64-windows-debug.ps1 +++ b/ci/x86_64-windows-debug.ps1 @@ -30,17 +30,16 @@ if ((git rev-parse --is-shallow-repository) -eq "true") { git fetch --unshallow # `git describe` won't work on a shallow repo } -Write-Output "Building from source..." -Remove-Item -Path 'build-debug' -Recurse -Force -ErrorAction Ignore -New-Item -Path 'build-debug' -ItemType Directory -Set-Location -Path 'build-debug' - # Override the cache directories because they won't actually help other CI runs # which will be testing alternate versions of zig, and ultimately would just # fill up space on the hard drive for no reason. $Env:ZIG_GLOBAL_CACHE_DIR="$(Get-Location)\zig-global-cache" $Env:ZIG_LOCAL_CACHE_DIR="$(Get-Location)\zig-local-cache" +Write-Output "Building from source..." +New-Item -Path 'build-debug' -ItemType Directory +Set-Location -Path 'build-debug' + # CMake gives a syntax error when file paths with backward slashes are used. # Here, we use forward slashes only to work around this. & cmake .. ` diff --git a/ci/x86_64-windows-release.ps1 b/ci/x86_64-windows-release.ps1 index 432d0649beb18d278d2606dcb31278bcec69d209..965fc4b578f53eff59c44a43bfb9ee5cc53e91fb 100644 --- a/ci/x86_64-windows-release.ps1 +++ b/ci/x86_64-windows-release.ps1 @@ -30,17 +30,16 @@ if ((git rev-parse --is-shallow-repository) -eq "true") { git fetch --unshallow # `git describe` won't work on a shallow repo } -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' - # Override the cache directories because they won't actually help other CI runs # which will be testing alternate versions of zig, and ultimately would just # fill up space on the hard drive for no reason. $Env:ZIG_GLOBAL_CACHE_DIR="$(Get-Location)\zig-global-cache" $Env:ZIG_LOCAL_CACHE_DIR="$(Get-Location)\zig-local-cache" +Write-Output "Building from source..." +New-Item -Path 'build-release' -ItemType Directory +Set-Location -Path 'build-release' + # CMake gives a syntax error when file paths with backward slashes are used. # Here, we use forward slashes only to work around this. & cmake .. ` -- 2.54.0