build: finish cross-platform release tooling
This commit is contained in:
+101
-63
@@ -11,13 +11,11 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
# Verification: TinyCC builds and tests everything in seconds. tcc warns on
|
||||
# `#pragma GCC`, so no -Werror here; the gcc release builds below carry it.
|
||||
tcc-check:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
cc: [gcc, clang]
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
@@ -34,21 +32,14 @@ jobs:
|
||||
$SUDO bash scripts/ci_pkg_mirror.sh
|
||||
$SUDO apt-get update
|
||||
$SUDO apt-get install -y --no-install-recommends \
|
||||
build-essential clang cmake pkg-config python3 \
|
||||
build-essential pkg-config python3 curl ca-certificates \
|
||||
libcurl4-openssl-dev libncurses-dev
|
||||
- name: Build (warnings are errors)
|
||||
run: make CC=${{ matrix.cc }} CFLAGS="-std=c11 -Wall -Wextra -O2 -g -Werror" -j"$(nproc)"
|
||||
- name: Build TinyCC
|
||||
run: bash scripts/ci_tcc.sh
|
||||
- name: Build
|
||||
run: make CC=tcc AR=ar CFLAGS="-std=c11 -Wall -O2 -g" -j"$(nproc)"
|
||||
- name: Unit tests
|
||||
run: |
|
||||
# Same -Werror as the build step so undeclared libc helpers cannot
|
||||
# silently return int and truncate pointers (see test_subagent).
|
||||
make CC=${{ matrix.cc }} \
|
||||
CFLAGS="-std=c11 -Wall -Wextra -O2 -g -Werror" check
|
||||
- name: CMake build + ctest
|
||||
run: |
|
||||
cmake -B build -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCST_BUILD_TUI=ON
|
||||
cmake --build build -j"$(nproc)"
|
||||
ctest --test-dir build --output-on-failure
|
||||
run: make CC=tcc AR=ar CFLAGS="-std=c11 -Wall -O2 -g" check
|
||||
- name: Smoke test
|
||||
run: |
|
||||
./cst-agent --help
|
||||
@@ -57,39 +48,22 @@ jobs:
|
||||
- name: WebUI end-to-end (recorded stream, no API key)
|
||||
run: sh scripts/e2e_webui.sh
|
||||
|
||||
musl:
|
||||
# Release: static musl binaries, gcc with -Werror.
|
||||
# dist/cst-agent-VERSION-linux-ARCH.tar.gz
|
||||
linux:
|
||||
needs: tcc-check
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
container: alpine:3.20
|
||||
steps:
|
||||
- name: Install tools + mirror
|
||||
run: |
|
||||
sed -i 's#https\?://dl-cdn.alpinelinux.org/alpine#https://mirrors.tuna.tsinghua.edu.cn/alpine#g' \
|
||||
/etc/apk/repositories
|
||||
apk add --no-cache curl git bash
|
||||
- name: Checkout
|
||||
env:
|
||||
GITHUB_SERVER_URL: ${{ github.server_url }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
curl -fsSL "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/raw/commit/$GITHUB_SHA/scripts/ci_checkout.sh" \
|
||||
-o /tmp/ci_checkout.sh
|
||||
bash /tmp/ci_checkout.sh
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
# linux-headers provides linux/audit.h for the seccomp probe path
|
||||
apk add --no-cache build-base pkgconf curl-dev ncurses-dev \
|
||||
linux-headers git nodejs bash python3
|
||||
- name: Build + unit tests
|
||||
run: |
|
||||
make CFLAGS="-std=c11 -Wall -Wextra -O2 -Werror" -j"$(nproc)"
|
||||
make check
|
||||
|
||||
# MinGW-w64 UCRT cross build → dist/cst-agent-*-windows-x86_64.zip
|
||||
windows-cross:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
timeout-minutes: 60
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: x86_64
|
||||
check: 1
|
||||
- arch: x86
|
||||
check: 1
|
||||
- arch: aarch64
|
||||
check: 0
|
||||
steps:
|
||||
- name: Checkout
|
||||
env:
|
||||
@@ -105,20 +79,29 @@ jobs:
|
||||
SUDO=$(command -v sudo || true)
|
||||
$SUDO bash scripts/ci_pkg_mirror.sh
|
||||
$SUDO apt-get update
|
||||
# ncurses-bin/-term: tic, infocmp and the fallback terminal entries
|
||||
$SUDO apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl git cmake ninja-build make pkg-config \
|
||||
python3 zip unzip perl xz-utils
|
||||
- name: Cross-build Windows zip
|
||||
run: bash scripts/ci_windows_cross.sh
|
||||
- name: Verify zip
|
||||
build-essential cmake ninja-build pkg-config python3 perl \
|
||||
curl ca-certificates xz-utils bzip2 file ncurses-bin ncurses-term
|
||||
if [ "${{ matrix.arch }}" = aarch64 ]; then
|
||||
$SUDO apt-get install -y --no-install-recommends qemu-user-static
|
||||
fi
|
||||
- name: Build (static, -Werror)
|
||||
env:
|
||||
CST_LINUX_CHECK: ${{ matrix.check }}
|
||||
run: bash scripts/package_linux.sh ${{ matrix.arch }}
|
||||
- name: Smoke test
|
||||
run: |
|
||||
ls -lah dist/windows-x86_64/
|
||||
ls -lah dist/cst-agent-*-windows-x86_64.zip
|
||||
cat dist/cst-agent-*-windows-x86_64.zip.sha256
|
||||
unzip -l dist/cst-agent-*-windows-x86_64.zip | head -20
|
||||
# Auto-publish to Gitea Releases (v$CST_VERSION from include/cst_version.h).
|
||||
# Prefer repo secret RELEASE_TOKEN (write:repository); fall back to the
|
||||
# job token. Skipped on pull_request and when no token is available.
|
||||
d=$(ls -d dist/cst-agent-*-linux-${{ matrix.arch }})
|
||||
file "$d/cst-agent"
|
||||
run=""
|
||||
[ "${{ matrix.arch }}" = aarch64 ] && run=qemu-aarch64-static
|
||||
$run "$d/cst-agent" --version
|
||||
$run "$d/cst-agent" --help >/dev/null
|
||||
$run "$d/cst-agent" --workspace "$PWD" --list-sessions
|
||||
cat dist/cst-agent-*-linux-${{ matrix.arch }}.tar.gz.sha256
|
||||
# Release vVERSION (from include/cst_version.h) on Gitea. Prefer repo
|
||||
# secret RELEASE_TOKEN (write:repository); fall back to the job token.
|
||||
- name: Publish Gitea Release
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
@@ -134,4 +117,59 @@ jobs:
|
||||
echo "::warning::no RELEASE_TOKEN / GITHUB_TOKEN; skip auto-release"
|
||||
exit 0
|
||||
fi
|
||||
bash scripts/release_windows.sh
|
||||
bash scripts/release.sh dist/cst-agent-*-linux-${{ matrix.arch }}.tar.gz
|
||||
|
||||
# Release: mingw-w64 UCRT gcc (Debian trixie) with -Werror.
|
||||
# dist/cst-agent-VERSION-windows-x86_64.zip and -setup.exe (NSIS)
|
||||
windows:
|
||||
needs: tcc-check
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
container: debian:trixie
|
||||
steps:
|
||||
- name: Install tools
|
||||
run: |
|
||||
# No CA certificates in the image yet, so the mirror is plain http.
|
||||
sed -i 's#https\?://deb.debian.org#http://mirrors.tuna.tsinghua.edu.cn#g' \
|
||||
/etc/apt/sources.list.d/debian.sources
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends \
|
||||
ca-certificates curl git build-essential cmake ninja-build make \
|
||||
pkg-config python3 perl zip unzip xz-utils patch file \
|
||||
gcc-mingw-w64-ucrt64 binutils-mingw-w64-ucrt64 nsis
|
||||
- name: Checkout
|
||||
env:
|
||||
GITHUB_SERVER_URL: ${{ github.server_url }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
curl -fsSL "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/raw/commit/$GITHUB_SHA/scripts/ci_checkout.sh" \
|
||||
-o /tmp/ci_checkout.sh
|
||||
bash /tmp/ci_checkout.sh
|
||||
- name: Cross-build zip and installer
|
||||
env:
|
||||
CST_WIN_CFLAGS: -Wall -Wextra -Werror
|
||||
run: bash scripts/ci_windows_cross.sh
|
||||
- name: Verify
|
||||
run: |
|
||||
ls -lah dist/windows-x86_64/
|
||||
file dist/windows-x86_64/cst-agent.exe dist/cst-agent-*-windows-x86_64-setup.exe
|
||||
cat dist/cst-agent-*-windows-x86_64.zip.sha256 dist/cst-agent-*-windows-x86_64-setup.exe.sha256
|
||||
unzip -l dist/cst-agent-*-windows-x86_64.zip
|
||||
- name: Publish Gitea Release
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CST_GITEA: ${{ github.server_url }}
|
||||
CST_REPO: ${{ github.repository }}
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
CI: "true"
|
||||
run: |
|
||||
export GITEA_TOKEN="${RELEASE_TOKEN:-${GITHUB_TOKEN:-}}"
|
||||
if [[ -z "${GITEA_TOKEN}" ]]; then
|
||||
echo "::warning::no RELEASE_TOKEN / GITHUB_TOKEN; skip auto-release"
|
||||
exit 0
|
||||
fi
|
||||
bash scripts/release.sh dist/cst-agent-*-windows-x86_64.zip \
|
||||
dist/cst-agent-*-windows-x86_64-setup.exe
|
||||
|
||||
Reference in New Issue
Block a user