|
| 1 | +name: "Test Python Lib" |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + - devel |
| 7 | + - deploy |
| 8 | + pull_request: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + pull-requests: read |
| 13 | + |
| 14 | +jobs: |
| 15 | + test-windows: |
| 16 | + strategy: |
| 17 | + matrix: |
| 18 | + os: [windows-latest] |
| 19 | + python: ['3.9', '3.10', '3.11', '3.12'] |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Setup python |
| 26 | + uses: actions/setup-python@v4 |
| 27 | + with: |
| 28 | + python-version: ${{ matrix.python }} |
| 29 | + |
| 30 | + - name: Install dependencies |
| 31 | + run: | |
| 32 | + pip install setuptools |
| 33 | + pip install matplotlib |
| 34 | + pip install pytest |
| 35 | + |
| 36 | + - name: Install lib |
| 37 | + run: | |
| 38 | + python setup.py develop |
| 39 | +
|
| 40 | + - name: pytest |
| 41 | + run: | |
| 42 | + pytest GPy/testing |
| 43 | +
|
| 44 | + test-linux: |
| 45 | + strategy: |
| 46 | + matrix: |
| 47 | + os: [ubuntu-latest] |
| 48 | + python: ['3.9', '3.10', '3.11', '3.12'] |
| 49 | + runs-on: ${{ matrix.os }} |
| 50 | + steps: |
| 51 | + - name: Checkout |
| 52 | + uses: actions/checkout@v4 |
| 53 | + |
| 54 | + - name: Setup python |
| 55 | + uses: actions/setup-python@v4 |
| 56 | + with: |
| 57 | + python-version: ${{ matrix.python }} |
| 58 | + |
| 59 | + - name: Install dependencies |
| 60 | + run: | |
| 61 | + pip install setuptools |
| 62 | + pip install matplotlib |
| 63 | + pip install pytest |
| 64 | + |
| 65 | + - name: Install lib |
| 66 | + run: | |
| 67 | + python setup.py develop |
| 68 | +
|
| 69 | + - name: pytest |
| 70 | + run: | |
| 71 | + pytest GPy/testing |
| 72 | + test-macos: |
| 73 | + strategy: |
| 74 | + matrix: |
| 75 | + os: [macos-latest] |
| 76 | + python: ['3.10', '3.11', '3.12'] |
| 77 | + runs-on: ${{ matrix.os }} |
| 78 | + steps: |
| 79 | + - name: Checkout |
| 80 | + uses: actions/checkout@v4 |
| 81 | + |
| 82 | + - name: Setup python |
| 83 | + uses: actions/setup-python@v4 |
| 84 | + with: |
| 85 | + python-version: ${{ matrix.python }} |
| 86 | + |
| 87 | + - name: Install dependencies |
| 88 | + run: | |
| 89 | + pip install setuptools |
| 90 | + pip install matplotlib |
| 91 | + pip install pytest |
| 92 | + |
| 93 | + - name: Install lib |
| 94 | + run: | |
| 95 | + python setup.py develop |
| 96 | +
|
| 97 | + - name: pytest |
| 98 | + run: | |
| 99 | + pytest GPy/testing |
| 100 | +
|
| 101 | + build-windows: |
| 102 | + if: github.event_name == 'release' |
| 103 | + strategy: |
| 104 | + matrix: |
| 105 | + os: [windows-latest] |
| 106 | + python: ['3.9', '3.10', '3.11', '3.12'] |
| 107 | + runs-on: ${{ matrix.os }} |
| 108 | + steps: |
| 109 | + - name: Checkout |
| 110 | + uses: actions/checkout@v4 |
| 111 | + |
| 112 | + - name: Setup python |
| 113 | + uses: actions/setup-python@v4 |
| 114 | + with: |
| 115 | + python-version: ${{ matrix.python }} |
| 116 | + |
| 117 | + - name: Build lib |
| 118 | + run: | |
| 119 | + pip install setuptools |
| 120 | + pip install wheel |
| 121 | + python setup.py develop |
| 122 | + python setup.py bdist_wheel |
| 123 | + python setup.py sdist bdist_wheel |
| 124 | +
|
| 125 | + - name: List contents of dist |
| 126 | + run: ls -R dist |
| 127 | + |
| 128 | + - name: Archive build artifacts |
| 129 | + uses: actions/upload-artifact@v3 |
| 130 | + with: |
| 131 | + name: dist-artifacts-${{ matrix.os }}-${{ matrix.python }} |
| 132 | + path: dist |
| 133 | + |
| 134 | + build-macos: |
| 135 | + if: github.event_name == 'release' |
| 136 | + strategy: |
| 137 | + matrix: |
| 138 | + os: [macos-latest] |
| 139 | + python: ['3.10', '3.11', '3.12'] # 3.9 triggers scipy issues when installing |
| 140 | + runs-on: ${{ matrix.os }} |
| 141 | + steps: |
| 142 | + - name: Checkout |
| 143 | + uses: actions/checkout@v4 |
| 144 | + |
| 145 | + - name: Setup python |
| 146 | + uses: actions/setup-python@v4 |
| 147 | + with: |
| 148 | + python-version: ${{ matrix.python }} |
| 149 | + |
| 150 | + - name: Build lib |
| 151 | + run: | |
| 152 | + pip install setuptools |
| 153 | + pip install wheel |
| 154 | + python setup.py develop |
| 155 | + python setup.py bdist_wheel |
| 156 | +
|
| 157 | + - name: List contents of dist |
| 158 | + run: ls -R dist |
| 159 | + |
| 160 | + - name: Archive build artifacts |
| 161 | + uses: actions/upload-artifact@v3 |
| 162 | + with: |
| 163 | + name: dist-artifacts-${{ matrix.os }}-${{ matrix.python }} |
| 164 | + path: dist/* |
| 165 | + |
| 166 | + build-linux: |
| 167 | + if: github.event_name == 'release' |
| 168 | + strategy: |
| 169 | + matrix: |
| 170 | + python: ['cp39-cp39', 'cp310-cp310', 'cp311-cp311', 'cp312-cp312'] |
| 171 | + runs-on: ubuntu-latest |
| 172 | + container: |
| 173 | + image: quay.io/pypa/manylinux2014_x86_64 |
| 174 | + |
| 175 | + steps: |
| 176 | + - name: Checkout |
| 177 | + uses: actions/checkout@v3 |
| 178 | + |
| 179 | + - name: Compile c headers |
| 180 | + run: | |
| 181 | + /opt/python/${{ matrix.python }}/bin/python setup.py develop |
| 182 | +
|
| 183 | + - name: Build wheel files |
| 184 | + run: | |
| 185 | + /opt/python/${{ matrix.python }}/bin/python setup.py bdist_wheel |
| 186 | +
|
| 187 | + - name: Install auditwheel # this should be available?! |
| 188 | + run: | |
| 189 | + /opt/python/${{ matrix.python }}/bin/python -m pip install auditwheel |
| 190 | + |
| 191 | + - name: Repair wheel files |
| 192 | + run: | |
| 193 | + /opt/python/${{ matrix.python }}/bin/python -m auditwheel repair dist/*${{ matrix.python }}-linux_x86_64.whl |
| 194 | +
|
| 195 | + - name: List contents of dist |
| 196 | + run: ls -R dist |
| 197 | + |
| 198 | + - name: List contests of wheelhouse |
| 199 | + run: ls -R wheelhouse |
| 200 | + |
| 201 | + - name: Move wheelhouse wheel files to dist |
| 202 | + run: | |
| 203 | + rm dist/* |
| 204 | + mv wheelhouse/* dist/ |
| 205 | + rmdir wheelhouse |
| 206 | +
|
| 207 | + - name: List contents of dist |
| 208 | + run: ls -R dist |
| 209 | + |
| 210 | + - name: Archive build artifacts |
| 211 | + uses: actions/upload-artifact@v3 |
| 212 | + with: |
| 213 | + name: dist-artifacts-manylinux-${{ matrix.python }} |
| 214 | + path: dist/* |
| 215 | + |
| 216 | + deploy: |
| 217 | + runs-on: ubuntu-latest |
| 218 | + needs: [test-windows, test-linux, test-macos, build-linux, build-windows, build-macos] |
| 219 | + if: github.event_name == 'release' |
| 220 | + steps: |
| 221 | + - name: Checkout |
| 222 | + uses: actions/checkout@v4 |
| 223 | + |
| 224 | + - name: Setup python |
| 225 | + uses: actions/setup-python@v4 |
| 226 | + with: |
| 227 | + python-version: '3.9' |
| 228 | + |
| 229 | + - name: Install twine |
| 230 | + run: | |
| 231 | + pip install --upgrade pip |
| 232 | + pip install twine |
| 233 | + |
| 234 | + - name: Download all artifacts to a specific directory |
| 235 | + uses: actions/download-artifact@v3 |
| 236 | + with: |
| 237 | + path: dist |
| 238 | + |
| 239 | + - name: Create dist directory |
| 240 | + run: mkdir -p dist |
| 241 | + |
| 242 | + - name: Move files from subdirectories |
| 243 | + run: | |
| 244 | + for subdirectory in dist/*/; do |
| 245 | + dir_name=$(basename "$subdirectory") |
| 246 | + mv "$subdirectory"* dist/ |
| 247 | + rm -r "$subdirectory" |
| 248 | + echo "Moved files from '$dir_name' to 'dist/'" |
| 249 | + done |
| 250 | +
|
| 251 | + - name: Inspect wheel files |
| 252 | + run: | |
| 253 | + ls -R dist |
| 254 | +
|
| 255 | + - name: Upload to PyPI using twine |
| 256 | + run: twine upload --skip-existing dist/* |
| 257 | + env: |
| 258 | + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| 259 | + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
0 commit comments