- build.yml: CI on push/PR with Go 1.24.2, test-short via Makefile, Linux build, verify binary (go mod tidy to ensure clean sums for deps like lipgloss/bubbletea) - release.yml: on v* tags, cross build via make cross (with VERSION/COMMIT/DATE ldflags), prepare tar.gz + checksums (gralculator-*), conditional install scripts, create Gitea release via API (RELEASE_TOKEN), upload assets. Customized release notes for this TUI calculator project. - Very close structure, caching, tidy steps, asset prep, and release creation/upload logic to the reference projects. - Uses our existing Makefile cross target and internal/version ldflags. - No external ci-build.sh needed; leverages Makefile directly for simplicity.
69 lines
1.6 KiB
YAML
69 lines
1.6 KiB
YAML
name: CI
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ubuntu-gitea
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24.2'
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Download dependencies
|
|
run: go mod download
|
|
|
|
- name: Run tests (short)
|
|
run: |
|
|
go mod tidy
|
|
make test-short
|
|
# go mod tidy ensures go.sum is complete (fixes "missing go.sum entry" for deps during `go test`)
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-gitea
|
|
needs: [test]
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.24.2'
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Download dependencies
|
|
run: go mod download
|
|
|
|
- name: Linux Build
|
|
run: |
|
|
go mod tidy
|
|
make build
|
|
# go mod tidy ensures go.sum is fully populated for this Go version before the make build / go build
|
|
|
|
- name: Verify binary
|
|
run: |
|
|
./build/gralculator -v || true
|
|
ls -lh build/gralculator || true
|