Repository navigation
157 lines (134 loc) · 5.21 KB
/
Copy pathpresubmit-ci.yaml
File metadata and controls
157 lines (134 loc) · 5.21 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Results CI Presubmit Tests
on:
pull_request:
branches:
- main
- release-*
workflow_call:
inputs:
skip-ci-summary:
description: >-
When true the ci-summary job is skipped. Callers that need to
report their own "CI summary" check (to satisfy branch protection
rules that expect the unprefixed name) should set this to true
and define the summary job themselves.
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
env:
SHELL: /bin/bash
GOPATH: ${{ github.workspace }}
GO111MODULE: on
KIND_CLUSTER_NAME: tekton-results
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
path: ${{ github.workspace }}/src/github.com/tektoncd/results
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
cache-dependency-path: src/github.com/tektoncd/results/go.sum
go-version-file: src/github.com/tektoncd/results/go.mod
- name: Install dependencies
run: |
go install github.com/jstemmer/go-junit-report@v0.9.1
mkdir -p "${ARTIFACTS:-/tmp/artifacts}"
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
- name: Run Unit Tests
working-directory: ${{ github.workspace }}/src/github.com/tektoncd/results
run: ./test/presubmit-tests.sh --unit-tests
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: ${{ github.workspace }}/src/github.com/tektoncd/results
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
cache-dependency-path: src/github.com/tektoncd/results/go.sum
go-version-file: src/github.com/tektoncd/results/go.mod
- name: Install dependencies (ko, kind, kubectl, go-junit-report)
run: |
echo '::group::install ko'
curl -L https://github.com/ko-build/ko/releases/download/v0.15.4/ko_0.15.4_Linux_x86_64.tar.gz | tar xzf - ko
chmod +x ./ko && sudo mv ko /usr/local/bin
echo '::endgroup::'
echo '::group::install kind'
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.24.0/kind-linux-amd64
chmod +x ./kind && sudo mv ./kind /usr/local/bin/kind
echo '::endgroup::'
echo '::group::install kubectl'
curl -LO "https://dl.k8s.io/release/$(curl -Ls https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
chmod +x kubectl && sudo mv kubectl /usr/local/bin/kubectl
echo '::endgroup::'
echo '::group::install go-junit-report'
go install github.com/jstemmer/go-junit-report@v0.9.1
echo '::endgroup::'
mkdir -p "${ARTIFACTS:-/tmp/artifacts}"
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
- name: Run Integration Tests
working-directory: ${{ github.workspace }}/src/github.com/tektoncd/results
run: ./test/presubmit-tests.sh --integration-tests
build-tests:
name: Build Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
path: ${{ github.workspace }}/src/github.com/tektoncd/results
persist-credentials: false
- name: Set up Go
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
cache-dependency-path: src/github.com/tektoncd/results/go.sum
go-version-file: src/github.com/tektoncd/results/go.mod
- name: Install dependencies (go-junit-report, go-licenses)
run: |
echo '::group::install go-junit-report'
go install github.com/jstemmer/go-junit-report@v0.9.1
echo '::endgroup::'
echo '::group::install go-licenses'
go install github.com/google/go-licenses@latest
echo '::endgroup::'
mkdir -p "${ARTIFACTS:-/tmp/artifacts}"
echo "${GOPATH}/bin" >> "$GITHUB_PATH"
- name: Run Build Tests
working-directory: ${{ github.workspace }}/src/github.com/tektoncd/results
run: ./test/presubmit-tests.sh --build-tests
ci-summary:
name: CI summary
if: ${{ always() && !inputs.skip-ci-summary }}
needs:
- unit-tests
- integration-tests
- build-tests
runs-on: ubuntu-latest
steps:
- name: Check job results
run: |
results=(${JOB_RESULTS})
for result in "${results[@]}"; do
if [[ "$result" != "success" && "$result" != "skipped" ]]; then
echo "One or more jobs failed or were cancelled"
exit 1
fi
done
echo "All jobs passed or were skipped"
env:
JOB_RESULTS: ${{ join(needs.*.result, ' ') }}