Run tests in CI and build multi-arch Docker images
- 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
This commit is contained in:
1 parent
59dfff38bc
commit
bd250ecaee
3 files changed
+54
-68
No files matched your search
@@ -1,41 +1,50 @@
|
||||
|
||||
name: Publish
|
||||
|
||||
#on:
|
||||
# release:
|
||||
# types: [published]
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*.*'
|
||||
|
||||
jobs:
|
||||
# test:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - run: echo "The release ${{ gitea.ref }} ${{ gitea.ref_name }} was published"
|
||||
|
||||
publish:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: https://github.com/actions/checkout@v4
|
||||
- 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 ./...
|
||||
|
||||
publish:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3
|
||||
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@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.sanplex.xyz
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.TOKEN }}
|
||||
- name: Build and push Docker image
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: "gitea.sanplex.xyz/sansan/musicserver:${{gitea.ref_name}}, gitea.sanplex.xyz/sansan/musicserver:latest"
|
||||
tags: |
|
||||
gitea.sanplex.xyz/sansan/musicserver:${{ gitea.ref_name }}
|
||||
gitea.sanplex.xyz/sansan/musicserver:latest
|
||||
Reference in new issue
Block a user