Run Unit Tests #85
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | |
- 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') | |
}} |