forked from rancher/backup-restore-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (122 loc) · 4.01 KB
/
ci.yaml
File metadata and controls
125 lines (122 loc) · 4.01 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
name: Backup Restore CI
permissions:
contents: read
on:
workflow_call:
push:
branches:
- main
- release/v[0-9]+.(0|x)
- release/v[0-9]+.[0-9]+.[0-9]+
paths-ignore:
- 'docs/**'
- '*.md'
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '.gitignore'
- 'CODEOWNERS'
- 'LICENSE'
jobs:
workspace-sync:
name: workspace sync check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.25
- name: Check go.work.sum is in sync
run: |
go work sync
git diff --exit-code go.work.sum || (echo "go.work.sum is out of sync — run 'make tidy' and commit the result" && exit 1)
golangci:
name: lint (${{ matrix.module }})
runs-on: ubuntu-latest
strategy:
matrix:
module:
- .
- cmd/tool
- tests
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.25
- name: golangci-lint (${{ matrix.module }})
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
with:
working-directory: ${{ matrix.module }}
build:
name: CI Build
strategy:
matrix:
arch:
- x64
- arm64
runs-on: runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Install go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.25
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Install helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Helm-unittest
run: helm plugin install --verify=false https://github.com/helm-unittest/helm-unittest
- name: CI
run: make ci
test:
name: integration-test
runs-on: runs-on,image=ubuntu22-full-${{ matrix.arch }},runner=4cpu-linux-${{ matrix.arch }},run-id=${{ github.run_id }}
strategy:
matrix:
arch:
- x64
- arm64
K3S_VERSION:
- v1.33.8-k3s1
- v1.35.1-k3s1
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install go
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version: 1.25
- name: Install helm
uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Helm-unittest
run: helm plugin install --verify=false https://github.com/quintush/helm-unittest
- name: Setup helm charts
run: ./scripts/package-helm
- name: Debug
run: ls -R ./dist/artifacts
- name: Install k3d
run: ./.github/workflows/scripts/install-k3d.sh
- name: Setup test environment
run: |
CLUSTER_NAME=backup-restore K3S_VERSION=${{ matrix.K3S_VERSION }} ./scripts/testenv
k3d kubeconfig get backup-restore > kubeconfig.yaml
- name: Debug kubeconfig
run: cat kubeconfig.yaml
- name: Run e2e tests
run: |
cd e2e && KUBECONFIG=$KUBECONFIG CHART_NAMESPACE=cattle-resources-system go test -v -timeout 10m -count=1 ./...
env:
KUBECONFIG: ${{ github.workspace }}/kubeconfig.yaml