Some checks failed
release / draft (push) Has been skipped
release / build (debian:forky, forky) (push) Failing after 4m13s
release / build (debian:trixie, trixie) (push) Successful in 1h6m14s
release / build (ubuntu:24.04, noble) (push) Successful in 1h1m20s
release / publish (push) Has been skipped
The Security Hub server runs Debian forky; build-release.sh accepts forky and the release matrix gains a debian:forky leg (~1 h more per release, legs run one at a time). Testing moves: rebuild after a library transition.
130 lines
5.7 KiB
YAML
130 lines
5.7 KiB
YAML
# Linux release builds for the Salt Security Hub rollout.
|
|
#
|
|
# Test lane: push to ci/**, pull requests, or manual run -> build + test + pack per distro;
|
|
# prints each tarball's sha256. Nothing is uploaded. Pushes to main do NOT build:
|
|
# each run takes ~2 h on the one-core runner and a queue of main runs delayed the
|
|
# v0.2.3 release by hours. Push a ci/<name> branch (or run it manually) to test.
|
|
# Release lane: push a tag v* -> the same, then a draft release gets every tarball and its
|
|
# .sha256, and is published only if all builds passed.
|
|
#
|
|
# The sha256 values are copied into the hub pillar by hand; Salt installs only files that
|
|
# match them, so this workflow is not the trust anchor.
|
|
#
|
|
# Forgejo reads .forgejo/workflows and then ignores .github/workflows; GitHub keeps build.yml.
|
|
# Builds run one at a time (max-parallel: 1) with JOBS=1 and nice; the runner caps each job at one CPU.
|
|
name: release
|
|
|
|
# A commit's branch push and its tag share a sha, so they land in one group and the newer
|
|
# (the tag/release) cancels the older branch-CI run instead of fighting it for the single runner.
|
|
concurrency:
|
|
group: release-${{ github.sha }}
|
|
# Never cancel a tag/release run (push ordering doesn't guarantee the tag event arrives
|
|
# after the branch event); only a branch-CI run for the same sha may be superseded.
|
|
cancel-in-progress: ${{ github.ref_type != 'tag' }}
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: ["ci/**"]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
|
|
jobs:
|
|
draft:
|
|
if: github.ref_type == 'tag'
|
|
runs-on: docker
|
|
container:
|
|
image: debian:trixie
|
|
outputs:
|
|
id: ${{ steps.create.outputs.id }}
|
|
steps:
|
|
- name: Create draft release
|
|
id: create
|
|
env:
|
|
TOKEN: ${{ secrets.RELEASE_TOKEN || github.token }}
|
|
run: |
|
|
apt-get update -q && apt-get install -y -q --no-install-recommends curl ca-certificates python3 >/dev/null
|
|
body=$(python3 -c 'import json,os; t=os.environ["GITHUB_REF_NAME"]; print(json.dumps({"tag_name": t, "name": t, "draft": True, "body": "Linux install trees for the Security Hub canary. Verify the .sha256 files."}))')
|
|
curl -sf -X POST -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
|
|
-d "$body" "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases" > release.json
|
|
id=$(python3 -c 'import json; print(json.load(open("release.json"))["id"])')
|
|
echo "draft release id=$id"; echo "id=$id" >> "$GITHUB_OUTPUT"
|
|
|
|
build:
|
|
needs: [draft]
|
|
# Run on branches (draft skipped) and on tags (draft succeeded).
|
|
if: ${{ !failure() && !cancelled() }}
|
|
# Single-CPU, JOBS=1, cold build of the whole project + full test suite is slow; give it room
|
|
# but fail cleanly instead of hanging if a build wedges under runner contention. 60 min was
|
|
# outgrown by v0.2.6 (trixie leg cancelled at 60:04; v0.2.5 took ~56 min).
|
|
timeout-minutes: 120
|
|
runs-on: docker
|
|
strategy:
|
|
max-parallel: 1
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: trixie
|
|
image: debian:trixie
|
|
- os: noble
|
|
image: ubuntu:24.04
|
|
# Debian testing (the hub server runs it). Testing moves: a tarball built today links today's forky
|
|
# libraries; rebuild after a library transition. Adds ~1 h of wall time per release (legs run one at a time).
|
|
- os: forky
|
|
image: debian:forky
|
|
container:
|
|
image: ${{ matrix.image }}
|
|
env:
|
|
CI: "true"
|
|
JOBS: "1"
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
steps:
|
|
- name: Checkout
|
|
env:
|
|
TOKEN: ${{ github.token }}
|
|
run: |
|
|
apt-get update -q && apt-get install -y -q --no-install-recommends git ca-certificates >/dev/null
|
|
git init -q . && git -c http.extraHeader="Authorization: token $TOKEN" fetch -q --depth 50 --tags \
|
|
"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git" "$GITHUB_SHA"
|
|
git checkout -q FETCH_HEAD
|
|
git log -1 --format='building %H %s'
|
|
# Persist ccache across runs so the single-CPU build is warm/incremental (meson uses ccache
|
|
# automatically). Best-effort: if the runner has no cache service, the build just runs cold.
|
|
- name: Restore ccache
|
|
uses: actions/cache@v4
|
|
continue-on-error: true
|
|
with:
|
|
path: ${{ github.workspace }}/.ccache
|
|
key: ccache-${{ matrix.os }}-${{ github.sha }}
|
|
restore-keys: |
|
|
ccache-${{ matrix.os }}-
|
|
- name: Build, test, pack
|
|
run: bash packaging/ci/build-release.sh ${{ matrix.os }} dist
|
|
- name: Upload to draft release
|
|
if: github.ref_type == 'tag'
|
|
env:
|
|
TOKEN: ${{ secrets.RELEASE_TOKEN || github.token }}
|
|
RELEASE_ID: ${{ needs.draft.outputs.id }}
|
|
run: |
|
|
for f in dist/*; do
|
|
curl -sf -X POST -H "Authorization: token $TOKEN" -F "attachment=@$f" \
|
|
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$(basename "$f")" >/dev/null
|
|
echo "uploaded $(basename "$f")"
|
|
done
|
|
|
|
publish:
|
|
needs: [draft, build]
|
|
if: github.ref_type == 'tag'
|
|
runs-on: docker
|
|
container:
|
|
image: debian:trixie
|
|
steps:
|
|
- name: Publish release
|
|
env:
|
|
TOKEN: ${{ secrets.RELEASE_TOKEN || github.token }}
|
|
RELEASE_ID: ${{ needs.draft.outputs.id }}
|
|
run: |
|
|
apt-get update -q && apt-get install -y -q --no-install-recommends curl ca-certificates >/dev/null
|
|
curl -sf -X PATCH -H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
|
|
-d '{"draft": false}' "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID" >/dev/null
|
|
echo "published release $RELEASE_ID"
|