|
| 1 | +name: release-deploy |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [ published ] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-sdist: |
| 9 | + name: Build source distribution |
| 10 | + runs-on: ubuntu-latest |
| 11 | + timeout-minutes: 10 |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v3 |
| 14 | + with: |
| 15 | + submodules: true |
| 16 | + |
| 17 | + - uses: actions/setup-python@v4 |
| 18 | + name: Install Python |
| 19 | + with: |
| 20 | + python-version: '3.10' |
| 21 | + |
| 22 | + - name: Build sdist |
| 23 | + run: | |
| 24 | + python -m pip install -U pip |
| 25 | + python -m pip install numpy cython |
| 26 | + python setup.py sdist |
| 27 | +
|
| 28 | + - name: Store artifacts |
| 29 | + uses: actions/upload-artifact@v3 |
| 30 | + with: |
| 31 | + name: wheels |
| 32 | + path: ./dist |
| 33 | + |
| 34 | + build-wheels: |
| 35 | + name: Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{ matrix.manylinux_image }} |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + include: |
| 41 | + # Windows 64 bit |
| 42 | + - os: windows-latest |
| 43 | + python: 37 |
| 44 | + platform_id: win_amd64 |
| 45 | + - os: windows-latest |
| 46 | + python: 38 |
| 47 | + platform_id: win_amd64 |
| 48 | + - os: windows-latest |
| 49 | + python: 39 |
| 50 | + platform_id: win_amd64 |
| 51 | + - os: windows-latest |
| 52 | + python: 310 |
| 53 | + platform_id: win_amd64 |
| 54 | + - os: windows-latest |
| 55 | + python: 311 |
| 56 | + platform_id: win_amd64 |
| 57 | + |
| 58 | + # Linux 64 bit manylinux2014 |
| 59 | + - os: ubuntu-latest |
| 60 | + python: 37 |
| 61 | + platform_id: manylinux_x86_64 |
| 62 | + manylinux_image: manylinux2014 |
| 63 | + - os: ubuntu-latest |
| 64 | + python: 38 |
| 65 | + platform_id: manylinux_x86_64 |
| 66 | + manylinux_image: manylinux2014 |
| 67 | + - os: ubuntu-latest |
| 68 | + python: 39 |
| 69 | + platform_id: manylinux_x86_64 |
| 70 | + manylinux_image: manylinux2014 |
| 71 | + - os: ubuntu-latest |
| 72 | + python: 310 |
| 73 | + platform_id: manylinux_x86_64 |
| 74 | + manylinux_image: manylinux2014 |
| 75 | + - os: ubuntu-latest |
| 76 | + python: 311 |
| 77 | + platform_id: manylinux_x86_64 |
| 78 | + manylinux_image: manylinux2014 |
| 79 | + |
| 80 | + # Linux aarch64 |
| 81 | + - os: ubuntu-latest |
| 82 | + python: 37 |
| 83 | + platform_id: manylinux_aarch64 |
| 84 | + - os: ubuntu-latest |
| 85 | + python: 38 |
| 86 | + platform_id: manylinux_aarch64 |
| 87 | + - os: ubuntu-latest |
| 88 | + python: 39 |
| 89 | + platform_id: manylinux_aarch64 |
| 90 | + - os: ubuntu-latest |
| 91 | + python: 310 |
| 92 | + platform_id: manylinux_aarch64 |
| 93 | + - os: ubuntu-latest |
| 94 | + python: 311 |
| 95 | + platform_id: manylinux_aarch64 |
| 96 | + |
| 97 | + # MacOS x86_64 |
| 98 | + - os: macos-latest |
| 99 | + python: 37 |
| 100 | + platform_id: macosx_x86_64 |
| 101 | + - os: macos-latest |
| 102 | + python: 38 |
| 103 | + platform_id: macosx_x86_64 |
| 104 | + - os: macos-latest |
| 105 | + python: 39 |
| 106 | + platform_id: macosx_x86_64 |
| 107 | + - os: macos-latest |
| 108 | + python: 310 |
| 109 | + platform_id: macosx_x86_64 |
| 110 | + - os: macos-latest |
| 111 | + python: 311 |
| 112 | + platform_id: macosx_x86_64 |
| 113 | + |
| 114 | + # MacOS arm64 |
| 115 | + - os: macos-latest |
| 116 | + python: 38 |
| 117 | + platform_id: macosx_arm64 |
| 118 | + - os: macos-latest |
| 119 | + python: 39 |
| 120 | + platform_id: macosx_arm64 |
| 121 | + - os: macos-latest |
| 122 | + python: 310 |
| 123 | + platform_id: macosx_arm64 |
| 124 | + - os: macos-latest |
| 125 | + python: 311 |
| 126 | + platform_id: macosx_arm64 |
| 127 | + |
| 128 | + steps: |
| 129 | + - uses: actions/checkout@v3 |
| 130 | + |
| 131 | + - name: Set up QEMU |
| 132 | + if: ${{ matrix.platform_id == 'manylinux_aarch64' }} |
| 133 | + uses: docker/setup-qemu-action@v2 |
| 134 | + with: |
| 135 | + platforms: arm64 |
| 136 | + |
| 137 | + - uses: actions/setup-python@v4 |
| 138 | + name: Install Python |
| 139 | + with: |
| 140 | + python-version: '3.9' |
| 141 | + |
| 142 | + - name: Install dependencies |
| 143 | + run: | |
| 144 | + python -m pip install -U pip |
| 145 | + python -m pip install cibuildwheel==2.12.0 |
| 146 | +
|
| 147 | + - name: Build wheels |
| 148 | + env: |
| 149 | + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} |
| 150 | + CIBW_ARCHS: all |
| 151 | + CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} |
| 152 | + CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }} |
| 153 | + CIBW_MANYLINUX_AARCH64_IMAGE: ${{ matrix.manylinux_image }} |
| 154 | + CIBW_BUILD_VERBOSITY: 1 |
| 155 | + run: | |
| 156 | + python --version |
| 157 | + python -m cibuildwheel --output-dir dist |
| 158 | +
|
| 159 | + - name: Store artifacts |
| 160 | + uses: actions/upload-artifact@v3 |
| 161 | + with: |
| 162 | + name: wheels |
| 163 | + path: ./dist |
| 164 | + |
| 165 | + # Todo: download and test the packages after we have working tests |
| 166 | + |
| 167 | + # See: https://github.com/pypa/gh-action-pypi-publish/discussions/15 |
| 168 | + deploy: |
| 169 | + name: Upload wheels to PyPI |
| 170 | + needs: [ build-wheels ] |
| 171 | + runs-on: ubuntu-latest |
| 172 | + timeout-minutes: 10 |
| 173 | + environment: |
| 174 | + name: pypi |
| 175 | + url: https://pypi.org/p/pyjpegls |
| 176 | + permissions: |
| 177 | + id-token: write |
| 178 | + |
| 179 | + steps: |
| 180 | + - name: Download the wheels |
| 181 | + uses: actions/download-artifact@v3 |
| 182 | + with: |
| 183 | + name: wheels |
| 184 | + path: dist/ |
| 185 | + |
| 186 | + - name: Publish package to PyPi |
| 187 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments