-
Notifications
You must be signed in to change notification settings - Fork 17
77 lines (72 loc) · 1.95 KB
/
lib-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
name: library 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/lib-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: false # is this desired behavior here?
matrix:
library: ${{ fromJSON(needs.changes.outputs.libraries) }}
exclude:
# don't run non-existent .github/workflow tests,
# and exclude projects, whose tests are run in
# a different CI script
- library: 'workflow'
permissions:
packages: read
container:
# container with python and git
image: cicirello/pyaction:4.32
volumes:
- ${{ github.workspace }}:/github/workspace
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
# build the libraries environment
-
name: build environment
env:
test_dir: /github/workspace/libs/${{ matrix.library }}
run: |
apt-get update
apt-get install -y build-essential
apt-get clean
python -m pip install poetry
cd $test_dir
poetry install
shell: bash
# run its unit tests inside that environment
-
name: run tests
env:
test_dir: /github/workspace/libs/${{ matrix.library }}
run: |
cd $test_dir
poetry run pytest
shell: bash