-
Notifications
You must be signed in to change notification settings - Fork 95
79 lines (66 loc) · 2.81 KB
/
testing.yml
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
name: Pytest MSS
on:
workflow_call:
inputs:
image_suffix:
required: true
type: string
secrets:
PAT:
env:
mamba-env: mss-${{ inputs.image_suffix }}-env
jobs:
Test-MSS:
runs-on: ubuntu-latest
container:
image: openmss/testing-${{ inputs.image_suffix }}
strategy:
fail-fast: false
matrix:
order: ["normal", "reverse"]
steps:
- uses: actions/checkout@v4
- name: Check for changed dependencies
run: cmp -s /meta.yaml localbuild/meta.yaml && cmp -s /development.txt requirements.d/development.txt ||
(echo Dependencies differ && echo "triggerdockerbuild=yes" >> $GITHUB_ENV )
- name: Always rebuild dependencies for scheduled builds (started from testing-scheduled.yml)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo "triggerdockerbuild=yes" >> $GITHUB_ENV
- name: Invoke dockertesting image creation
# The image creation is intentionally only triggered for push events because
# scheduled tests should just check that new dependency versions do not break the
# tests, but should not update the image.
if: ${{ (github.ref_name == 'stable' || github.ref_name == 'develop') && github.event_name == 'push' && env.triggerdockerbuild == 'yes' && matrix.order == 'normal' }}
uses: benc-uk/workflow-dispatch@v1.2.4
with:
workflow: Update Image testing-${{ inputs.image_suffix }}
repo: Open-MSS/dockertesting
ref: main
token: ${{ secrets.PAT }}
- name: Reinstall dependencies if changed
if: ${{ env.triggerdockerbuild == 'yes' }}
run: |
cat localbuild/meta.yaml |
sed -n '/^requirements:/,/^test:/p' |
sed -e "s/.*- //" |
sed -e "s/menuinst.*//" |
sed -e "s/.*://" > reqs.txt
cat requirements.d/development.txt >> reqs.txt
cat reqs.txt
mamba env remove -n ${{ env.mamba-env }}
mamba create -y -n ${{ env.mamba-env }} --file reqs.txt
- name: Print conda list
run: mamba run --no-capture-output -n ${{ env.mamba-env }} mamba list
- name: Run tests
timeout-minutes: 10
run: mamba run --no-capture-output -n ${{ env.mamba-env }} xvfb-run pytest
-v -n 6 --dist loadfile --max-worker-restart 4 --durations=20 --cov=mslib
${{ (matrix.order == 'normal' && ' ') || (matrix.order == 'reverse' && '--reverse') }} tests
- name: Collect coverage
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request') && matrix.order == 'normal' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory /__w/MSS/MSS
mamba install -n ${{ env.mamba-env }} coveralls
mamba run --no-capture-output -n ${{ env.mamba-env }} coveralls --service=github