Add CI and release workflows
CI / test (push) Successful in 2m37s

This commit is contained in:
Veillax committed 2026-10-27 18:06:40 -06:00
1 parent 61143d107c
commit 8cfc568cb6
4 files changed
+202

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
name: CI
on:
push:
branches: [main, master]
pull_request:
jobs:
test:
runs-on: ubuntu-latest
env:
GOPRIVATE: git.veillax.com
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
# Go fetches the other sharks modules straight from this server. This is harmless
# for public repositories and is what makes private ones work.
- name: Let Go fetch modules from this server
run: git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@git.veillax.com/".insteadOf "https://git.veillax.com/"
- name: Formatting
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "These files need gofmt:"
echo "$unformatted"
exit 1
fi
- name: Vet
run: go vet ./...
- name: Test
run: go test $(go list ./... | grep -v /e2e)
# Catches platform-specific breakage before a release is tagged.
- name: Every release platform compiles
run: |
for t in linux/amd64 windows/amd64; do
for c in shark; do
echo "building $c for $t"
GOOS=${t%/*} GOARCH=${t#*/} CGO_ENABLED=0 go build -o /dev/null ./cmd/$c
done
done
+39
View File
@@ -0,0 +1,39 @@
name: Release
# Push a tag such as v0.2.0 to build and publish a release:
# git tag -a v0.2.0 -m "shark-expose v0.2.0" && git push origin v0.2.0
on:
push:
tags: ['v*']
jobs:
release:
runs-on: ubuntu-latest
env:
GOPRIVATE: git.veillax.com
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # release notes come from the history since the previous tag
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Let Go fetch modules from this server
run: git config --global url."https://x-access-token:${{ secrets.GITHUB_TOKEN }}@git.veillax.com/".insteadOf "https://git.veillax.com/"
- name: Test
run: |
go vet ./...
go test $(go list ./... | grep -v /e2e)
- name: Build release archives
run: sh deploy/build.sh "${GITHUB_REF_NAME}"
# Optional secret RELEASE_TOKEN: an access token that can write releases, for
# servers where the automatic job token can't.
- name: Publish the release
env:
TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
run: sh deploy/publish-release.sh "${GITHUB_REF_NAME}"