forked from krustlet/krustlet
-
Notifications
You must be signed in to change notification settings - Fork 0
202 lines (200 loc) · 7.28 KB
/
build.yml
File metadata and controls
202 lines (200 loc) · 7.28 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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Build and Test
on:
push:
branches:
- main
pull_request: {}
jobs:
build:
runs-on: ${{ matrix.config.os }}
env: ${{ matrix.config.env }}
strategy:
fail-fast: false
matrix:
config:
- {
os: "ubuntu-latest",
arch: "amd64",
args: "",
url: "https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-unknown-linux-musl.tar.gz",
name: "just",
pathInArchive: "just",
env: {},
}
- {
os: "ubuntu-latest",
arch: "aarch64",
args: "--target aarch64-unknown-linux-gnu",
url: "https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-unknown-linux-musl.tar.gz",
name: "just",
pathInArchive: "just",
env: { OPENSSL_DIR: "/usr/local/openssl-aarch64" },
}
- {
os: "macos-latest",
arch: "amd64",
args: "",
url: "https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-apple-darwin.tar.gz",
name: "just",
pathInArchive: "just",
env: {},
}
steps:
- uses: actions/checkout@v2
- name: Install latest Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
components: clippy, rustfmt
- uses: engineerd/configurator@v0.0.8
with:
name: ${{ matrix.config.name }}
url: ${{ matrix.config.url }}
pathInArchive: ${{ matrix.config.pathInArchive }}
- name: setup for cross-compile builds
if: matrix.config.arch == 'aarch64'
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
cd /tmp
git clone https://github.com/openssl/openssl
cd openssl
git checkout OpenSSL_1_1_1l
sudo mkdir -p $OPENSSL_DIR
./Configure linux-aarch64 --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared
make CC=aarch64-linux-gnu-gcc
sudo make install
rustup target add aarch64-unknown-linux-gnu
- name: Build
run: |
just build ${{ matrix.config.args }}
just test
windows-build:
runs-on: windows-latest
defaults:
run:
# For some reason, running with the default powershell doesn't work with the `Build` step,
# but bash does!
shell: bash
steps:
- uses: actions/checkout@v2
- name: Install latest Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
components: clippy, rustfmt
- uses: engineerd/configurator@v0.0.5
with:
name: just
url: "https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-pc-windows-msvc.zip"
pathInArchive: just.exe
- name: Build
run: |
just --justfile justfile-windows build
just --justfile justfile-windows test
windows-e2e:
env:
# Because we are on a shared build machine, we need to use a different directory than the default homedir
KRUSTLET_DATA_DIR: ".krustlet"
CONFIG_DIR: '.krustlet\config'
runs-on: [self-hosted, windows, x64]
steps:
- uses: actions/checkout@v2
- name: Install latest Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
components: clippy, rustfmt
- uses: engineerd/configurator@v0.0.8
with:
name: just.exe
url: "https://github.com/casey/just/releases/download/v0.9.4/just-v0.9.4-x86_64-pc-windows-msvc.zip"
pathInArchive: just.exe
- uses: engineerd/configurator@v0.0.8
with:
name: kind.exe
url: "https://kind.sigs.k8s.io/dl/v0.11.1/kind-windows-amd64"
- name: Ensure Docker is running
run: .\tests\windows\ensure-docker.ps1
- name: Setup kind cluster
run: kind create cluster --config .\tests\windows\kind-config.yaml --name kind-${{ github.run_id }}
# Because Windows uses rustls, it can't use a bare IP address. This
# switches the kubeconfig file to use localhost instead
- name: Modify kubeconfig
run: |
kubectl config view -o jsonpath='{.clusters[?(@.name == \"kind-kind-${{ github.run_id }}\")].cluster.server}' | % {$_.replace("127.0.0.1", "localhost")} | % {kubectl config set clusters.kind-kind-${{ github.run_id }}.server $_}
- name: Get NODE_IP
run: |
$addr = (cat tests/windows/get-host-ip.sh | docker run -i ubuntu /bin/bash)
echo "KRUSTLET_NODE_IP=$addr" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
- name: Run e2e tests (full)
if: ${{ github.event_name == 'push' }}
env:
KRUSTLET_TEST_ENV: "ci"
KRUSTLET_E2E_IMAGE_PULL_SECRET: ${{ secrets.KRUSTLET_E2E_IMAGE_PULL_SECRET }}
KRUSTLET_NODE_IP: ${{ env.KRUSTLET_NODE_IP }}
run: just --justfile justfile-windows test-e2e-standalone
- name: Run e2e tests (PR)
if: ${{ github.event_name == 'pull_request' }}
run: just --justfile justfile-windows test-e2e-standalone
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: e2e-logs-windows
path: oneclick-logs/
- name: Cleanup kind cluster
if: ${{ always() }}
run: kind delete cluster --name kind-${{ github.run_id }}
e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest Rust stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
components: clippy, rustfmt
- uses: engineerd/setup-kind@v0.5.0
with:
version: "v0.11.1"
- uses: engineerd/configurator@v0.0.8
with:
name: just
url: https://github.com/casey/just/releases/download/0.10.2/just-0.10.2-x86_64-unknown-linux-musl.tar.gz
pathInArchive: just
- name: Get NODE_IP
run: echo "KRUSTLET_NODE_IP=$(ip addr ls eth0 | awk '/inet / {split($2, ary, /\//); print ary[1]}')" >> $GITHUB_ENV
- name: Apply RBAC rules for CSI tests
run: kubectl apply -f tests/csi/rbac.yaml
- name: Run e2e tests (full)
if: ${{ github.event_name == 'push' }}
env:
KRUSTLET_TEST_ENV: "ci"
KRUSTLET_E2E_IMAGE_PULL_SECRET: ${{ secrets.KRUSTLET_E2E_IMAGE_PULL_SECRET }}
KRUSTLET_NODE_IP: ${{ env.KRUSTLET_NODE_IP }}
run: just test-e2e-standalone
- name: Run e2e tests (PR)
if: ${{ github.event_name == 'pull_request' }}
run: just test-e2e-standalone
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: e2e-logs
path: oneclick-logs/
cargo-deny:
name: Run cargo deny
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}