Skip to content

Commit 7e1f9b3

Browse files
committed
Modify pr-check job configurations
1 parent 73a3963 commit 7e1f9b3

2 files changed

Lines changed: 30 additions & 52 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Setup Go
2+
description: Sets up Go environment
3+
runs:
4+
using: "composite"
5+
steps:
6+
- uses: actions/setup-go@v6.1.0
7+
with:
8+
go-version-file: agent-manager-service/go.mod
Lines changed: 22 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Agent Manager Service PR Checks
1+
name: Agent Manager API PR Checks
22

33
on:
44
push:
@@ -16,37 +16,22 @@ jobs:
1616
lint:
1717
name: Lint
1818
runs-on: ubuntu-latest
19-
defaults:
20-
run:
21-
working-directory: ./agent-manager-service
2219
steps:
2320
- name: Checkout code
2421
uses: actions/checkout@v4
2522

2623
- name: Setup Go
27-
uses: actions/setup-go@v5
28-
with:
29-
go-version: "1.24.2"
30-
cache-dependency-path: agent-manager-service/go.sum
31-
32-
- name: Install golangci-lint
33-
run: |
34-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.1.0
35-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
36-
37-
- name: Install goimports
38-
run: go install golang.org/x/tools/cmd/goimports@latest
24+
uses: ./.github/actions/setup-go
3925

40-
- name: Run lint
41-
run: make lint
26+
- name: Run golangci-lint
27+
uses: golangci/golangci-lint-action@v6
28+
with:
29+
working-directory: agent-manager-service
30+
args: --config .github/linters/.golangci.yaml
4231

4332
test:
4433
name: Test
4534
runs-on: ubuntu-latest
46-
defaults:
47-
run:
48-
working-directory: ./agent-manager-service
49-
5035
services:
5136
postgres:
5237
image: postgres:15-alpine
@@ -67,12 +52,10 @@ jobs:
6752
uses: actions/checkout@v4
6853

6954
- name: Setup Go
70-
uses: actions/setup-go@v5
71-
with:
72-
go-version: "1.24.2"
73-
cache-dependency-path: agent-manager-service/go.sum
55+
uses: ./.github/actions/setup-go
7456

7557
- name: Create test .env file
58+
working-directory: ./agent-manager-service
7659
run: |
7760
cat > .env << 'EOF'
7861
DB_HOST=localhost
@@ -81,9 +64,6 @@ jobs:
8164
DB_PASSWORD=agentmanager
8265
DB_NAME=agentmanager
8366
SERVER_PORT=8080
84-
API_KEY_VALUE=test-key
85-
IS_LOCAL_DEV_ENV=true
86-
AMP_VERSION=v0.1.0-rc7
8767
EOF
8868
8969
- name: Wait for PostgreSQL
@@ -95,76 +75,66 @@ jobs:
9575
timeout-minutes: 2
9676

9777
- name: Run tests
78+
working-directory: ./agent-manager-service
9879
run: make test
9980

100-
- name: Upload test logs on failure
101-
if: failure()
102-
uses: actions/upload-artifact@v4
103-
with:
104-
name: test-logs
105-
path: agent-manager-service/localdata/test_output.log
106-
if-no-files-found: ignore
107-
10881
build:
10982
name: Build
11083
runs-on: ubuntu-latest
111-
defaults:
112-
run:
113-
working-directory: ./agent-manager-service
11484
steps:
11585
- name: Checkout code
11686
uses: actions/checkout@v4
11787

11888
- name: Setup Go
119-
uses: actions/setup-go@v5
120-
with:
121-
go-version: "1.24.2"
122-
cache-dependency-path: agent-manager-service/go.sum
89+
uses: ./.github/actions/setup-go
12390

12491
- name: Build
92+
working-directory: ./agent-manager-service
12593
run: go build -v ./...
12694

12795
codegen-format:
12896
name: Code Generation & Format Check
12997
runs-on: ubuntu-latest
130-
defaults:
131-
run:
132-
working-directory: ./agent-manager-service
13398
steps:
13499
- name: Checkout code
135100
uses: actions/checkout@v4
136101

137102
- name: Setup Go
138-
uses: actions/setup-go@v5
139-
with:
140-
go-version: "1.24.2"
141-
cache-dependency-path: agent-manager-service/go.sum
103+
uses: ./.github/actions/setup-go
142104

143105
- name: Install wire
144106
run: go install github.com/google/wire/cmd/wire@latest
145107

146108
- name: Install goimports
147109
run: go install golang.org/x/tools/cmd/goimports@latest
148110

111+
- name: Install moq
112+
run: go install github.com/matryer/moq@latest
113+
149114
- name: Run wire code generation
115+
working-directory: ./agent-manager-service
150116
run: make wire
151117

152118
- name: Run go generate
119+
working-directory: ./agent-manager-service
153120
run: make codegen
154121

155122
- name: Run formatting
123+
working-directory: ./agent-manager-service
156124
run: make fmt
157125

158126
- name: Run go mod tidy
127+
working-directory: ./agent-manager-service
159128
run: go mod tidy
160129

161130
- name: Check for uncommitted changes
131+
working-directory: ./agent-manager-service
162132
run: |
163133
if [ ! -z "$(git status --porcelain)" ]; then
164134
echo "Code generation or formatting produced changes:"
165135
git diff
166136
git status
167137
echo ""
168-
echo "Please run 'make wire && make codegen && make fmt && go mod tidy' locally and commit the changes."
138+
echo "Please run 'make codegenfmt-check' locally and commit the changes."
169139
exit 1
170140
fi

0 commit comments

Comments
 (0)