This repository has been archived by the owner on Oct 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
96 lines (90 loc) · 2.68 KB
/
ci-tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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