-
Notifications
You must be signed in to change notification settings - Fork 9
88 lines (79 loc) · 2.87 KB
/
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: GoLang Tests
on:
schedule:
- cron: "*/6 * * * *"
pull_request:
branches: [main]
workflow_dispatch:
inputs:
# trunk-ignore(checkov/CKV_GHA_7)
cli-version:
type: string
required: false
description:
The version of `analytics-cli` to use. Defaults to the latest specified in
`analytis-uploader`.
jobs:
test:
runs-on: public-amd64-small
steps:
- uses: actions/checkout@v4
- name: Setup Go Action
uses: actions/setup-go@v5
with:
go-version: 1.22.5
- name: Install dependencies
run: |
go install github.com/jstemmer/go-junit-report/v2@latest
go install gotest.tools/gotestsum@latest
- name: Run tests with go-junit-report
shell: bash
run: GORUNNER=NONE go test -v 2>&1 | go-junit-report -out go-junit-report_test.xml
working-directory: go/src
continue-on-error: true
- name: Upload test results
if: ${{ always() }}
uses: ./.github/actions/analytics-uploader-wrapper
with:
token-staging: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
token-prod: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
token-dev: ${{ secrets.TRUNK_DEV_ORG_API_TOKEN }}
token-dev2: ${{ secrets.TRUNK_DEV2_ORG_API_TOKEN }}
token-dev3: ${{ secrets.TRUNK_DEV3_ORG_API_TOKEN }}
token-dev4: ${{ secrets.TRUNK_DEV4_ORG_API_TOKEN }}
cli-version: ${{ inputs.cli-version }}
junit-paths: "**/go-junit-report_test.xml"
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: gotest-results
path: "**/go-junit-report_test.xml"
retention-days: 5
- name: Run tests with gotestsum
if: ${{ always() }}
shell: bash
env:
GORUNNER: GOTESTSUM
# we pass in env GORUNNER so that a unique retry file will be created
run: gotestsum --rerun-fails=3 --junitfile gotestsum_test.xml
working-directory: go/src
- name: Upload test results
if: ${{ always() }}
uses: ./.github/actions/analytics-uploader-wrapper
with:
token-staging: ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
token-prod: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
token-dev: ${{ secrets.TRUNK_DEV_ORG_API_TOKEN }}
token-dev2: ${{ secrets.TRUNK_DEV2_ORG_API_TOKEN }}
token-dev3: ${{ secrets.TRUNK_DEV3_ORG_API_TOKEN }}
token-dev4: ${{ secrets.TRUNK_DEV4_ORG_API_TOKEN }}
cli-version: ${{ inputs.cli-version }}
junit-paths: "**/gotestsum_test.xml"
- name: Upload artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: gotestsum-results
path: "**/gotestsum_test.xml"
retention-days: 5