|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: |
| 6 | + - published |
| 7 | + |
| 8 | +jobs: |
| 9 | + check_manifest: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + |
| 15 | + - uses: actions/setup-python@v4 |
| 16 | + with: |
| 17 | + python-version: "3.10" |
| 18 | + |
| 19 | + - uses: pre-commit/action@v3.0.0 |
| 20 | + with: |
| 21 | + extra_args: check-manifest --hook-stage manual |
| 22 | + |
| 23 | + build_project: |
| 24 | + needs: check_manifest |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v3 |
| 29 | + |
| 30 | + - uses: actions/setup-python@v4 |
| 31 | + with: |
| 32 | + python-version: '3.10' |
| 33 | + |
| 34 | + - name: Build project |
| 35 | + run: | |
| 36 | + python -m pip install build |
| 37 | + python -m build |
| 38 | +
|
| 39 | + - name: Store built files |
| 40 | + uses: actions/upload-artifact@v3 |
| 41 | + with: |
| 42 | + name: dist |
| 43 | + path: dist/* |
| 44 | + |
| 45 | + test_wheels: |
| 46 | + needs: build_project |
| 47 | + name: Test wheels on ${{ matrix.os }} with ${{ matrix.python-version }} |
| 48 | + runs-on: ${{ matrix.os }} |
| 49 | + |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + os: [ubuntu-latest, macOS-latest] |
| 53 | + python-version: ['3.8', '3.9', '3.10'] |
| 54 | + include: |
| 55 | + - os: windows-latest |
| 56 | + python: 38 |
| 57 | + python-version: '3.8' |
| 58 | + bitness: 64 |
| 59 | + platform_id: win_amd64 |
| 60 | + - os: windows-latest |
| 61 | + python: 39 |
| 62 | + python-version: '3.9' |
| 63 | + bitness: 64 |
| 64 | + platform_id: win_amd64 |
| 65 | + - os: windows-latest |
| 66 | + python: 310 |
| 67 | + python-version: '3.10' |
| 68 | + bitness: 64 |
| 69 | + platform_id: win_amd64 |
| 70 | + |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v3 |
| 73 | + |
| 74 | + - uses: actions/setup-python@v4 |
| 75 | + with: |
| 76 | + python-version: ${{ matrix.python-version }} |
| 77 | + |
| 78 | + - uses: actions/download-artifact@v3 |
| 79 | + with: |
| 80 | + name: dist |
| 81 | + path: dist |
| 82 | + |
| 83 | + - if: matrix.os == 'windows-latest' |
| 84 | + name: Windows wheel filename |
| 85 | + run: echo "WHEELNAME=$(ls ./dist/tsml_subpackage_template-*-none-any.whl)" >> $env:GITHUB_ENV |
| 86 | + - if: matrix.os != 'windows-latest' |
| 87 | + name: Unix wheel filename |
| 88 | + run: echo "WHEELNAME=$(ls ./dist/tsml_subpackage_template-*-none-any.whl)" >> $GITHUB_ENV |
| 89 | + |
| 90 | + - if: matrix.os == 'windows-latest' |
| 91 | + name: Windows install |
| 92 | + run: python -m pip install "${env:WHEELNAME}[dev]" |
| 93 | + - if: matrix.os != 'windows-latest' |
| 94 | + name: Unix install |
| 95 | + run: python -m pip install "${{ env.WHEELNAME }}[dev]" |
| 96 | + |
| 97 | + - name: Tests |
| 98 | + run: python -m pytest |
| 99 | + |
| 100 | + upload_wheels: |
| 101 | + needs: test_wheels |
| 102 | + runs-on: ubuntu-latest |
| 103 | + |
| 104 | + steps: |
| 105 | + - uses: actions/download-artifact@v3 |
| 106 | + with: |
| 107 | + name: dist |
| 108 | + path: dist |
| 109 | + |
| 110 | + - name: Publish package to PyPI |
| 111 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 112 | + with: |
| 113 | + password: ${{ secrets.PYPI_TOKEN }} |
0 commit comments