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: 11 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ jobs:

release-build:
name: Release binary build
runs-on: ubuntu-latest
# cgo also uses the runner's loader and libc during the no-AVX smoke test.
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
Expand All @@ -79,7 +80,16 @@ jobs:
- run: ./build.sh
env:
VERSION: ci
# Exercise Linux amd64 compatibility with higher inherited CPU flags.
GOAMD64: v3
CGO_CFLAGS: -O2 -g -march=x86-64-v3
- run: ./packaging/package-release.sh ci
- name: Install QEMU user emulator
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends qemu-user
- name: Smoke-test Linux amd64 release without AVX
run: ./packaging/smoke-test-linux-amd64.sh dist/dbxcli_ci_linux_amd64.tar.gz

docs:
name: Generated docs
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ permissions:

jobs:
release:
runs-on: ubuntu-latest
# Keep cgo's system libraries compatible with baseline amd64 CPUs.
runs-on: ubuntu-24.04
permissions:
contents: write
outputs:
Expand Down Expand Up @@ -44,6 +45,14 @@ jobs:
- run: ./packaging/package-release.sh
env:
VERSION: ${{ github.ref_name }}
- name: Install QEMU user emulator
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends qemu-user
- name: Smoke-test Linux amd64 release without AVX
env:
ASSET_VERSION: ${{ steps.version.outputs.asset_version }}
run: ./packaging/smoke-test-linux-amd64.sh "dist/dbxcli_${ASSET_VERSION}_linux_amd64.tar.gz"
- name: Verify Windows release archive
run: test -f "dist/${{ steps.version.outputs.windows_archive }}"
- uses: softprops/action-gh-release@v3
Expand Down
9 changes: 8 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@ for target in $TARGETS; do
output="${output}.exe"
fi
echo "Building ${target}..."
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="${LDFLAGS}" -o "$output" .
(
if [ "$target" = "linux/amd64" ]; then
# GOAMD64 does not constrain C code compiled by cgo.
export GOAMD64=v1
export CGO_CFLAGS="${CGO_CFLAGS:--O2 -g} -march=x86-64"
fi
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="${LDFLAGS}" -o "$output" .
)
done
12 changes: 12 additions & 0 deletions packaging/smoke-test-linux-amd64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euo pipefail

archive="${1:?Usage: $0 ARCHIVE}"
work_dir="$(mktemp -d)"
trap 'rm -rf "$work_dir"' EXIT

tar -xzf "$archive" --strip-components=1 -C "$work_dir"

# Exercise the packaged binary's cgo startup on a baseline CPU without AVX.
timeout 30s qemu-x86_64 -cpu qemu64 "$work_dir/dbxcli" version
Loading