-
Notifications
You must be signed in to change notification settings - Fork 157
154 lines (150 loc) · 4.84 KB
/
main.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
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
name: Build and test
permissions:
contents: read
on:
push:
branches:
- master
pull_request:
jobs:
## Make sure go.mod and go.sum files are up-to-date with the code
## TODO: make this fail if they're not up-to-date to inform the committer to udpate them
gomod:
runs-on: ubuntu-20.04
outputs:
gomod: ${{ steps.gomod.outputs.gomod }}
gosum: ${{ steps.gosum.outputs.gosum }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- run: make go-mod-tidy
- id: gomod
run: |
{
echo 'gomod<<FILE'
cat go.mod
echo
echo FILE
} >> "$GITHUB_OUTPUT"
- id: gosum
run: |
{
echo 'gosum<<FILE'
cat go.sum
echo
echo FILE
} >> "$GITHUB_OUTPUT"
lint:
runs-on: ubuntu-20.04
needs: gomod
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
## Sync go.mod and go.sum files from gomod job
- name: restore_gomod
run: echo "${{needs.gomod.outputs.gomod}}" > go.mod
- name: restore_gosum
run: echo "${{needs.gomod.outputs.gosum}}" > go.sum
- run: make golint
reno_lint:
runs-on: ubuntu-20.04
needs: gomod
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
fetch-depth: 0
- name: reset_git_extension
run: git config --unset-all extensions.worktreeconfig
- name: reno_lint
run: make reno-lint
## Reno lint does not catch some errors which make reno report fail
- name: reno_report_check
run: make reno-report
test:
runs-on: ubuntu-20.04
needs: gomod
strategy:
fail-fast: false
matrix:
testSuite: [test, integration-test, helm-test]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
## Sync go.mod and go.sum files from gomod job
- name: restore_gomod
run: echo "${{needs.gomod.outputs.gomod}}" > go.mod
- name: restore_gosum
run: echo "${{needs.gomod.outputs.gosum}}" > go.sum
- uses: helm/kind-action@0025e74a8c7512023d06dc019c617aa3cf561fde # v1.10.0
- run: |
make install-csi-hostpath-driver
make install-minio
if: matrix.testSuite == 'integration-test' || matrix.testSuite == 'helm-test'
# A test (CRDSuite) that runs as part of `make test` requies atleast one CRD to
# be present on the cluster. That's why we are only installing csi-hostpath-driver
# before running `make test`, to create some CRDs on the cluster.
- run: |
make install-csi-hostpath-driver
make install-minio
if: matrix.testSuite == 'test'
- run: make ${{ matrix.testSuite }}
build:
runs-on: ubuntu-20.04
needs: gomod
strategy:
matrix:
bin: [controller, kanctl, kando]
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
## Sync go.mod and go.sum files from gomod job
- name: restore_gomod
run: echo "${{needs.gomod.outputs.gomod}}" > go.mod
- name: restore_gosum
run: echo "${{needs.gomod.outputs.gosum}}" > go.sum
- run: make build BIN=${{ matrix.bin }} GOBORING=true
docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- run: make docs
release:
runs-on: ubuntu-20.04
needs: [lint, test, build, docs]
if: github.ref_name == 'master' || startsWith(github.ref, 'refs/tags')
permissions:
packages: write
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- run: make go-mod-tidy
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: sudo rm -rf /usr/share/dotnet
- run: sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- run: docker image prune -af
- run: docker builder prune -af
- run: make release-snapshot
- run: COMMIT_SHA=${{ github.sha }} ./build/push_images.sh
image_tags:
runs-on: ubuntu-latest
outputs:
tag_short: ${{ steps.image_tags.outputs.tag_short }}
tag_long: ${{ steps.image_tags.outputs.tag_long }}
steps:
- id: image_tags
env:
COMMIT_SHA: ${{ github.sha }}
run: |
echo "tag_short=short-commit-${COMMIT_SHA::12}" >> $GITHUB_OUTPUT
echo "tag_long=commit-${COMMIT_SHA}" >> $GITHUB_OUTPUT
release_example_docker_images:
needs: [release, image_tags]
permissions:
packages: write
contents: read
uses: ./.github/workflows/build_example_images.yaml
with:
image_tag: v9.99.9-dev
ref: ${{ github.ref }}
extra_tags: |
${{ needs.image_tags.outputs.tag_short }}
${{ needs.image_tags.outputs.tag_long }}