refactor: rename workflows; update paths #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Server CI/CD | |
on: | |
push: | |
paths: | |
- 'build/server.dockerfile' | |
- 'cmd/server/**' | |
- 'internal/**' | |
- 'pkg/**' | |
- 'migrations/**' | |
- 'queries/**' | |
- 'web/**' | |
- '.github/workflows/server-main.yml' | |
branches: | |
- main | |
jobs: | |
test: | |
name: Run tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Setup protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
- name: Setup sqlc | |
uses: sqlc-dev/setup-sqlc@v3 | |
with: | |
sqlc-version: '1.26.0' | |
- name: Setup tools | |
run: | | |
go install go.uber.org/mock/mockgen@latest | |
go install google.golang.org/protobuf/cmd/[email protected] | |
go install google.golang.org/grpc/cmd/[email protected] | |
- name: Generate files | |
run: make generate | |
- name: Go test | |
run: go test ./... -race | |
docker: | |
name: Deliver | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
- name: Setup protoc | |
uses: arduino/setup-protoc@v1 | |
with: | |
version: '3.x' | |
- name: Setup sqlc | |
uses: sqlc-dev/setup-sqlc@v3 | |
with: | |
sqlc-version: '1.26.0' | |
- name: Setup tools | |
run: | | |
go install go.uber.org/mock/mockgen@latest | |
go install google.golang.org/protobuf/cmd/[email protected] | |
go install google.golang.org/grpc/cmd/[email protected] | |
- name: Generate files | |
run: make generate | |
- name: Login to GHCR | |
run: | | |
echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u flohansen --password-stdin | |
- name: Docker build | |
run: | | |
docker build -t ghcr.io/flohansen/dasher-server:latest -f build/server.dockerfile . | |
- name: Docker push | |
run: | | |
docker push ghcr.io/flohansen/dasher-server:latest |