-
Notifications
You must be signed in to change notification settings - Fork 5k
61 lines (56 loc) · 1.88 KB
/
unit-test.yaml
File metadata and controls
61 lines (56 loc) · 1.88 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
---
name: Unit Tests
permissions:
contents: read
pull-requests: read
on:
pull_request:
types: ['opened', 'synchronize']
paths:
- '.github/workflows/unit-test.yaml'
- 'go.sum'
- 'vendor/**'
- '**.go'
# Run this workflow on merges that change go.sum on the default branch. The
# intention is to save a new Go module dependency cache for the default
# branch. This cache is then available to all workflow runs.
#
# Reference: https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching?search-overlay-input=github+action+cache+limit+increase&search-overlay-ask-ai=true#restrictions-for-accessing-a-cache
push:
branches:
- main
paths:
- '.github/workflows/unit-test.yaml'
- 'go.sum'
concurrency:
group: 'unit-${{ github.head_ref }}'
cancel-in-progress: true
jobs:
test:
runs-on: custom-linux-large
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
with:
go-version-file: ./.go-version
- run: bash scripts/gogetcookie.sh
- run: make test
env:
GITHUB_ACTIONS_STAGE: "UNIT_TESTS"
- name: Guidance on failure
if: failure()
run: |
echo "::error::Unit Tests failed."
echo ""
echo "Run 'make test' locally to reproduce and fix the failing tests."
echo "If you have added a new resource or data source, ensure you have added"
echo "the corresponding unit tests. Check the test output above for details"
echo "on which tests failed and why."
save-artifacts-on-fail:
needs: test
if: ${{ failure() }}
uses: ./.github/workflows/save-artifacts.yaml
comment-on-fail:
needs: test
if: ${{ failure() }}
uses: ./.github/workflows/comment-failure.yaml