name: build-test-release # Runs on every merge/push to main: build the GUI, run tests + a microbenchmark, # and (when the change warrants it) cut an X.Y.Z release with the binary attached. on: push: branches: [main] jobs: release: runs-on: alkane-ci env: WX_PREFIX: /root/.cache/wx-3.3.3-linux steps: - name: Checkout (full history for tags) uses: actions/checkout@v4 with: fetch-depth: 0 - name: Compute version id: ver run: bash ci/compute-version.sh | tee -a "$GITHUB_OUTPUT" - name: Test version logic if: steps.ver.outputs.release == 'true' run: bash ci/test-compute-version.sh - name: Install build dependencies if: steps.ver.outputs.release == 'true' run: | apt-get update -qq apt-get install -y -qq --no-install-recommends \ libssl-dev pkg-config ca-certificates >/dev/null echo "libssl-dev + pkg-config installed (openssl-sys needs them)" - name: Cache vendored wxWidgets build if: steps.ver.outputs.release == 'true' uses: actions/cache@v4 with: path: /root/.cache/wx-3.3.3-linux key: wx-3.3.3-${{ runner.os }}-${{ hashFiles('thirdparty/wx-rs/VERSION') }} - name: Build wxWidgets (once, then cached) if: steps.ver.outputs.release == 'true' run: | if [ ! -x "$WX_PREFIX/bin/wx-config" ]; then bash scripts/build-wx-linux.sh else echo "wx prefix restored from cache" fi - name: Set crate version to ${{ steps.ver.outputs.version }} if: steps.ver.outputs.release == 'true' run: | sed -i "0,/^version = \".*\"/s//version = \"${{ steps.ver.outputs.version }}\"/" Cargo.toml grep -m1 '^version' Cargo.toml - name: Build release if: steps.ver.outputs.release == 'true' run: | export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config" cargo build --release -p alkane-gui --offline - name: Unit tests if: steps.ver.outputs.release == 'true' run: | export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config" cargo test -p alkane-gui --offline - name: Microbenchmarks if: steps.ver.outputs.release == 'true' run: | export WX_RS_WXCONFIG="$WX_PREFIX/bin/wx-config" cargo test -p alkane-gui --release --offline -- --ignored --nocapture bench_ - name: Headless UI self-test if: steps.ver.outputs.release == 'true' run: | apt-get update -qq && apt-get install -y -qq --no-install-recommends \ xvfb xauth dbus-x11 fonts-dejavu-core >/dev/null BIN=target/release/alkane-toolkit xvfb-run -a env GDK_BACKEND=x11 ALKANE_SELFTEST=1 "$BIN" - name: Package artifact if: steps.ver.outputs.release == 'true' id: pkg run: | V="${{ steps.ver.outputs.version }}" NAME="alkane-toolkit-v${V}-linux-x86_64" mkdir -p "dist/$NAME" cp target/release/alkane-toolkit "dist/$NAME/" cat > "dist/$NAME/README.txt" <> "$GITHUB_OUTPUT" echo "assetname=${NAME}.tar.gz" >> "$GITHUB_OUTPUT" - name: Create Gitea release + upload artifact if: steps.ver.outputs.release == 'true' env: TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | TAG="${{ steps.ver.outputs.tag }}" API="${GITHUB_API_URL:-https://gitea.bluefla.re/api/v1}" REPO="${GITHUB_REPOSITORY}" body="Automated ${{ steps.ver.outputs.bump }} release from ${GITHUB_SHA}." rel=$(curl -sS -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/json" \ "${API}/repos/${REPO}/releases" \ -d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"${GITHUB_SHA}\",\"name\":\"${TAG}\",\"body\":\"${body}\"}") id=$(echo "$rel" | grep -oE '"id":[0-9]+' | head -1 | cut -d: -f2) if [ -z "$id" ]; then echo "release create failed: $rel"; exit 1; fi curl -sS -X POST -H "Authorization: token ${TOKEN}" -H "Content-Type: application/gzip" \ "${API}/repos/${REPO}/releases/${id}/assets?name=${{ steps.pkg.outputs.assetname }}" \ --data-binary @"${{ steps.pkg.outputs.asset }}" | grep -oE '"browser_download_url":"[^"]+"' || true echo "Released ${TAG}" - name: No release needed if: steps.ver.outputs.release != 'true' run: echo "No backend/UI change since ${{ steps.ver.outputs.last_tag }} - skipping release."