-
Notifications
You must be signed in to change notification settings - Fork 7
124 lines (109 loc) · 4.24 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Pytest fs_filepicker
on:
workflow_call:
inputs:
xdist:
required: true
type: string
branch_name:
required: true
type: string
event_name:
required: true
type: string
secrets:
PAT:
required: true
env:
PAT: ${{ secrets.PAT }}
EVENT: ${{ inputs.event_name }}
jobs:
Test-fs_filepicker:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
container:
image: openmss/fsfp-testing-${{ inputs.branch_name }}
steps:
- name: Trust My Directory
run: git config --global --add safe.directory /__w/fs_filepicker/fs_filepicker
- uses: actions/checkout@v3
- 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
if: ${{ success() && inputs.event_name == 'schedule' && inputs.branch_name == 'stable' && env.triggerdockerbuild != 'yes' }}
run: |
echo "triggerdockerbuild=yes" >> $GITHUB_ENV
- name: Reinstall dependencies if changed
if: ${{ success() && env.triggerdockerbuild == 'yes' }}
run: |
cd $GITHUB_WORKSPACE \
&& source /opt/conda/etc/profile.d/conda.sh \
&& source /opt/conda/etc/profile.d/mamba.sh \
&& mamba activate fsfp-${{ inputs.branch_name }}-env \
&& mamba deactivate \
&& 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 \
&& echo pyvirtualdisplay >> reqs.txt \
&& cat reqs.txt \
&& mamba env remove -n fsfp-${{ inputs.branch_name }}-env \
&& mamba create -y -n fsfp-${{ inputs.branch_name }}-env --file reqs.txt
- name: Print conda list
run: |
source /opt/conda/etc/profile.d/conda.sh \
&& source /opt/conda/etc/profile.d/mamba.sh \
&& mamba activate fsfp-${{ inputs.branch_name }}-env \
&& mamba list
- name: Run tests
if: ${{ success() && inputs.xdist == 'no' }}
timeout-minutes: 25
run: |
cd $GITHUB_WORKSPACE \
&& source /opt/conda/etc/profile.d/conda.sh \
&& source /opt/conda/etc/profile.d/mamba.sh \
&& mamba activate fsfp-${{ inputs.branch_name }}-env \
&& pytest -v --durations=20 --reverse --cov=fslib tests \
|| (for i in {1..5} \
; do pytest tests -v --durations=0 --reverse --last-failed --lfnf=none \
&& break \
; done)
- name: Run tests in parallel
if: ${{ success() && inputs.xdist == 'yes' }}
timeout-minutes: 25
run: |
cd $GITHUB_WORKSPACE \
&& source /opt/conda/etc/profile.d/conda.sh \
&& source /opt/conda/etc/profile.d/mamba.sh \
&& mamba activate fsfp-${{ inputs.branch_name }}-env \
&& pytest -vv -n 6 --dist loadfile --max-worker-restart 0 tests \
|| (for i in {1..5} \
; do pytest -vv -n 6 --dist loadfile --max-worker-restart 0 tests --last-failed --lfnf=none \
&& break \
; done)
- name: Collect coverage
if: ${{ success() && inputs.event_name == 'push' && inputs.branch_name == 'develop' && inputs.xdist == 'no'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd $GITHUB_WORKSPACE \
&& source /opt/conda/etc/profile.d/conda.sh \
&& source /opt/conda/etc/profile.d/mamba.sh \
&& mamba activate fsfp-${{ inputs.branch_name }}-env \
&& mamba install coveralls \
&& coveralls --service=github
- name: Invoke dockertesting image creation
if: ${{ always() && inputs.event_name == 'push' && env.triggerdockerbuild == 'yes' && inputs.xdist == 'no'}}
uses: benc-uk/[email protected]
with:
workflow: Update Image testing-${{ inputs.branch_name }}
repo: Open-MSS/fsfp-dockertesting
ref: main
token: ${{ secrets.PAT }}