diff options
Diffstat (limited to '.github/workflows/python-publish.yml')
-rw-r--r-- | .github/workflows/python-publish.yml | 85 |
1 files changed, 84 insertions, 1 deletions
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index de63033..54d79f4 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -5,7 +5,85 @@ on: tags: - "v*" +permissions: + contents: read + +env: + python_interpreters: 3.7 3.8 3.9 3.10 3.11 + jobs: + build-rs: + strategy: + matrix: + os: [linux, macos, windows] + target: [x86_64, aarch64] + include: + - os: linux + target: i686 + - os: linux + target: armv7 + - os: linux + target: s390x + - os: linux + target: ppc64le + - os: windows + target: i686 + python-architecture: x86 + runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + architecture: ${{ matrix.python-architecture || 'x64' }} + - name: Build wheels + working-directory: ./sqlglotrs + uses: PyO3/maturin-action@v1 + with: + target: ${{ matrix.target }} + args: --release --out dist --interpreter $python_interpreters + sccache: 'true' + manylinux: auto + - name: Upload wheels + working-directory: ./sqlglotrs + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + sdist-rs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Build sdist + working-directory: ./sqlglotrs + uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + - name: Upload sdist + working-directory: ./sqlglotrs + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist + + deploy-rs: + runs-on: ubuntu-latest + needs: [build-rs, sdist-rs] + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + - name: Publish to PyPI + working-directory: ./sqlglotrs + uses: PyO3/maturin-action@v1 + env: + MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + with: + command: upload + args: --non-interactive --skip-existing * + deploy: runs-on: ubuntu-latest steps: @@ -16,6 +94,8 @@ jobs: python-version: "3.10" - name: Install dependencies run: | + python -m venv .venv + source ./.venv/bin/activate python -m pip install --upgrade pip pip install setuptools wheel twine make install-dev @@ -24,10 +104,13 @@ jobs: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: | + source ./.venv/bin/activate python setup.py sdist bdist_wheel twine upload dist/* - name: Update API docs - run: make docs + run: | + source ./.venv/bin/activate + make docs - name: Update CHANGELOG id: changelog uses: requarks/changelog-action@v1 |