-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (51 loc) · 1.7 KB
/
unit-tests.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
name: Run Unit Tests
on:
pull_request_review:
types:
- submitted
jobs:
load-matrix:
if: github.event.review.state == 'approved' && !startsWith(github.event.pull_request.title, 'docs:')
uses: ./.github/workflows/load-kind-versions.yaml
unit-tests:
if: github.event.review.state == 'approved' && !startsWith(github.event.pull_request.title, 'docs:')
needs: load-matrix
strategy:
matrix:
INITIUM_K8S_VERSION: ${{ fromJSON(needs.load-matrix.outputs.matrix) }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Unit test
run: |
# Install asdf and expose to PATH
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
. $HOME/.asdf/asdf.sh
# Add asdf plugins and install tools in .tool-versions
make asdf_install
# Create a local branch to allow the next step to work
git checkout -b ci
# Deploy cluster
make ci
# Run tests
make unit-test
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INITIUM_DEPLOY_MINIMAL: true
INITIUM_K8S_VERSION: ${{ matrix.INITIUM_K8S_VERSION }}
# https://github.com/orgs/community/discussions/26822#discussioncomment-5122101
unit-tests-result:
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
name: Unit Tests
needs: [unit-tests]
steps:
- run: exit 1
# see https://stackoverflow.com/a/67532120/4907315
if: >-
${{
contains(needs.*.result, 'failure')
|| contains(needs.*.result, 'cancelled')
}}