Skip to content

Commit ccdfbf9

Browse files
authored
Merge pull request #26 from base-org/ci-cd
Add CI/CD
2 parents 39cf8e7 + 3abf57b commit ccdfbf9

File tree

4 files changed

+86
-2
lines changed

4 files changed

+86
-2
lines changed

.github/workflows/docker.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Tag Docker image
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
tags:
8+
- 'v*'
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Log into the Container registry
22+
uses: docker/login-action@v3
23+
with:
24+
registry: ${{ env.REGISTRY }}
25+
username: ${{ github.actor }}
26+
password: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Extract metadata for the Docker image
29+
id: meta
30+
uses: docker/metadata-action@v4
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@v3
36+
37+
- name: Build and push the Docker image
38+
uses: docker/build-push-action@v4
39+
with:
40+
context: .
41+
push: true
42+
tags: ${{ steps.meta.outputs.tags }}
43+
labels: ${{ steps.meta.outputs.labels }}
44+
platforms: linux/amd64,linux/arm64

.github/workflows/pr.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
arch: [ linux/amd64, linux/arm64 ]
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v4
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: '>=1.21.0'
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
- name: Go Format
22+
run: make fmt && git diff --exit-code
23+
- name: Go Vet
24+
run: make vet
25+
- name: Go Tidy
26+
run: go mod tidy && git diff --exit-code
27+
- name: Go Mod
28+
run: go mod download
29+
- name: Go Mod Verify
30+
run: go mod verify
31+
- name: Go Test
32+
run: make test
33+
- name: Build Docker
34+
uses: docker/build-push-action@v5
35+
with:
36+
push: false

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,15 @@ integration:
2626
RUN_INTEGRATION_TESTS=true go test -v ./...
2727
.PHONY: integration
2828

29+
vet:
30+
go vet ./...
31+
.PHONY: vet
32+
2933
fmt:
3034
gofmt -s -w .
3135
.PHONY: fmt
3236

33-
check: fmt clean build build-docker lint test integration
37+
check: fmt vet clean build build-docker lint test integration
3438
.PHONY: check
3539

3640
lint:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/go-chi/chi/v5 v5.0.12
1010
github.com/minio/minio-go/v7 v7.0.66
1111
github.com/prometheus/client_golang v1.19.0
12+
github.com/rs/zerolog v1.32.0
1213
github.com/stretchr/testify v1.9.0
1314
github.com/urfave/cli/v2 v2.27.1
1415
)
@@ -77,7 +78,6 @@ require (
7778
github.com/rivo/uniseg v0.4.3 // indirect
7879
github.com/rogpeppe/go-internal v1.11.0 // indirect
7980
github.com/rs/xid v1.5.0 // indirect
80-
github.com/rs/zerolog v1.32.0 // indirect
8181
github.com/russross/blackfriday/v2 v2.1.0 // indirect
8282
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
8383
github.com/sirupsen/logrus v1.9.3 // indirect

0 commit comments

Comments
 (0)