-
Notifications
You must be signed in to change notification settings - Fork 108
223 lines (200 loc) · 7.11 KB
/
tests.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
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
name: Tests
on:
push:
branches: [master]
pull_request:
schedule:
- cron: '0 2 * * *'
jobs:
unit-tests:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
ruby: ["2.7.1"]
bundler: ["2.1.4"]
include:
# Test versions from Ubuntu 22.04
- os: ubuntu-latest
ruby: "3.0.2"
bundler: "2.3.5"
# Test versions from RHEL8 & RHEL9
- os: ubuntu-latest
ruby: "3.1.2"
bundler: "2.3.7"
# Test versions from Amazon Linux 2023
- os: ubuntu-latest
ruby: "3.2.2"
bundler: "2.4.10"
runs-on: ${{ matrix.os }}
name: Unit tests
steps:
- name: Checkout ${{ github.sha }}
uses: actions/checkout@v3
- name: Setup Ruby ${{ matrix.ruby }} using Bundler ${{ matrix.bundler }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ matrix.bundler }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/vendor/bundle
key: ${{ runner.os }}-${{ matrix.ruby }}-unit-gems-${{ hashFiles('apps/*/Gemfile.lock', 'Gemfile.lock') }}-1
- name: Setup Bundler
run: |
bundle config path ~/vendor/bundle
bundle install
gem install rake
- name: Setup Node.js
run: |
npm install -g node-gyp
- name: Setup rclone
run: sudo apt-get update && sudo apt-get install rclone
- name: Run unit tests
run: bundle exec rake test:unit
- name: Run ShellCheck
run: bundle exec rake test:shellcheck
- name: Run Zeitwerk check
run: |
cd apps/dashboard
bundle install
bundle exec rake zeitwerk:check
- name: Run lint tests
run: bundle exec rake lint || true
- name: Run System Dashboard tests
run: cd apps/dashboard; bin/rake test:system
- name: Upload system test failures.
if: failure()
uses: actions/upload-artifact@v3
with:
name: system-test-failures-${{ matrix.ruby }}
path: |
apps/dashboard/tmp/screenshots/*.png
apps/dashboard/log/test.log
k8s-tests:
runs-on: ubuntu-latest
name: Kubernetes tests
steps:
- name: Checkout ${{ github.sha }}
uses: actions/checkout@v3
- name: Create kind cluster
uses: container-tools/kind-action@v2
- name: Apply ondemand RBAC
run: kubectl apply -f hooks/k8s-bootstrap/ondemand.yaml
- name: Get ondemand token
id: token
run: |
TOKEN_NAME=$(kubectl describe serviceaccount ondemand -n ondemand | grep Tokens | awk '{ print $2 }')
TOKEN=$(kubectl describe secret $TOKEN_NAME -n ondemand | grep "token:" | awk '{ print $2 }')
echo "ondemand=${TOKEN}" >> $GITHUB_OUTPUT
- name: Setup kubectl
run: |
kubectl config set-credentials ondemand --token="${{ steps.token.outputs.ondemand }}"
kubectl config set-context kind-kind --user=ondemand
kubectl config use-context kind-kind
kubectl cluster-info
- name: Test k8s-bootstrap
run: /bin/bash hooks/k8s-bootstrap/k8s-bootstrap-ondemand.sh test hooks/hook.env.example
e2e-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
dist:
- el7
- el8
- el9
- amzn2023
- ubuntu-20.04
- ubuntu-22.04
- debian-12
arch:
- x86_64
- aarch64
- ppc64le
version: ["3.1"]
exclude:
# Amazon 2023 on aarch64 is very slow and will time out
- dist: amzn2023
arch: aarch64
# Amazon 2023 doesn't have ppc64le containers
- dist: amzn2023
arch: ppc64le
# Ubuntu doesn't have way to get NodeJS 14+ on ppc64le
- dist: ubuntu-20.04
arch: ppc64le
# Ubuntu doesn't have way to get NodeJS 14+ on ppc64le
- dist: ubuntu-22.04
arch: ppc64le
runs-on: ${{ matrix.os }}
name: E2E test ${{ matrix.dist }}-${{ matrix.arch }}
steps:
- name: Checkout ${{ github.sha }}
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Ruby using Bundler
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7.1"
bundler: "2.1.4"
bundler-cache: true
- name: Build package
if: matrix.arch == 'x86_64'
run: bundle exec rake package:build[${{ matrix.dist }},${{ matrix.arch }}]
env:
VERSION: "${{ matrix.version }}.0"
OOD_PACKAGING_DEBUG: 'true'
- name: Run package tests
if: matrix.arch == 'x86_64'
run: bundle exec rake test:e2e
env:
BEAKER_set: ${{ matrix.dist }}
OOD_BUILD_REPO: ${{ matrix.version }}
- name: arch distro
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
run: |
DISTRO=$(echo "${{ matrix.os }}" | sed 's|\-||g')
echo "DISTRO=${DISTRO}" >> $GITHUB_ENV
if [ "${{ matrix.arch }}" == "aarch64" ]; then
echo "PLATFORM=linux/arm64" >> $GITHUB_ENV
fi
if [ "${{ matrix.arch }}" == "ppc64le" ]; then
echo "PLATFORM=linux/ppc64le" >> $GITHUB_ENV
fi
- name: Test OnDemand
if: ${{ matrix.arch != 'x86_64' && github.event_name == 'schedule' }}
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.arch }}
distro: ${{ env.DISTRO }}
githubToken: ${{ github.token }}
install: |
apt update -y
apt install -y ruby-bundler ruby-dev build-essential git \
apt-transport-https ca-certificates curl software-properties-common
# Not available for ppc64le
# apt install -y chromium-chromedriver
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update -y
apt install -y docker-ce
dockerRunArgs: |
--platform ${{ env.PLATFORM }}
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
bundle install
bundle exec rake package:build[${{ matrix.dist }},${{ matrix.arch }}]
# e2e tests fail with issues accessing chorium
# bundle exec rake test:e2e
env: |
VERSION: "${{ matrix.version }}.0"
OOD_PACKAGING_DEBUG: 'true'
BEAKER_set: ${{ matrix.dist }}-${{ matrix.arch }}
OOD_BUILD_REPO: ${{ matrix.version }}
DOCKER_IN_DOCKER: 'true'
- name: Debug failure
if: failure()
run: |
find tmp/e2e_ctr/ -type f -name *.log -exec cat {} +