- commit
- e924593
- parent
- 43a7a51
- author
- Mac Chaffee
- date
- 2024-12-30 22:14:36 -0500 EST
fix(gha): only push images on merge/release (#180)
3 files changed,
+38,
-16
+21,
-0
1@@ -0,0 +1,21 @@
2+name: Lint and run tests
3+
4+description: Lints and runs tests on the codebase, used before builds and on every PR
5+
6+runs:
7+ using: composite
8+ steps:
9+ - name: Set up Go
10+ uses: actions/setup-go@v3
11+ with:
12+ go-version: 1.23
13+ - name: Lint the codebase
14+ uses: golangci/golangci-lint-action@v3
15+ with:
16+ version: latest
17+ args: -E goimports -E godot --timeout 10m
18+ - name: Run tests
19+ shell: bash
20+ run: |
21+ PICO_SECRET="danger" go test -v ./... -cover -race -coverprofile=coverage.out
22+ go tool cover -func=coverage.out -o=coverage.out
+2,
-16
1@@ -7,9 +7,6 @@ on:
2 - main
3 tags:
4 - v*
5- pull_request:
6- branches:
7- - main
8
9 env:
10 REGISTRY: ghcr.io
11@@ -21,21 +18,10 @@ jobs:
12 test:
13 runs-on: ubuntu-22.04
14 steps:
15- - name: Set up Go
16- uses: actions/setup-go@v3
17- with:
18- go-version: 1.23
19 - name: Checkout repo
20 uses: actions/checkout@v3
21- - name: Lint the codebase
22- uses: golangci/golangci-lint-action@v3
23- with:
24- version: latest
25- args: -E goimports -E godot --timeout 10m
26- - name: Run tests
27- run: |
28- PICO_SECRET="danger" go test -v ./... -cover -race -coverprofile=coverage.out
29- go tool cover -func=coverage.out -o=coverage.out
30+ - name: Run tests and lint
31+ uses: ./.github/actions/test
32 build-main:
33 runs-on: ubuntu-22.04
34 needs: test
+15,
-0
1@@ -0,0 +1,15 @@
2+name: Test PRs
3+
4+on:
5+ pull_request:
6+ branches:
7+ - main
8+
9+jobs:
10+ test:
11+ runs-on: ubuntu-22.04
12+ steps:
13+ - name: Checkout repo
14+ uses: actions/checkout@v3
15+ - name: Run tests and lint
16+ uses: ./.github/actions/test