Reusable workflows live under .github #1
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: 'Nextflow tests' | ||
on: | ||
workflow-call: | ||
# Inspired by https://blog.aspect.dev/github-actions-dynamic-matrix | ||
jobs: | ||
discover-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- id: listfiles | ||
shell: python | ||
run: | | ||
import json | ||
import os | ||
from pathlib import Path | ||
testfiles = [ | ||
str(item) for item in | ||
Path(".").glob("**/configtest*.json") | ||
] | ||
with open(os.environ.get("GITHUB_OUTPUT"), | ||
mode="w", encoding="utf-8") as outfile: | ||
outfile.write(f"testfiles={json.dumps(testfiles)}\n") | ||
outputs: | ||
testfiles: ${{ steps.listfiles.outputs.testfiles }} | ||
runtests: | ||
runs-on: ubuntu-latest | ||
needs: discover-tests | ||
strategy: | ||
matrix: | ||
testfile: ${{ fromJSON(needs.discover-tests.outputs.testfiles) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- shell: python | ||
with: | ||
image: ghcr.io/uclahs-cds/nextflow-config-test:testing | ||
run: | | ||
import sys | ||
from pathlib import Path | ||
from configtest import NextflowConfigTest | ||
clean = NextflowConfigTest.from_file( | ||
"${{ matrix.testfile }}" | ||
).check_results(Path(".").resolve()) | ||
if not clean: | ||
sys.exit(1) |