Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Cache zstd build
uses: actions/cache@v5
with:
path: deps
key: zstd-deps-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json', 'package-lock.json', 'etc/install-zstd.sh') }}

Comment thread
tadjik1 marked this conversation as resolved.
- name: Install zstd
run: npm run install-zstd
shell: bash
Expand All @@ -38,6 +44,9 @@ jobs:

container_tests_glibc:
runs-on: ubuntu-latest
# QEMU-emulated builds occasionally hang; fail fast rather than burning the
# 6-hour default timeout. Successful runs complete in ~15 min.
timeout-minutes: 30
strategy:
matrix:
linux_arch: [s390x, arm64, amd64]
Expand Down Expand Up @@ -76,6 +85,9 @@ jobs:

container_tests_musl:
runs-on: ubuntu-latest
# QEMU-emulated builds occasionally hang; fail fast rather than burning the
# 6-hour default timeout. Successful runs complete in ~15 min.
timeout-minutes: 30
strategy:
matrix:
linux_arch: [amd64, arm64]
Expand Down
39 changes: 28 additions & 11 deletions etc/install-zstd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,26 @@ download_zstd() {

# only unpack the source and build files needed to compile the project
necessary_files="zstd-$ZSTD_VERSION/build zstd-$ZSTD_VERSION/lib zstd-$ZSTD_VERSION/programs"

# flags
# -L follow redirects
# -C output directory
# - tar from stdin
# --strip-components ignore the top-level directory when unpacking
curl -L "https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz" \
| tar -zxf - -C deps/zstd --strip-components 1 $necessary_files

# Download to a file before extracting so curl and tar failures are decoupled.
# Retry loop is used instead of --retry-all-errors because UBI8 ships curl 7.61
# which predates that flag (added in 7.71). --fail makes curl exit non-zero on
# HTTP 4xx/5xx (e.g. GitHub rate limiting concurrent CI jobs).
TMPFILE=$(mktemp)
Comment thread
PavelSafronov marked this conversation as resolved.
trap 'rm -f "$TMPFILE"' EXIT
ATTEMPTS=0
until curl -L --fail -o "$TMPFILE" \
"https://github.com/facebook/zstd/releases/download/v$ZSTD_VERSION/zstd-$ZSTD_VERSION.tar.gz"
do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -ge 5 ]; then
echo "Failed to download zstd after $ATTEMPTS attempts, giving up"
exit 1
fi
echo "Download failed, retrying in 5s (attempt $ATTEMPTS/5)..."
sleep 5
done
tar -zxf "$TMPFILE" -C deps/zstd --strip-components 1 $necessary_files
}

build_zstd() {
Expand All @@ -42,6 +54,11 @@ build_zstd() {
cmake --build . --target libzstd_static --config Release
}

clean_deps
download_zstd
build_zstd
# If a previous build is restored from cache, skip everything.
if [ -d "deps/zstd/out" ]; then
echo "deps/zstd already built, skipping download and build"
else
clean_deps
download_zstd
build_zstd
fi
Comment thread
tadjik1 marked this conversation as resolved.
Loading