-
Notifications
You must be signed in to change notification settings - Fork 31
129 lines (118 loc) · 3.91 KB
/
ci.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
name: CI
on:
workflow_dispatch:
push:
branches:
- v2
pull_request:
branches:
- v2
types:
- assigned
- opened
- synchronize
- reopened
env:
KIND_VERSION: "0.12.0"
KUBECTL_VERSION: "1.22.0"
jobs:
Validate:
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
fetch-depth: 0
- name: Set Golang
uses: actions/setup-go@v4
with:
go-version: 1.21.9
- name: Set Golangci-lint
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
- name: Set Shellcheck
run: sudo apt-get -qq update && sudo apt-get install -y shellcheck
- name: Verify scripts
run: |
shellcheck test/*.sh
- name: Build
run: make build
- name: Lint
run: make test-style
- name: Test
run: make test
Build:
runs-on: ubuntu-20.04
steps:
- name: Checkout Code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
fetch-depth: 0
- name: Set Golang
uses: actions/setup-go@v4
with:
go-version: 1.21.9
- name: Build
run: make build
- uses: actions/upload-artifact@v4
with:
name: charts-syncer-binary
path: dist/charts-syncer
Integration:
needs: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
with:
fetch-depth: 0
- name: Get Harbor Local IP
run: |
echo "HARBOR_IP=$(hostname -I | cut -d" " -f1)" >> $GITHUB_ENV
- uses: actions/download-artifact@v4
with:
name: charts-syncer-binary
path: /tmp/dist
- name: Install Kind
run: |
curl -LO https://github.com/kubernetes-sigs/kind/releases/download/v${KIND_VERSION}/kind-Linux-amd64
chmod +x kind-Linux-amd64
sudo mv kind-Linux-amd64 /usr/local/bin/kind
- name: Create kind cluster
run: |
./test/kind-create-cluster.sh
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
- name: Set Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.12.1
- name: Run Registry
run: |
cd test/harbor
openssl genrsa -traditional -out private_key.pem 4096
openssl req -new -x509 -key private_key.pem -out root.crt -days 3650 -subj "/C=CN/ST=State/L=CN/O=organization/OU=organizational unit/CN=example.com/emailAddress=example@example.com"
cp private_key.pem config/core/private_key.pem
cp root.crt config/registry/root.crt
echo "HARBOR_IP=$HARBOR_IP" >> .env.github
docker compose --env-file .env.github config
docker compose --env-file .env.github up -d
- name: Install Kubectl
run: |
curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin
- name: Install wait-for-port
run: |
curl -LO https://github.com/bitnami/wait-for-port/releases/download/v1.0/wait-for-port.zip
unzip wait-for-port.zip
chmod +x wait-for-port
sudo mv wait-for-port /usr/local/bin/
- name: Add bitnami Helm
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- run: |
chmod +x /tmp/dist/charts-syncer
./test/run-charts-syncer.sh
- run: ./test/install-ghost.sh
- run: ./test/wait-for-ghost-deployment.sh
- run: ./test/run-verifications.sh