-
Notifications
You must be signed in to change notification settings - Fork 3
70 lines (70 loc) · 2.61 KB
/
tests-go.yaml
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
name: 'Tests (Golang)'
on:
push:
branches:
- main
paths:
- '.github/workflows/tests-go.yaml'
- 'gen/go/**'
- 'go.*'
- 'services/api-gateway/**'
- 'services/dashboard-backend/**'
- 'shared/go/**'
pull_request:
branches:
- main
paths:
- 'gen/go/**'
- 'go.*'
- 'services/api-gateway/**'
- 'services/dashboard-backend/**'
- 'shared/go/**'
env:
GCP_OIDC_PROVIDER_NAME: github-provider
GCP_PROJECT_ID: basemind-ai-development
GCP_PROJECT_NUMBER: 78794879644
GCP_SERVICE_ACCOUNT_NAME: firebase-adminsdk-frgvx
GCP_WORKLOAD_IDENTITY_POOL: dev-pool
TEST_SLEEP_TIMEOUT: 1s
DEEPSOURCE_DSN: ${{secrets.DEEPSOURCE_DSN}}
jobs:
test:
if: github.ref_name != 'development' && github.ref_name != 'production'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Golang
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Download the DeepSource CLI
run: curl https://deepsource.io/cli | sh
- name: Load cached Golang dependencies
id: cached-go-dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: go-${{ inputs.go_version }}-v1.0-${{ hashFiles('**/go.sum') }}
- name: Install Golang dependencies
if: steps.cached-go-dependencies.outputs.cache-hit != 'true'
shell: bash
run: go get -v -t ./...
- name: Install Atlas
shell: bash
run: curl -sSf https://atlasgo.sh | sh
- name: Authenticate with GCP
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/${{env.GCP_PROJECT_NUMBER}}/locations/global/workloadIdentityPools/${{env.GCP_WORKLOAD_IDENTITY_POOL}}/providers/${{env.GCP_OIDC_PROVIDER_NAME}}
service_account: ${{env.GCP_SERVICE_ACCOUNT_NAME}}@${{env.GCP_PROJECT_ID}}.iam.gserviceaccount.com
- name: Test
run: go test ./... -v -p 1 -coverprofile=cover.out
- name: Upload Coverage Report
run: ./bin/deepsource report --analyzer test-coverage --key go --value-file ./cover.out