Skip to content

MDC data updates

MDC data updates #1186

Workflow file for this run

name: unit-tests
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- main
jobs:
# first job users filters to output which libraries
# and projects have updates that need testing
changes:
runs-on: ubuntu-latest
outputs:
libraries: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: .github/filters.yaml
if: github.event.pull_request.draft == false
# second job takes those outputs and runs
# unit tests on these libs and projects
tests:
runs-on: ubuntu-latest
needs: changes
strategy:
fail-fast: true # is this desired behavior here?
matrix:
library: ${{ fromJSON(needs.changes.outputs.libraries) }}
# extra test flags for train project
include:
- library: 'projects/sandbox/train/'
args: '-m "not gpu"'
exclude:
# don't run non-existent .github/workflow tests
- library: 'workflow'
permissions:
packages: read
container:
image: ghcr.io/ml4gw/pinto:main
credentials:
username: ${{ github.actor }}
password: ${{ secrets.github_token }}
volumes:
- ${{ github.workspace }}:/github/workspace
env:
CONDA_PREFIX: /opt/conda
CONDA_DEFAULT_ENV: base
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
# install gcc for bilby build
# TODO: not every library/project needs this
-
name: install gcc
run: apt update && apt install -y build-essential
# build the project's environment
-
name: build environment
env:
test_dir: /github/workspace/${{ matrix.library }}
CONDA_PREFIX: /opt/conda
# TODO: use case statement here, or add separate matrix.build_args
run: |
if [[ "${{ matrix.library }}" == "libs/architectures/" ]]; then
FLAGS="-E wrapper"
else
FLAGS=""
fi
pinto -p $test_dir build $FLAGS
shell: bash
# run its unit tests inside that environment
-
name: run tests
env:
test_dir: /github/workspace/${{ matrix.library }}
CONDA_PREFIX: /opt/conda
run: |
if [[ "${{ matrix.library }}" == "projects/sandbox/datagen/" ]]; then
export LD_LIBRARY_PATH=/opt/conda/envs/aframe-datagen/lib/
fi
pinto -p $test_dir run printenv
pinto -p $test_dir run pytest $test_dir/tests ${{matrix.args}}
shell: bash