forked from wso2/agent-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent-manager-service-pr-checks.yaml
More file actions
126 lines (105 loc) · 3.21 KB
/
agent-manager-service-pr-checks.yaml
File metadata and controls
126 lines (105 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Agent Manager API
on:
pull_request:
branches: ["main"]
paths:
- "agent-manager-service/**"
- ".github/workflows/agent-manager-service-pr-checks.yaml"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
working-directory: agent-manager-service
args: --config .github/linters/.golangci.yaml
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: agentmanager
POSTGRES_PASSWORD: agentmanager
POSTGRES_DB: agentmanager
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Create test .env file
working-directory: ./agent-manager-service
run: |
cat > .env << EOF
DB_HOST=localhost
DB_PORT=5432
DB_USER=agentmanager
DB_PASSWORD=agentmanager
DB_NAME=agentmanager
SERVER_PORT=8080
JWT_SIGNING_ACTIVE_KEY_ID=key-1
JWT_SIGNING_PRIVATE_KEY_PATH=$(pwd)/keys/private.pem
JWT_SIGNING_PUBLIC_KEYS_CONFIG=$(pwd)/keys/public-keys-config.json
EOF
- name: Wait for PostgreSQL
run: |
until pg_isready -h localhost -p 5432 -U agentmanager; do
echo "Waiting for postgres..."
sleep 1
done
timeout-minutes: 2
- name: Run database migrations
working-directory: ./agent-manager-service
run: ENV_FILE_PATH=.env go run main.go --migrate --server=false
- name: Run tests
working-directory: ./agent-manager-service
run: make test
- name: Upload test logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-logs
path: agent-manager-service/localdata/test_output.log
retention-days: 7
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Build
working-directory: ./agent-manager-service
run: go build -v ./...
codegen-format:
name: Code Generation & Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Install wire
run: go install github.com/google/wire/cmd/wire@v0.7.0
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- name: Install moq
run: go install github.com/matryer/moq@v0.5.3
- name: Run code generation and format check
working-directory: ./agent-manager-service
run: make codegenfmt-check