ci: use core CLI for QA and standardize workflows

- ci.yml: Download latest dev release, run `core go qa`, build matrix
- release.yml: Use go-version-file, consistent artifact handling
- dev-release.yml: Add checksums, cleaner version string
- coverage.yml: Standardize setup-go version, add CLI verification

All workflows now use:
- go-version-file for consistent Go version
- upload-artifact@v4 / download-artifact@v4
- Proper version injection via ldflags

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-01 11:05:26 +00:00
parent 1afa35d3c6
commit aeb852c5e5
4 changed files with 109 additions and 58 deletions

View file

@ -2,23 +2,72 @@ name: CI
on:
push:
branches: ["main"]
branches: [dev, main]
pull_request:
branches: ["main"]
branches: [dev, main]
jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.22
go-version-file: 'go.mod'
- name: Install dependencies
run: go mod tidy
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
- name: Run tests
run: go test ./...
- name: Download core CLI
run: |
curl -sL "https://github.com/host-uk/core/releases/download/dev/core-linux-amd64" -o core
chmod +x core
sudo mv core /usr/local/bin/core
core --version
- name: Run QA
run: core go qa
build:
runs-on: ubuntu-latest
needs: test
strategy:
matrix:
include:
- goos: linux
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build CLI
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: '0'
run: |
EXT=""
if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi
VERSION="${GITHUB_REF_NAME:-dev}-$(git rev-parse --short HEAD)"
go build -trimpath \
-ldflags="-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${VERSION}" \
-o core-${GOOS}-${GOARCH}${EXT} .
- name: Verify build
if: matrix.goos == 'linux'
run: |
chmod +x core-linux-amd64
./core-linux-amd64 --version

View file

@ -13,14 +13,14 @@ jobs:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Setup Task
uses: arduino/setup-task@v2
- name: Install dependencies
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
@ -31,6 +31,9 @@ jobs:
task cli:build
echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Verify CLI
run: bin/core --version
- name: Run coverage
run: task cov
@ -40,7 +43,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage report
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.txt

View file

@ -33,8 +33,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
check-latest: true
go-version-file: 'go.mod'
- name: Build CLI
env:
@ -45,10 +44,12 @@ jobs:
EXT=""
if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi
VERSION="dev-$(git rev-parse --short HEAD)"
go build -trimpath -ldflags="-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${VERSION}" -o core-${GOOS}-${GOARCH}${EXT} .
go build -trimpath \
-ldflags="-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${VERSION}" \
-o core-${GOOS}-${GOARCH}${EXT} .
- name: Upload artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v4
with:
name: core-${{ matrix.goos }}-${{ matrix.goarch }}
path: core-*
@ -65,8 +66,11 @@ jobs:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts/
- name: Generate checksums
run: |
cd artifacts
sha256sum core-* > CHECKSUMS.txt
cat CHECKSUMS.txt
- name: Delete existing dev release
env:
@ -79,13 +83,12 @@ jobs:
- name: Create dev release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ github.sha }}
run: |
gh release create dev \
--title "Development Build" \
--notes "Latest development build from the dev branch.
**Commit:** ${COMMIT_SHA}
**Commit:** ${{ github.sha }}
**Built:** $(date -u +'%Y-%m-%d %H:%M:%S UTC')
This is a pre-release for testing. Use tagged releases for production." \

View file

@ -33,27 +33,23 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
check-latest: true
- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
go-version-file: 'go.mod'
- name: Build CLI
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: '0'
VERSION: ${{ github.ref_name }}
run: |
EXT=""
if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi
go build -trimpath \
-ldflags="-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${{ steps.version.outputs.VERSION }}" \
-ldflags="-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${VERSION}" \
-o core-${GOOS}-${GOARCH}${EXT} .
- name: Upload artifact
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v4
with:
name: core-${{ matrix.goos }}-${{ matrix.goarch }}
path: core-*
@ -73,14 +69,14 @@ jobs:
- name: Generate checksums
run: |
cd artifacts
sha256sum core-* > checksums.txt
cat checksums.txt
sha256sum core-* > CHECKSUMS.txt
cat CHECKSUMS.txt
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.ref_name }} \
--title "${{ github.ref_name }}" \
--title "Release ${{ github.ref_name }}" \
--generate-notes \
artifacts/*