|
| 1 | +name: Build wheel and sdist for a non-pure Python package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + |
| 6 | +jobs: |
| 7 | + build_sdist: |
| 8 | + defaults: |
| 9 | + run: |
| 10 | + shell: bash -l {0} |
| 11 | + |
| 12 | + name: Build sdist |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Check out |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Initialize miniconda |
| 19 | + uses: conda-incubator/setup-miniconda@v3 |
| 20 | + with: |
| 21 | + activate-environment: sdist |
| 22 | + channels: conda-forge |
| 23 | + auto-update-conda: true |
| 24 | + auto-activate-base: false |
| 25 | + python-version: 3.13 |
| 26 | + |
| 27 | + - name: Conda config |
| 28 | + run: >- |
| 29 | + conda config --set always_yes yes |
| 30 | + --set changeps1 no |
| 31 | +
|
| 32 | + - name: Build sdist |
| 33 | + run: | |
| 34 | + pip install --upgrade build |
| 35 | + python -m build --sdist |
| 36 | +
|
| 37 | + - uses: actions/upload-artifact@v4 |
| 38 | + with: |
| 39 | + name: cibw-sdist |
| 40 | + path: ./dist/*.tar.gz |
| 41 | + |
| 42 | + build-wheels: |
| 43 | + needs: [build_sdist] |
| 44 | + defaults: |
| 45 | + run: |
| 46 | + shell: bash -l {0} |
| 47 | + |
| 48 | + name: cibw-wheels-${{ matrix.python }}-${{ matrix.buildplat }} |
| 49 | + runs-on: ${{ matrix.buildplat }} |
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: |
| 53 | + buildplat: |
| 54 | + - ubuntu-latest |
| 55 | + - macos-13 |
| 56 | + - macos-14 |
| 57 | + - windows-latest |
| 58 | + python: |
| 59 | + - "3.11" |
| 60 | + - "3.12" |
| 61 | + - "3.13" |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Check out |
| 65 | + uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Initialize miniconda |
| 68 | + uses: conda-incubator/setup-miniconda@v3 |
| 69 | + with: |
| 70 | + activate-environment: build |
| 71 | + channels: conda-forge |
| 72 | + auto-update-conda: true |
| 73 | + auto-activate-base: false |
| 74 | + python-version: ${{ matrix.python }} |
| 75 | + |
| 76 | + - name: Conda config |
| 77 | + run: >- |
| 78 | + conda config --set always_yes yes |
| 79 | + --set changeps1 no |
| 80 | +
|
| 81 | + - name: Install requirements |
| 82 | + run: | |
| 83 | + conda install --file requirements/conda.txt |
| 84 | + conda install --file requirements/pip.txt |
| 85 | + pip install --upgrade build |
| 86 | + python -m pip wheel --no-deps --wheel-dir ./dist . |
| 87 | +
|
| 88 | + - name: Upload wheels to GitHub |
| 89 | + uses: actions/upload-artifact@v4 |
| 90 | + with: |
| 91 | + name: ${{ matrix.python }}-${{ matrix.buildplat }}.whl |
| 92 | + path: ./dist/*.whl |
| 93 | + |
| 94 | + test-wheels: |
| 95 | + needs: [build-wheels] |
| 96 | + defaults: |
| 97 | + run: |
| 98 | + shell: bash -l {0} |
| 99 | + |
| 100 | + name: test-wheels-${{ matrix.python }}-${{ matrix.buildplat }} |
| 101 | + runs-on: ${{ matrix.buildplat }} |
| 102 | + strategy: |
| 103 | + fail-fast: false |
| 104 | + matrix: |
| 105 | + buildplat: |
| 106 | + - ubuntu-latest |
| 107 | + - macos-13 |
| 108 | + - macos-14 |
| 109 | + - windows-latest |
| 110 | + python: |
| 111 | + - "3.11" |
| 112 | + - "3.12" |
| 113 | + - "3.13" |
| 114 | + |
| 115 | + steps: |
| 116 | + - name: Check out |
| 117 | + uses: actions/checkout@v4 |
| 118 | + |
| 119 | + - name: Download wheels |
| 120 | + uses: actions/download-artifact@v4 |
| 121 | + with: |
| 122 | + name: ${{ matrix.python }}-${{ matrix.buildplat }}.whl |
| 123 | + path: ./dist |
| 124 | + |
| 125 | + - name: Initialize miniconda |
| 126 | + uses: conda-incubator/setup-miniconda@v3 |
| 127 | + with: |
| 128 | + activate-environment: test |
| 129 | + channels: conda-forge |
| 130 | + auto-update-conda: true |
| 131 | + auto-activate-base: false |
| 132 | + python-version: ${{ matrix.python }} |
| 133 | + |
| 134 | + - name: Conda config |
| 135 | + run: >- |
| 136 | + conda config --set always_yes yes |
| 137 | + --set changeps1 no |
| 138 | +
|
| 139 | + - name: Install requirements |
| 140 | + run: | |
| 141 | + conda install --file requirements/conda.txt |
| 142 | + conda install --file requirements/tests.txt |
| 143 | +
|
| 144 | + - name: Install wheel and test |
| 145 | + run: | |
| 146 | + pip install ./dist/*.whl |
| 147 | + pytest |
0 commit comments