Skip to content

Commit d341307

Browse files
committed
feat(workflows): Update refactor test automation to avoid setup/checkout redundancy
1 parent a5e7d41 commit d341307

File tree

1 file changed

+16
-38
lines changed

1 file changed

+16
-38
lines changed

.github/workflows/test.yml

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
test:
10+
test-and-lint:
1111
runs-on: ubuntu-latest
12-
defaults:
13-
run:
14-
working-directory: services/bounty-service
1512

1613
steps:
1714
- name: Checkout code
@@ -20,48 +17,29 @@ jobs:
2017
- name: Set up Go
2118
uses: actions/setup-go@v4
2219
with:
23-
go-version: '1.21.x'
24-
cache-dependency-path: services/bounty-service/go.sum
20+
go-version: '1.24.3'
21+
22+
- name: Cache Go modules
23+
uses: actions/cache@v3
24+
continue-on-error: true
25+
with:
26+
path: |
27+
~/go/pkg/mod
28+
~/.cache/go-build
29+
key: ${{ runner.os }}-go-${{ hashFiles('services/bounty-service/go.sum') }}
30+
restore-keys: |
31+
${{ runner.os }}-go-
2532
2633
- name: Download dependencies
34+
working-directory: services/bounty-service
2735
run: go mod download
2836

2937
- name: Run tests
30-
run: go test -v ./...
31-
32-
- name: Run tests with coverage
33-
run: |
34-
go test -v -coverprofile=coverage.out ./...
35-
mv coverage.out ${{ github.workspace }}/coverage.out
36-
37-
- name: Upload coverage to Codecov
38-
uses: codecov/codecov-action@v4
39-
with:
40-
file: ./coverage.out
41-
flags: unittests
42-
name: codecov-umbrella
43-
44-
lint:
45-
runs-on: ubuntu-latest
46-
defaults:
47-
run:
4838
working-directory: services/bounty-service
49-
50-
steps:
51-
- name: Checkout code
52-
uses: actions/checkout@v4
53-
54-
- name: Set up Go
55-
uses: actions/setup-go@v4
56-
with:
57-
go-version: '1.21.x'
58-
cache-dependency-path: services/bounty-service/go.sum
59-
60-
- name: Download dependencies
61-
run: go mod download
39+
run: go test -v ./...
6240

6341
- name: Run golangci-lint
64-
uses: golangci/golangci-lint-action@v4
42+
uses: golangci/golangci-lint-action@v3
6543
with:
6644
version: latest
6745
working-directory: services/bounty-service

0 commit comments

Comments
 (0)