-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
134 lines (116 loc) · 4.61 KB
/
Copy pathbase-test.yml
File metadata and controls
134 lines (116 loc) · 4.61 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
127
128
129
130
131
132
133
134
name: Base Tests
on:
workflow_call:
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos]
env:
# Reduce GC frequency (default 100) to speed up builds/tests at cost of higher memory
GOGC: "400"
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
fetch-depth: 1
- name: Use mise to install dependencies
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
version: 2026.5.12
env:
# Adding token here to reduce the likelihood of hitting rate limit issues.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
shell: bash
- name: Go Build Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-amd64
restore-keys: |
${{ runner.os }}-go-build-
- name: Go Mod Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}-${{ matrix.os }}-amd64
restore-keys: |
${{ runner.os }}-go-mod-
- name: Terragrunt Provider Cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v5
with:
path: ${{ runner.os == 'Linux' && '~/.cache/terragrunt' || '~/Library/Caches/terragrunt' }}
key: ${{ runner.os }}-terragrunt-provider-cache-${{ hashFiles('**/.terraform.lock.hcl') }}
restore-keys: |
${{ runner.os }}-terragrunt-provider-cache-
- name: Run Tests
id: run-tests
run: ./.github/scripts/coverage/coverage-report.sh run .
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TMPDIR: ${{ matrix.os == 'macos' && '/tmp' || '' }}
- name: Generate Coverage Summary
if: always() && matrix.os == 'ubuntu'
run: ./.github/scripts/coverage/coverage-report.sh summary
shell: bash
- name: Extract Timing Summary
if: always() && matrix.os == 'ubuntu'
run: ./.github/scripts/coverage/coverage-report.sh timing test-events.ndjson timing-summary.json
shell: bash
- name: Upload test-events.ndjson
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-events.ndjson
path: test-events.ndjson
retention-days: 7
- name: Upload timing-summary.json
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: timing-summary.json
path: timing-summary.json
retention-days: 30
- name: Upload coverage.out
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage.out
path: coverage.out
retention-days: 30
- name: Upload coverage-summary.json
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-summary.json
path: coverage-summary.json
retention-days: 30
- name: Upload coverage-summary.html
if: always() && matrix.os == 'ubuntu'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage-summary.html
path: coverage-summary.html
retention-days: 30
- name: Upload Report (${{ matrix.os }})
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-report-${{ matrix.os }}
path: result.xml
- name: Display Test Results (${{ matrix.os }})
uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6
if: always()
with:
report_paths: result.xml
detailed_summary: 'true'
include_time_in_summary: 'true'
group_suite: 'true'