|
| 1 | +# (C) Copyright 2024- ECMWF. |
| 2 | +# |
| 3 | +# This software is licensed under the terms of the Apache Licence Version 2.0 |
| 4 | +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. |
| 5 | +# In applying this licence, ECMWF does not waive the privileges and immunities |
| 6 | +# granted to it by virtue of its status as an intergovernmental organisation |
| 7 | +# nor does it submit to any jurisdiction. |
| 8 | + |
| 9 | + |
| 10 | +name: Build Windows |
| 11 | + |
| 12 | +on: |
| 13 | + # Trigger the workflow manually |
| 14 | + workflow_dispatch: ~ |
| 15 | + |
| 16 | + # Allow to be called from another workflow |
| 17 | + workflow_call: ~ |
| 18 | + |
| 19 | + push: |
| 20 | + tags-ignore: |
| 21 | + - '**' |
| 22 | + paths: |
| 23 | + - 'scripts/common.sh' |
| 24 | + - 'scripts/wheel-windows.sh' |
| 25 | + - 'scripts/build-windows.sh' |
| 26 | + - 'scripts/copy-dlls.py' |
| 27 | + - 'scripts/copy-licences.py' |
| 28 | + - '.github/workflows/build-wheel-windows.yml' |
| 29 | + |
| 30 | + |
| 31 | +jobs: |
| 32 | + |
| 33 | + build: |
| 34 | + |
| 35 | + # if: false # for temporarily disabling for debugging |
| 36 | + |
| 37 | + runs-on: windows-latest |
| 38 | + |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + architecture: ["x64"] |
| 43 | + |
| 44 | + defaults: |
| 45 | + run: |
| 46 | + shell: bash |
| 47 | + |
| 48 | + |
| 49 | + name: Build on ${{ matrix.architecture }} |
| 50 | + env: |
| 51 | + WINARCH: ${{ matrix.architecture }} |
| 52 | + |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v2 |
| 55 | + |
| 56 | + - uses: seanmiddleditch/gha-setup-vsdevenv@master |
| 57 | + with: |
| 58 | + arch: ${{ matrix.architecture }} |
| 59 | + |
| 60 | + - name: Set up Python |
| 61 | + uses: actions/setup-python@v4 |
| 62 | + with: |
| 63 | + python-version: 3.8 |
| 64 | + architecture: ${{ matrix.architecture }} |
| 65 | + |
| 66 | + - run: ./scripts/build-windows.sh |
| 67 | + env: |
| 68 | + WINARCH: ${{ matrix.architecture }} |
| 69 | + |
| 70 | + |
| 71 | + ################################################################ |
| 72 | + - name: Set up Python 3.8 |
| 73 | + uses: actions/setup-python@v4 |
| 74 | + with: |
| 75 | + python-version: 3.8 |
| 76 | + architecture: ${{ matrix.architecture }} |
| 77 | + |
| 78 | + - run: ./scripts/wheel-windows.sh 3.8 |
| 79 | + - uses: actions/upload-artifact@v4 |
| 80 | + name: Upload wheel 3.8 |
| 81 | + with: |
| 82 | + name: wheel-windows-3.8-${{ matrix.architecture }} |
| 83 | + path: wheelhouse/*.whl |
| 84 | + |
| 85 | + ################################################################ |
| 86 | + |
| 87 | + - name: Set up Python 3.9 |
| 88 | + uses: actions/setup-python@v4 |
| 89 | + with: |
| 90 | + python-version: 3.9 |
| 91 | + architecture: ${{ matrix.architecture }} |
| 92 | + |
| 93 | + - run: ./scripts/wheel-windows.sh 3.9 |
| 94 | + - uses: actions/upload-artifact@v4 |
| 95 | + name: Upload wheel 3.9 |
| 96 | + with: |
| 97 | + name: wheel-windows-3.9-${{ matrix.architecture }} |
| 98 | + path: wheelhouse/*.whl |
| 99 | + |
| 100 | + ################################################################ |
| 101 | + |
| 102 | + - name: Set up Python 3.10 |
| 103 | + uses: actions/setup-python@v4 |
| 104 | + with: |
| 105 | + python-version: "3.10" |
| 106 | + architecture: ${{ matrix.architecture }} |
| 107 | + |
| 108 | + - run: ./scripts/wheel-windows.sh "3.10" |
| 109 | + - uses: actions/upload-artifact@v4 |
| 110 | + name: Upload wheel 3.10 |
| 111 | + with: |
| 112 | + name: wheel-windows-3.10-${{ matrix.architecture }} |
| 113 | + path: wheelhouse/*.whl |
| 114 | + |
| 115 | + ################################################################ |
| 116 | + |
| 117 | + - name: Set up Python 3.11 |
| 118 | + uses: actions/setup-python@v4 |
| 119 | + with: |
| 120 | + python-version: "3.11" |
| 121 | + architecture: ${{ matrix.architecture }} |
| 122 | + |
| 123 | + - run: ./scripts/wheel-windows.sh "3.11" |
| 124 | + - uses: actions/upload-artifact@v4 |
| 125 | + name: Upload wheel 3.11 |
| 126 | + with: |
| 127 | + name: wheel-windows-3.11-${{ matrix.architecture }} |
| 128 | + path: wheelhouse/*.whl |
| 129 | + |
| 130 | + ################################################################ |
| 131 | + |
| 132 | + - name: Set up Python 3.12 |
| 133 | + uses: actions/setup-python@v4 |
| 134 | + with: |
| 135 | + python-version: "3.12" |
| 136 | + architecture: ${{ matrix.architecture }} |
| 137 | + |
| 138 | + - run: ./scripts/wheel-windows.sh "3.12" |
| 139 | + - uses: actions/upload-artifact@v4 |
| 140 | + name: Upload wheel 3.12 |
| 141 | + with: |
| 142 | + name: wheel-windows-3.12-${{ matrix.architecture }} |
| 143 | + path: wheelhouse/*.whl |
| 144 | + |
| 145 | + ################################################################ |
| 146 | + |
| 147 | + |
| 148 | + test: |
| 149 | + needs: build |
| 150 | + runs-on: windows-latest |
| 151 | + strategy: |
| 152 | + fail-fast: true |
| 153 | + matrix: |
| 154 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 155 | + architecture: ["x64"] |
| 156 | + |
| 157 | + defaults: |
| 158 | + run: |
| 159 | + shell: bash |
| 160 | + |
| 161 | + name: Test with Python ${{ matrix.python-version }} ${{ matrix.architecture }} |
| 162 | + |
| 163 | + steps: |
| 164 | + - uses: actions/checkout@v2 |
| 165 | + |
| 166 | + - name: Set up Python |
| 167 | + uses: actions/setup-python@v4 |
| 168 | + with: |
| 169 | + python-version: ${{ matrix.python-version }} |
| 170 | + architecture: ${{ matrix.architecture }} |
| 171 | + |
| 172 | + - uses: actions/download-artifact@v4 |
| 173 | + with: |
| 174 | + name: wheel-windows-${{ matrix.python-version }}-${{ matrix.architecture }} |
| 175 | + |
| 176 | + - run: pip install *.whl |
| 177 | + |
| 178 | + - run: pip install -r tests/requirements.txt |
| 179 | + |
| 180 | + - run: pip freeze |
| 181 | + |
| 182 | + - run: ECCODES_PYTHON_TRACE_LIB_SEARCH=1 pytest --verbose -s |
| 183 | + working-directory: tests |
| 184 | + timeout-minutes: 2 |
| 185 | + |
| 186 | + |
| 187 | + deploy: |
| 188 | + if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }} |
| 189 | + |
| 190 | + needs: [test, build] |
| 191 | + |
| 192 | + name: Deploy wheel ${{ matrix.python-version }} ${{ matrix.architecture }} |
| 193 | + |
| 194 | + runs-on: ubuntu-latest |
| 195 | + strategy: |
| 196 | + fail-fast: true |
| 197 | + matrix: |
| 198 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 199 | + architecture: ["x64"] |
| 200 | + |
| 201 | + steps: |
| 202 | + - name: Set up Python |
| 203 | + uses: actions/setup-python@v4 |
| 204 | + with: |
| 205 | + python-version: ${{ matrix.python-version }} |
| 206 | + |
| 207 | + - run: pip install twine |
| 208 | + |
| 209 | + - uses: actions/download-artifact@v4 |
| 210 | + with: |
| 211 | + name: wheel-windows-${{ matrix.python-version }}-${{ matrix.architecture }} |
| 212 | + |
| 213 | + - run: twine upload *.whl |
| 214 | + env: |
| 215 | + TWINE_USERNAME: __token__ |
| 216 | + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments