11name : Pytest MSS
22
3- on :
4- push :
5- branches :
6- - develop
7- - stable
8- pull_request :
9- branches :
10- - develop
11- - stable
3+ on :
4+ workflow_call :
5+ inputs :
6+ xdist :
7+ required : true
8+ type : string
9+ branch_name :
10+ required : true
11+ type : string
12+ event_name :
13+ required : true
14+ type : string
15+ secrets :
16+ PAT :
17+ required : true
1218
1319env :
1420 PAT : ${{ secrets.PAT }}
21+ EVENT : ${{ inputs.event_name }}
1522
1623jobs :
1724 Test-MSS :
@@ -22,29 +29,32 @@ jobs:
2229 shell : bash
2330
2431 container :
25- image : openmss/mss-test:latest
32+ image : openmss/testing-${{ inputs.branch_name }}
2633
2734 steps :
2835 - name : Trust My Directory
2936 run : git config --global --add safe.directory /__w/MSS/MSS
30- - uses : actions/checkout@v2
31-
37+
38+ - uses : actions/checkout@v3
3239 - name : Reinstall dependencies if changed
40+ id : step1
3341 run : |
3442 cmp -s /meta.yaml localbuild/meta.yaml && cmp -s /development.txt requirements.d/development.txt || (echo Dependencies differ \
43+ && echo "triggerdockerbuild=yes" >> $GITHUB_ENV \
3544 && cat localbuild/meta.yaml \
3645 | sed -n '/^requirements:/,/^test:/p' \
3746 | sed -e "s/.*- //" \
3847 | sed -e "s/menuinst.*//" \
3948 | sed -e "s/.*://" > reqs.txt \
40- && source /opt/ conda/bin/activate mssenv \
41- && conda install --revision 0 \
42- && conda install mamba python=3.9.12 \
43- && mamba install pyvirtualdisplay python=3.9.12 \
44- && mamba install -- file reqs. txt \
45- && mamba install --file requirements.d/development.txt )
49+ && conda create -n new_mssenv mamba python\<3.10 \
50+ && conda activate new_mssenv \
51+ && mamba install -c conda-forge pyvirtualdisplay python\<3.10 -y \
52+ && mamba install -c conda-forge --file reqs.txt -y \
53+ && mamba install -c conda-forge -- file requirements.d/development. txt -y \
54+ && conda create --name mssenv --copy --clone new_mssenv -y )
4655
4756 - name : Run tests
57+ if : ${{ success() && inputs.xdist == 'no' }}
4858 timeout-minutes : 25
4959 run : |
5060 source /opt/conda/bin/activate mssenv \
5565 && break \
5666 ; done)
5767
58-
59- - name : coveralls
60- if : ${{ always() && github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
68+ - name : Run tests in parallel
69+ if : ${{ success() && inputs.xdist == 'yes' }}
70+ timeout-minutes : 25
71+ run : |
72+ source /opt/conda/bin/activate mssenv \
73+ && cd $GITHUB_WORKSPACE \
74+ && pytest -vv -n 6 --dist loadfile --max-worker-restart 0 mslib \
75+ || (for i in {1..5} \
76+ ; do pytest -vv -n 6 --dist loadfile --max-worker-restart 0 mslib --last-failed --lfnf=none \
77+ && break \
78+ ; done)
79+
80+ - name : Collect coverage
81+ if : ${{ always() && inputs.event_name == 'push' && inputs.branch_name == 'develop' && inputs.xdist == 'no'}}
6182 env :
6283 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6384 run : |
@@ -66,17 +87,11 @@ jobs:
6687 && mamba install coveralls \
6788 && coveralls --service=github
6889
69- Update-Images :
70- runs-on : ubuntu-latest
71- if : github.event_name == 'push'
72- needs : [Test-MSS]
73-
74- steps :
75- - if : env.PAT != ''
76- name : Invoke dockerhub image creation
77- uses : benc-uk/workflow-dispatch@827565b908f387ffd483c84312273ae185c06c8a
78- with :
79- workflow : Update all images
80- repo : Open-MSS/dockerhub
81- ref : stable
82- token : ${{ secrets.PAT }}
90+ - name : Invoke dockertesting image creation
91+ if : ${{ always() && inputs.event_name == 'push' && env.triggerdockerbuild == 'yes' && inputs.xdist == 'no'}}
92+ uses : benc-uk/workflow-dispatch@827565b908f387ffd483c84312273ae185c06c8a
93+ with :
94+ workflow : Update Image testing-${{ inputs.branch_name }}
95+ repo : Open-MSS/dockertesting
96+ ref : main
97+ token : ${{ secrets.PAT }}
0 commit comments