Skip to content

Commit

Permalink
ci: check in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
matu3ba committed Dec 2, 2024
1 parent 36b574c commit 78d241d
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ci/aarch64-macos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
# aarch64-macos CI script to clean cache, if necessary

# set -x
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable

MAX_SIZE_B=2147483648 #2 GB = 2*(1024)**3 B
ZIG_CACHE_DIR="$(zig env | jq '. "global_cache_dir"')"
CHECK_SIZE_B=$(du -sb "$ZIG_CACHE_DIR" | cut -f1)
if test "$CHECK_SIZE_B" -ge $MAX_SIZE_B; then
rm -fr "$ZIG_CACHE_DIR"
fi

zig env

zig build -Dno_opt_deps -Dno_cross test --summary all
17 changes: 17 additions & 0 deletions ci/x86_64-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
# x86_64-linux CI script to clean cache, if necessary

# set -x
set -o errexit # abort on nonzero exitstatus
set -o nounset # abort on unbound variable

MAX_SIZE_B=2147483648 #2 GB = 2*(1024)**3 B
ZIG_CACHE_DIR="$(zig env | jq '. "global_cache_dir"')"
CHECK_SIZE_B=$(du -sb "$ZIG_CACHE_DIR" | cut -f1)
if test "$CHECK_SIZE_B" -ge $MAX_SIZE_B; then
rm -fr "$ZIG_CACHE_DIR"
fi

zig env

zig build -Dno_opt_deps -Dno_cross test --summary all
19 changes: 19 additions & 0 deletions ci/x86_64-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# x86_64-windows CI script to clean cache, if necessary
function CheckLastExitCode {
if (!$?) { exit 1 }
return 0
}

[int] $MAX_SIZE_B = 2147483648 #2 GB = 2*(1024)**3 B
[string] $ZIG_CACHE_DIR = $(zig env | jq '. "global_cache_dir"')
[int] $CHECK_SIZE_B = [int]$(gci $ZIG_CACHE_DIR | measure Length -s).Sum
if ($CHECK_SIZE_B -gt $MAX_SIZE_B) {
Remove-Item -Recurse -Force -ErrorAction Ignore -Path $ZIG_CACHE_DIR
CheckLastExitCode
}

zig env
CheckLastExitCode

zig build -Dno_opt_deps -Dno_cross test --summary all
CheckLastExitCode

0 comments on commit 78d241d

Please sign in to comment.