Skip to content

Improve CI workflow #28

Improve CI workflow

Improve CI workflow #28

Workflow file for this run

name: Tests
on:
push:
branches:
- main
pull_request:
jobs:
setup:
name: "Setup environment and determine templates"
runs-on: ubuntu-latest
outputs:
template_dirs: ${{ steps.get-dirs.outputs.dirs }}
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install Node.js dependencies
run: npm ci
- name: Get list of test directories
id: get-dirs
run: echo "dirs=$(ls -d test/*/ | jq -R -s -c 'split("\n")[:-1] | map(split("/")[1])')" >> $GITHUB_OUTPUT
lint:
name: "Run linting"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run linting
run: test/lint.sh
test-templates:
name: "Run template tests"
needs: setup
runs-on: ubuntu-latest
strategy:
matrix:
template: ${{ fromJson(needs.setup.outputs.template_dirs) }}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install Node.js dependencies
run: npm ci
- name: Run test for ${{ matrix.template }}
run: test/${{ matrix.template }}/test.sh