Add .deb packaging, GitHub Actions CI/CD, and release workflows
CI / test (push) Failing after 17m30s
CI / test (push) Failing after 17m30s
- Makefile: add 'deb' and 'release' targets; fix migrate/create syntax - scripts/build-deb.sh: build .deb with systemd unit, postinst/prerm/postrm - .github/workflows/ci.yml: go build, test, lint on PR/push to main - .github/workflows/release.yml: multi-platform build (linux/darwin/windows × amd64/arm64), .deb for Linux, tarballs, draft GitHub Release on tag v* - README.md: add CI/Release badges, Install section with .deb and binary release instructions
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/frontend/package-lock.json
|
||||
|
||||
- name: Install frontend deps
|
||||
run: cd web/frontend && npm ci
|
||||
|
||||
- name: Build frontend
|
||||
run: cd web/frontend && npm run build
|
||||
|
||||
- name: Download Go deps
|
||||
run: go mod download
|
||||
|
||||
- name: Build
|
||||
run: go build ./...
|
||||
|
||||
- name: Vet
|
||||
run: go vet ./...
|
||||
|
||||
- name: Test
|
||||
run: go test -race -coverprofile=coverage.out ./...
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
|
||||
$(go env GOPATH)/bin/golangci-lint run ./...
|
||||
|
||||
- name: Upload coverage
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: coverage
|
||||
path: coverage.out
|
||||
@@ -0,0 +1,126 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
|
||||
concurrency:
|
||||
group: release
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- goos: linux
|
||||
goarch: amd64
|
||||
deb: true
|
||||
- goos: linux
|
||||
goarch: arm64
|
||||
deb: true
|
||||
- goos: darwin
|
||||
goarch: amd64
|
||||
deb: false
|
||||
- goos: darwin
|
||||
goarch: arm64
|
||||
deb: false
|
||||
- goos: windows
|
||||
goarch: amd64
|
||||
deb: false
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.23'
|
||||
cache: true
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: web/frontend/package-lock.json
|
||||
|
||||
- name: Install frontend deps
|
||||
run: cd web/frontend && npm ci
|
||||
|
||||
- name: Build frontend
|
||||
run: cd web/frontend && npm run build
|
||||
|
||||
- name: Build binary
|
||||
env:
|
||||
GOOS: ${{ matrix.goos }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
mkdir -p dist
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
go build -ldflags="-s -w -X main.Version=${VERSION}" \
|
||||
-o "dist/llamalink-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goos == 'windows' && '.exe' || '' }}" \
|
||||
./cmd/llamalink
|
||||
|
||||
- name: Build .deb (Linux only)
|
||||
if: matrix.deb
|
||||
env:
|
||||
DEB_ARCH: ${{ matrix.goarch }}
|
||||
run: |
|
||||
sudo apt-get update -qq && sudo apt-get install -y -qq dpkg fakeroot
|
||||
./scripts/build-deb.sh "${GITHUB_REF_NAME#v}" "${{ matrix.goarch }}"
|
||||
|
||||
- name: Package artifacts
|
||||
run: |
|
||||
cd dist
|
||||
EXT=""
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then EXT=".zip"; fi
|
||||
if [ "${{ matrix.goos }}" = "windows" ]; then
|
||||
zip "llamalink-${{ matrix.goos }}-${{ matrix.goarch }}.zip" \
|
||||
"llamalink-${{ matrix.goos }}-${{ matrix.goarch }}.exe"
|
||||
else
|
||||
tar -czf "llamalink-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz" \
|
||||
"llamalink-${{ matrix.goos }}-${{ matrix.goarch }}"
|
||||
if [ "${{ matrix.deb }}" = "true" ]; then
|
||||
cp *.deb "llamalink-${{ matrix.goos }}-${{ matrix.goarch }}.deb"
|
||||
fi
|
||||
fi
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: llamalink-${{ matrix.goos }}-${{ matrix.goarch }}
|
||||
path: dist/*
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
pattern: llamalink-*
|
||||
|
||||
- name: Merge artifacts
|
||||
run: |
|
||||
mkdir -p release
|
||||
cp artifacts/*/* release/
|
||||
|
||||
- name: List artifacts
|
||||
run: ls -lh release/
|
||||
|
||||
- name: Create checksums
|
||||
run: |
|
||||
cd release
|
||||
sha256sum * > llamalink_checksums.txt
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
name: ${{ github.ref_name }}
|
||||
draft: true
|
||||
prerelease: ${{ contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc') }}
|
||||
generate_release_notes: true
|
||||
files: release/*
|
||||
Reference in New Issue
Block a user