- Build (main, develop): vet and unit tests, then a linux/amd64 and linux/arm64 image build without pushing - Publish (version branches): same tests, then build and push both platforms - Integration tests (manual): run the testcontainers suite
49 lines
1.1 KiB
YAML
49 lines
1.1 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- develop
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
- name: Generate templ components
|
|
run: go tool templ generate
|
|
- name: Vet
|
|
run: go vet ./...
|
|
- name: Unit tests
|
|
run: go test -race ./...
|
|
|
|
docker:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
with:
|
|
config-inline: |
|
|
[registry."gitea.sanplex.xyz/sansan"]
|
|
http = true
|
|
insecure = true
|
|
- name: Login to Gitea
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.sanplex.xyz
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.TOKEN }}
|
|
- name: Build
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: false
|