Skip to content

Commit ff88f6b

Browse files
committed
Add CI/CD workflow for testing and building API Users
1 parent f9ade06 commit ff88f6b

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/cicd.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,59 @@ jobs:
116116
with:
117117
name: scraper_lambda
118118
path: ./scraper/scraper_lambda.zip
119+
120+
test-and-build-api-users:
121+
name: Test and Build API Users
122+
runs-on: ubuntu-latest
123+
steps:
124+
- name: Checkout code
125+
uses: actions/checkout@v4
126+
127+
- name: Set up Go
128+
uses: actions/setup-go@v2
129+
with:
130+
go-version: '1.22.4'
131+
132+
- name: Cache dependencies
133+
uses: actions/cache@v2
134+
with:
135+
path: ~/go/pkg/mod
136+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
137+
restore-keys: |
138+
${{ runner.os }}-go-
139+
140+
- name: Install dependencies
141+
working-directory: ./api-users
142+
run: go mod download
143+
144+
- name: Run golangci-lint
145+
uses: golangci/golangci-lint-action@v6.0.1
146+
with:
147+
working-directory: .
148+
args: --out-format colored-line-number ./api-users/...
149+
150+
- name: Run tests
151+
working-directory: ./api-users
152+
run: go test -coverprofile=coverage.out ./...
153+
154+
- name: Upload coverage to codecov
155+
uses: codecov/codecov-action@v2
156+
with:
157+
token: ${{ secrets.CODECOV_TOKEN }}
158+
159+
- name: Build API Users binary
160+
working-directory: ./api-users
161+
run: GOOS=linux GOARCH=amd64 go build -o bootstrap main.go
162+
163+
- name: Zip API Users binary
164+
working-directory: ./api-users
165+
run: zip api_users_lambda.zip bootstrap
166+
167+
- name: Upload API Users artifact
168+
uses: actions/upload-artifact@v2
169+
with:
170+
name: api_users_lambda
171+
path: ./api-users/api_users_lambda.zip
119172

120173
deploy:
121174
name: Deploy
@@ -137,6 +190,12 @@ jobs:
137190
name: scraper_lambda
138191
path: ./terraform
139192

193+
- name: Download API Users artifact
194+
uses: actions/download-artifact@v2
195+
with:
196+
name: api_users_lambda
197+
path: ./terraform
198+
140199
- name: Set up Terraform
141200
uses: hashicorp/setup-terraform@v1
142201

0 commit comments

Comments
 (0)