Skip to content

Run Unit Tests

Run Unit Tests #250

Workflow file for this run

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')
}}