22
33on :
44 push :
5-
5+ branches :
6+ - main
7+ pull_request :
68 workflow_dispatch :
79
810permissions :
@@ -28,10 +30,10 @@ jobs:
2830 runs-on : ubuntu-latest
2931 steps :
3032 - name : Checkout
31- uses : actions/checkout@v6
33+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6
3234
3335 - name : Setup Go
34- uses : actions/setup-go@v6
36+ uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v6
3537 with :
3638 go-version : " ~1.24"
3739
@@ -42,14 +44,60 @@ jobs:
4244 runs-on : ubuntu-latest
4345 steps :
4446 - name : Checkout
45- uses : actions/checkout@v6
47+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6
4648
4749 - name : Setup Go
48- uses : actions/setup-go@v5
50+ uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v6
4951 with :
5052 go-version : " ~1.24"
5153
5254 - name : golangci-lint
53- uses : golangci/golangci-lint-action@v9
55+ uses : golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9
5456 with :
5557 version : v2.1.6
58+
59+ integration-test :
60+ runs-on : ubuntu-latest
61+ timeout-minutes : 30
62+ steps :
63+ - name : Checkout
64+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v6
65+
66+ - name : Setup Go
67+ uses : actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v6
68+ with :
69+ go-version : " ~1.24"
70+
71+ - name : Create KinD cluster
72+ uses : helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0
73+ with :
74+ cluster_name : integration-test
75+
76+ - name : Run integration tests
77+ run : go test -tags=integration -v -timeout=8m ./...
78+
79+ required :
80+ runs-on : ubuntu-latest
81+ needs :
82+ - test
83+ - lint
84+ - integration-test
85+ # Allow this job to run even if the needed jobs fail, are skipped or
86+ # cancelled.
87+ if : always()
88+ steps :
89+ - name : Ensure required checks
90+ run : |
91+ echo "Checking required checks"
92+ echo "- test: ${{ needs.test.result }}"
93+ echo "- lint: ${{ needs.lint.result }}"
94+ echo "- integration-test: ${{ needs.integration-test.result }}"
95+ echo
96+
97+ # We allow skipped jobs to pass, but not failed or cancelled jobs.
98+ if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" || "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
99+ echo "One of the required checks has failed or has been cancelled"
100+ exit 1
101+ fi
102+
103+ echo "Required checks have passed"
0 commit comments