|
| 1 | +name: Continous integration tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + singularity_version: 3.6.4 |
| 12 | + |
| 13 | +jobs: |
| 14 | + |
| 15 | + tox: |
| 16 | + name: CI tests via Tox |
| 17 | + |
| 18 | + runs-on: ubuntu-20.04 |
| 19 | + |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + py-ver-major: [3] |
| 23 | + py-ver-minor: [6, 7, 8, 9] |
| 24 | + step: [lint, unit, mypy] |
| 25 | + |
| 26 | + env: |
| 27 | + py-semver: ${{ format('{0}.{1}', matrix.py-ver-major, matrix.py-ver-minor) }} |
| 28 | + TOXENV: ${{ format('py{0}{1}-{2}', matrix.py-ver-major, matrix.py-ver-minor, matrix.step) }} |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + with: |
| 33 | + fetch-depth: 0 |
| 34 | + |
| 35 | + - name: Set up Singularity |
| 36 | + if: ${{ matrix.step == 'unit' || matrix.step == 'mypy' }} |
| 37 | + uses: eWaterCycle/setup-singularity@v6 |
| 38 | + with: |
| 39 | + singularity-version: ${{ env.singularity_version }} |
| 40 | + |
| 41 | + - name: Give the test runner user a name to make provenance happy. |
| 42 | + if: ${{ matrix.step == 'unit' || matrix.step == 'mypy' }} |
| 43 | + run: sudo usermod -c 'CI Runner' $(whoami) |
| 44 | + |
| 45 | + - name: Set up Python |
| 46 | + uses: actions/setup-python@v2 |
| 47 | + with: |
| 48 | + python-version: ${{ env.py-semver }} |
| 49 | + |
| 50 | + - name: Cache for pip |
| 51 | + uses: actions/cache@v2 |
| 52 | + with: |
| 53 | + path: ~/.cache/pip |
| 54 | + key: ${{ runner.os }}-pip-${{ matrix.step }}-${{ hashFiles('requirements.txt', 'tox.ini') }} |
| 55 | + |
| 56 | + - name: Upgrade setuptools and install tox |
| 57 | + run: | |
| 58 | + pip install -U pip setuptools wheel |
| 59 | + pip install tox tox-gh-actions |
| 60 | +
|
| 61 | + - name: MyPy cache |
| 62 | + if: ${{ matrix.step == 'mypy' }} |
| 63 | + uses: actions/cache@v2 |
| 64 | + with: |
| 65 | + path: .mypy_cache/${{ env.py-semver }} |
| 66 | + key: mypy-${{ env.py-semver }} |
| 67 | + |
| 68 | + - name: Test with tox |
| 69 | + run: tox |
| 70 | + |
| 71 | + - name: Upload coverage to Codecov |
| 72 | + if: ${{ matrix.step == 'unit' }} |
| 73 | + uses: codecov/codecov-action@v1 |
| 74 | + with: |
| 75 | + fail_ci_if_error: true |
| 76 | + |
| 77 | + tox-style: |
| 78 | + name: CI linters via Tox |
| 79 | + |
| 80 | + runs-on: ubuntu-20.04 |
| 81 | + |
| 82 | + strategy: |
| 83 | + matrix: |
| 84 | + step: [lint-readme, pydocstyle] |
| 85 | + |
| 86 | + env: |
| 87 | + py-semver: 3.9 |
| 88 | + TOXENV: ${{ format('py39-{0}', matrix.step) }} |
| 89 | + |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v2 |
| 92 | + with: |
| 93 | + fetch-depth: 0 |
| 94 | + |
| 95 | + - name: Set up Python |
| 96 | + uses: actions/setup-python@v2 |
| 97 | + with: |
| 98 | + python-version: ${{ env.py-semver }} |
| 99 | + |
| 100 | + - name: Cache for pip |
| 101 | + uses: actions/cache@v2 |
| 102 | + with: |
| 103 | + path: ~/.cache/pip |
| 104 | + key: ${{ runner.os }}-pip-${{ matrix.step }}-${{ hashFiles('requirements.txt') }} |
| 105 | + |
| 106 | + - name: Upgrade setuptools and install tox |
| 107 | + run: | |
| 108 | + pip install -U pip setuptools wheel |
| 109 | + pip install tox tox-gh-actions |
| 110 | +
|
| 111 | + - if: ${{ matrix.step == 'pydocstyle' && github.event_name == 'pull_request'}} |
| 112 | + name: Create local branch for diff-quality for PRs |
| 113 | + run: git branch ${{github.base_ref}} origin/${{github.base_ref}} |
| 114 | + |
| 115 | + - name: Test with tox |
| 116 | + run: tox |
| 117 | + |
| 118 | + |
| 119 | + release_test: |
| 120 | + name: cwl-utils release test |
| 121 | + |
| 122 | + runs-on: ubuntu-20.04 |
| 123 | + |
| 124 | + steps: |
| 125 | + - uses: actions/checkout@v2 |
| 126 | + |
| 127 | + - name: Set up Singularity |
| 128 | + uses: eWaterCycle/setup-singularity@v6 |
| 129 | + with: |
| 130 | + singularity-version: ${{ env.singularity_version }} |
| 131 | + |
| 132 | + - name: Set up Python |
| 133 | + uses: actions/setup-python@v2 |
| 134 | + with: |
| 135 | + python-version: 3.9 |
| 136 | + |
| 137 | + - name: Give the test runner user a name to make provenance happy. |
| 138 | + run: sudo usermod -c 'CI Runner' $(whoami) |
| 139 | + |
| 140 | + - name: Cache for pip |
| 141 | + uses: actions/cache@v2 |
| 142 | + with: |
| 143 | + path: ~/.cache/pip |
| 144 | + key: ${{ runner.os }}-pip-release-${{ hashFiles('requirements.txt', 'test-requirements.txt') }} |
| 145 | + |
| 146 | + - name: Install packages |
| 147 | + run: | |
| 148 | + pip install -U pip setuptools wheel |
| 149 | + pip install virtualenv |
| 150 | +
|
| 151 | + - name: Release test |
| 152 | + env: |
| 153 | + RELEASE_SKIP: head |
| 154 | + run: ./release-test.sh |
| 155 | + |
| 156 | + - name: Publish package |
| 157 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 158 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 159 | + with: |
| 160 | + user: __token__ |
| 161 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 162 | + packages_dir: testenv3_3/dist |
0 commit comments