This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
159 lines (132 loc) · 5.11 KB
/
test.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
154
155
156
157
158
159
name: Test and release
on:
push:
jobs:
test-and-build:
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Setup GenGo
run: go install k8s.io/code-generator/cmd/deepcopy-gen@latest
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
run: "make build" # todo: change to make build?
- name: Check Helm Chart
run: "make helm"
- name: Test
run: "make coverage"
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: binary
path: .build/volume-syncing-controller
test-e2e:
runs-on: ubuntu-20.04
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.8.1
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup rclone
run: "docker build . -f github-actions.rclone.Dockerfile -t rclone:current > /dev/null; docker create --name rclone rclone:current > /dev/null; sudo docker cp rclone:/usr/local/bin/rclone /usr/bin/rclone"
- name: Download k3d binary
run: "sudo wget https://github.com/k3d-io/k3d/releases/download/v5.4.3/k3d-linux-amd64 -O /usr/bin/k3d; sudo chmod +x /usr/bin/k3d"
- name: Run E2E tests
run: "make setup_e2e test_k8s minio test"
release-binary:
runs-on: ubuntu-20.04
needs: ["test-and-build", "test-e2e"]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
name: binary
path: .build/
- name: Release binaries to GitHub releases
uses: softprops/action-gh-release@v1
with:
files: |
.build/volume-syncing-controller
release-docker:
runs-on: ubuntu-20.04
needs: ["test-and-build"]
if: contains(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: binary
path: .build/
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create docker tags
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/riotkit-org/volume-syncing-controller
- name: Build and relase docker
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release-chart:
runs-on: ubuntu-latest
needs: ["release-docker"]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Generate README
run: make helm-docs
- name: Publish Helm chart
uses: stefanprodan/helm-gh-pages@master
with:
token: "${{ secrets.GH_RW_TOKEN }}"
charts_dir: helm
charts_url: https://riotkit-org.github.io/helm-of-revolution
owner: riotkit-org
repository: helm-of-revolution
branch: gh-pages
target_dir: ./
commit_username: "${{ env.GITHUB_ACTOR }}"
commit_email: "${{ env.GITHUB_ACTOR }}@users.noreply.github.com"
app_version: "${{github.ref_name}}"
chart_version: "${{github.ref_name}}"