|
| 1 | +name: GH Actions |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + push: |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_sdist: |
| 11 | + name: Build source distribution |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - name: Build sdist |
| 16 | + run: pipx run build --sdist |
| 17 | + - name: Upload artifact |
| 18 | + uses: actions/upload-artifact@v4 |
| 19 | + with: |
| 20 | + name: cibw-sdist |
| 21 | + path: dist/*.tar.gz |
| 22 | + |
| 23 | + build_wheels: |
| 24 | + name: Build wheels on ${{ matrix.os }} |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + include: |
| 29 | + - os: ubuntu-latest |
| 30 | + CIBW_ENVIRONMENT: '' |
| 31 | + CIBW_ARCHS: "x86_64" |
| 32 | + - os: windows-latest |
| 33 | + CIBW_ENVIRONMENT: '' |
| 34 | + CIBW_ARCHS: "AMD64" |
| 35 | + - os: macos-13 # Intel |
| 36 | + CIBW_ENVIRONMENT: > |
| 37 | + MACOSX_DEPLOYMENT_TARGET='10.15' |
| 38 | + CIBW_ARCHS: "x86_64" |
| 39 | + - os: macos-14 # Apple Silicon |
| 40 | + CIBW_ENVIRONMENT: > |
| 41 | + MACOSX_DEPLOYMENT_TARGET='11.0' |
| 42 | + CIBW_ARCHS: "arm64" |
| 43 | + env: |
| 44 | + CIBW_ENVIRONMENT: ${{ matrix.CIBW_ENVIRONMENT }} |
| 45 | + CIBW_SKIP: "*-win32 *i686" |
| 46 | + CIBW_ARCHS: ${{ matrix.CIBW_ARCHS }} |
| 47 | + CIBW_PRERELEASE_PYTHONS: "True" |
| 48 | + steps: |
| 49 | + - uses: ilammy/msvc-dev-cmd@v1 |
| 50 | + if: runner.os == 'Windows' |
| 51 | + with: |
| 52 | + arch: amd64 |
| 53 | + - uses: actions/checkout@v4 |
| 54 | + - name: Build wheels |
| 55 | + |
| 56 | + - uses: actions/upload-artifact@v4 |
| 57 | + with: |
| 58 | + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} |
| 59 | + path: ./wheelhouse/*.whl |
| 60 | + |
| 61 | + test_wheels: |
| 62 | + needs: [build_wheels] |
| 63 | + strategy: |
| 64 | + matrix: |
| 65 | + os: [macos-13, windows-latest, ubuntu-latest] |
| 66 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 67 | + runs-on: ${{ matrix.os }} |
| 68 | + steps: |
| 69 | + - name: Setup Python |
| 70 | + uses: actions/setup-python@v5 |
| 71 | + with: |
| 72 | + python-version: ${{ matrix.python-version }} |
| 73 | + allow-prereleases: true |
| 74 | + architecture: x64 |
| 75 | + - uses: actions/download-artifact@v4 |
| 76 | + with: |
| 77 | + pattern: cibw-wheels-* |
| 78 | + path: dist |
| 79 | + merge-multiple: true |
| 80 | + - name: install wheel (Unix) |
| 81 | + if: runner.os != 'Windows' |
| 82 | + run: | |
| 83 | + pip install numpy pyyaml |
| 84 | + pip install --no-index --find-links $GITHUB_WORKSPACE/dist space_ouija |
| 85 | + - name: install wheel (Windows) |
| 86 | + if: runner.os == 'Windows' |
| 87 | + run: | |
| 88 | + pip install numpy pyyaml |
| 89 | + pip install --no-index --find-links $env:GITHUB_WORKSPACE\dist space_ouija |
| 90 | + - uses: actions/checkout@v4 |
| 91 | + - name: run tests |
| 92 | + run: | |
| 93 | + pip install ddt requests |
| 94 | + python -v tests/full_corpus/test_full_corpus.py |
| 95 | +
|
| 96 | + test_wheels_macos_14: |
| 97 | + needs: [build_wheels] |
| 98 | + strategy: |
| 99 | + matrix: |
| 100 | + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] |
| 101 | + runs-on: macos-14 |
| 102 | + steps: |
| 103 | + - name: add pyenv to path |
| 104 | + run: | |
| 105 | + echo "~/.pyenv/shims" >> $GITHUB_PATH |
| 106 | + - name: install dependencies |
| 107 | + run: | |
| 108 | + brew install pyenv |
| 109 | + brew upgrade pyenv |
| 110 | + pyenv install ${{ matrix.python-version }} |
| 111 | + - uses: actions/download-artifact@v4 |
| 112 | + with: |
| 113 | + pattern: cibw-wheels-* |
| 114 | + path: dist |
| 115 | + merge-multiple: true |
| 116 | + - name: install wheel |
| 117 | + run: | |
| 118 | + pyenv local ${{ matrix.python-version }} |
| 119 | + python3 -m pip install --break-system-packages numpy pyyaml |
| 120 | + python3 -m pip install --break-system-packages --no-index --find-links $GITHUB_WORKSPACE/dist space_ouija |
| 121 | + - uses: actions/checkout@v4 |
| 122 | + - name: run tests |
| 123 | + run: | |
| 124 | + pyenv local ${{ matrix.python-version }} |
| 125 | + python3 -m pip install --break-system-packages ddt requests |
| 126 | + python3 tests/full_corpus/test_full_corpus.py |
| 127 | +
|
| 128 | +
|
| 129 | + upload_pypi: |
| 130 | + needs: [build_sdist, build_wheels, test_wheels, test_wheels_macos_14] |
| 131 | + runs-on: ubuntu-latest |
| 132 | + # upload to PyPI only on github releases |
| 133 | + if: github.event_name == 'release' && github.event.action == 'published' && github.repository_owner == 'SciQLop' |
| 134 | + steps: |
| 135 | + - uses: actions/download-artifact@v4 |
| 136 | + with: |
| 137 | + pattern: cibw-* |
| 138 | + path: dist |
| 139 | + merge-multiple: true |
| 140 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 141 | + with: |
| 142 | + user: __token__ |
| 143 | + password: ${{ secrets.PYPI_PASSWORD }} |
| 144 | + skip-existing: true |
| 145 | + |
| 146 | + upload_test_pypi: |
| 147 | + needs: [build_sdist, build_wheels, test_wheels, test_wheels_macos_14] |
| 148 | + runs-on: ubuntu-latest |
| 149 | + # upload to test PyPI on github pushes |
| 150 | + if: github.event_name == 'push' && github.repository_owner == 'SciQLop' |
| 151 | + steps: |
| 152 | + - uses: actions/download-artifact@v4 |
| 153 | + with: |
| 154 | + pattern: cibw-* |
| 155 | + path: dist |
| 156 | + merge-multiple: true |
| 157 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 158 | + with: |
| 159 | + user: __token__ |
| 160 | + password: ${{ secrets.PYPI_TEST_PASSWORD }} |
| 161 | + repository-url: https://test.pypi.org/legacy/ |
| 162 | + skip-existing: true |
0 commit comments