Skip to content

ci(pr-check): move output check to dedicated step #5

ci(pr-check): move output check to dedicated step

ci(pr-check): move output check to dedicated step #5

Workflow file for this run

name: PR checks on algorithm submission
on:
pull_request:
paths:
- 'algorithms/*.yaml'
- '.github/workflows/1-pr-check.yml'
push:
paths:
- 'algorithms/*.yaml'
- '.github/workflows/1-pr-check.yml'
jobs:
check_yaml:
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}-algo-checks:main
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
steps:
- uses: actions/checkout@v4
- name: find algorithm files
run: |
{
echo 'FILELIST<<EOF'
find ./algorithms -name '*.yaml' -print
echo EOF
} >> "$GITHUB_ENV"
- name: Convert and validate using jsonschema
run: |
for algo in ${FILELIST}; do
yq -o json $algo > algo.json \
&& jsonschema-cli -i algo.json "config/schema.json"
done
rm algo.json
check_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: find algorithm files
run: |
{
echo 'FILELIST<<EOF'
find ./algorithms -name '*.yaml' -print
echo EOF
} >> "$GITHUB_ENV"
- name: Pull image
run: |
for algo in ${FILELIST}; do
IMAGE=$(grep '^image: ' $algo | sed 's/^image: \+//' | tr -d \'\")
if ! docker pull $IMAGE ; then
echo "Cannot pull image: $IMAGE"
exit 1
fi
done
- name: Check output
run: |
for algo in ${FILELIST}; do
IMAGE=$(grep '^image: ' $algo | sed 's/^image: \+//' | tr -d \'\")
docker run -v tests/data:/data -v $PWD:/output -e INPUT=dummy.edf -e OUTPUT=out.tsv $IMAGE
HEADER_REGEX='^onset duration eventType confidence channels dateTime recordingDuration$'
if ! [[ $(head -n1 $PWD/output/out.tsv) =~ "$HEADER_REGEX" ]]; then
echo "Output does not have the expected header"
exit 1
fi
rm -f $PWD/out.tsv
done