|
| 1 | +name: test GSOC branches |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'GSOC**' |
| 7 | + |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - 'GSOC**' |
| 11 | + |
| 12 | +env: |
| 13 | + PAT: ${{ secrets.PAT }} |
| 14 | + |
| 15 | + |
| 16 | +jobs: |
| 17 | + Test-MSS-GSOC: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + secrets: |
| 20 | + PAT: ${{ secrets.PAT }} |
| 21 | + |
| 22 | + defaults: |
| 23 | + run: |
| 24 | + shell: bash |
| 25 | + |
| 26 | + container: |
| 27 | + image: openmss/fsfp-testing-develop |
| 28 | + |
| 29 | + steps: |
| 30 | + - name: Trust My Directory |
| 31 | + run: git config --global --add safe.directory /__w/fs_filepicker/fs_filepicker |
| 32 | + |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + |
| 35 | + - name: Check for changed dependencies |
| 36 | + run: | |
| 37 | + cmp -s /meta.yaml localbuild/meta.yaml && cmp -s /development.txt requirements.d/development.txt \ |
| 38 | + || (echo Dependencies differ \ |
| 39 | + && echo "triggerdockerbuild=yes" >> $GITHUB_ENV ) |
| 40 | +
|
| 41 | + - name: Reinstall dependencies if changed |
| 42 | + if: ${{ success() && env.triggerdockerbuild == 'yes' }} |
| 43 | + run: | |
| 44 | + cd $GITHUB_WORKSPACE \ |
| 45 | + && source /opt/conda/etc/profile.d/conda.sh \ |
| 46 | + && source /opt/conda/etc/profile.d/mamba.sh \ |
| 47 | + && mamba activate fsfp-develop-env \ |
| 48 | + && mamba deactivate \ |
| 49 | + && cat localbuild/meta.yaml \ |
| 50 | + | sed -n '/^requirements:/,/^test:/p' \ |
| 51 | + | sed -e "s/.*- //" \ |
| 52 | + | sed -e "s/menuinst.*//" \ |
| 53 | + | sed -e "s/.*://" > reqs.txt \ |
| 54 | + && cat requirements.d/development.txt >> reqs.txt \ |
| 55 | + && echo pyvirtualdisplay >> reqs.txt \ |
| 56 | + && cat reqs.txt \ |
| 57 | + && mamba env remove -n fsfp-develop-env \ |
| 58 | + && mamba create -y -n fsfp-develop-env --file reqs.txt |
| 59 | +
|
| 60 | + - name: Print conda list |
| 61 | + run: | |
| 62 | + source /opt/conda/etc/profile.d/conda.sh \ |
| 63 | + && source /opt/conda/etc/profile.d/mamba.sh \ |
| 64 | + && mamba activate fsfp-develop-env \ |
| 65 | + && mamba list |
| 66 | +
|
| 67 | + - name: Run tests |
| 68 | + if: ${{ success() && inputs.xdist == 'no' }} |
| 69 | + timeout-minutes: 25 |
| 70 | + run: | |
| 71 | + cd $GITHUB_WORKSPACE \ |
| 72 | + && source /opt/conda/etc/profile.d/conda.sh \ |
| 73 | + && source /opt/conda/etc/profile.d/mamba.sh \ |
| 74 | + && mamba activate fsfp-develop-env \ |
| 75 | + && pytest -v --durations=20 --reverse --cov=mslib tests \ |
| 76 | + || (for i in {1..5} \ |
| 77 | + ; do pytest tests -v --durations=0 --reverse --last-failed --lfnf=none \ |
| 78 | + && break \ |
| 79 | + ; done) |
| 80 | +
|
| 81 | +
|
| 82 | + - name: Run tests in parallel |
| 83 | + if: ${{ success() && inputs.xdist == 'yes' }} |
| 84 | + timeout-minutes: 25 |
| 85 | + run: | |
| 86 | + cd $GITHUB_WORKSPACE \ |
| 87 | + && source /opt/conda/etc/profile.d/conda.sh \ |
| 88 | + && source /opt/conda/etc/profile.d/mamba.sh \ |
| 89 | + && mamba activate fsfp-develop-env \ |
| 90 | + && pytest -vv -n 6 --dist loadfile --max-worker-restart 0 tests \ |
| 91 | + || (for i in {1..5} \ |
| 92 | + ; do pytest -vv -n 6 --dist loadfile --max-worker-restart 0 tests --last-failed --lfnf=none \ |
| 93 | + && break \ |
| 94 | + ; done) |
| 95 | +
|
| 96 | + - name: Collect coverage |
| 97 | + if: ${{ success() && inputs.event_name == 'push' && inputs.branch_name == 'develop' && inputs.xdist == 'no'}} |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + run: | |
| 101 | + cd $GITHUB_WORKSPACE \ |
| 102 | + && source /opt/conda/etc/profile.d/conda.sh \ |
| 103 | + && source /opt/conda/etc/profile.d/mamba.sh \ |
| 104 | + && mamba activate fsfp-develop-env \ |
| 105 | + && mamba install coveralls \ |
| 106 | + && coveralls --service=github |
0 commit comments