-
Notifications
You must be signed in to change notification settings - Fork 7
169 lines (169 loc) · 5.87 KB
/
ci.yml
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
160
161
162
163
164
165
166
167
168
169
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
container: golangci/golangci-lint:v1.59.0
steps:
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/checkout@v2
- run: make install-changelog BIN_PATH=/usr/local/bin
- run: |
# Required to avoid error 'fatal: detected dubious ownership in repository at' while calling
# 'git status --porcelain'.
git config --global --add safe.directory /__w/libflexkube/libflexkube
make build build-test test-update-linters lint test-tidy test-changelog
test:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.22'
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/checkout@v2
with:
# Required for Codecov report uploading.
fetch-depth: 0
- name: Install required binaries
run: |
docker-compose -f e2e/docker-compose.yml up generate-secrets
sudo chown $(whoami): ./e2e/secrets/*
docker-compose -f e2e/docker-compose.yml up -d
make install-cc-test-reporter BIN_PATH=/usr/local/bin
- run: |
export TEST_INTEGRATION_SSH_PORT=2222
export TEST_INTEGRATION_SSH_PASSWORD_FILE=$(pwd)/e2e/secrets/password
export TEST_INTEGRATION_SSH_PRIVATE_KEY_PATH=$(pwd)/e2e/secrets/id_rsa
make test-integration-cover-upload
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make build-docker
build-integration-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make build-integration
build-e2e-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: make build-e2e
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
go-version: '1.22'
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- uses: actions/checkout@v2
- name: Setup containerd
run: |
# From https://docs.docker.com/engine/install/ubuntu/.
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install \
ca-certificates \
curl \
gnupg \
lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
# From Flatcar default configuration and image-builder containerd role.
sudo sed -i 's/^disabled_plugins.*/disabled_plugins = []/g' /etc/containerd/config.toml
cat <<EOF | sudo tee -a /etc/containerd/config.toml
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
# setting runc.options unsets parent settings
runtime_type = "io.containerd.runc.v2"
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options]
SystemdCgroup = true
EOF
sudo systemctl restart containerd
- name: Fetch dependencies and configure tests
run: |
docker-compose -f e2e/docker-compose.yml up -d
cat <<EOF > e2e/test-config.yaml
sshPrivateKeyPath: $(pwd)/e2e/secrets/id_rsa
nodesCIDR: 172.17.0.0/24
nodeSSHPort: 2222
workersCount: 0
cidrIPsOffset: 1
kubeletExtraArgs:
- --fail-swap-on=false
- --container-runtime-endpoint=unix:///run/containerd/containerd.sock
cgroupDriver: cgroupfs
EOF
helm repo add flexkube https://flexkube.github.io/charts/
sudo chown $(whoami): e2e/secrets/id_rsa
- run: make test-e2e
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: codespell-project/actions-codespell@master
with:
skip: .git,go.sum
ignore_words_list: uptodate,decorder,complies
check_filenames: true
check_hidden: true
vagrant:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install vagrant
run: |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vagrant
- run: make test-vagrant
terraform:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get dependencies
run: |
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install terraform
- run: |
terraform -chdir=libvirt init
make test-terraform
semgrep:
runs-on: ubuntu-latest
container:
image: returntocorp/semgrep
steps:
- uses: actions/checkout@v2
- run: semgrep ci --config .semgrep.yml