Skip to content

[pre-commit.ci] pre-commit autoupdate #1777

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #1777

Workflow file for this run

name: Build and upload to PyPI
on:
push:
tags:
- '**'
branches-ignore:
- "dependabot/**"
- "pre-commit-ci-update-config"
pull_request:
concurrency:
group: build-upload-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: pre-commit/[email protected]
build_wheels:
name: Build ${{ matrix.archs }} ${{ matrix.build }} wheels on ${{ matrix.os }}
needs: [lint]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
archs: ["x86_64, i686", "aarch64", "ppc64le", "s390x"]
build: ["manylinux", "musllinux"]
include:
- os: windows-2019
archs: "AMD64"
- os: windows-2019
archs: "x86"
- os: windows-2019
archs: "ARM64"
- os: macos-13
archs: "x86_64"
- os: macos-14
archs: "arm64"
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/[email protected]
if: runner.os == 'Linux'
# see https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
- name: "Install python 3.8 universal2 on macOS arm64"
if: runner.os == 'macOS' && runner.arch == 'ARM64'
uses: actions/setup-python@v5
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
with:
python-version: 3.8
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS: "${{ matrix.archs }}"
CIBW_BUILD: "${{ matrix.build && '*-' || ''}}${{ matrix.build }}*"
CIBW_PRERELEASE_PYTHONS: "${{ !startsWith(github.ref, 'refs/tags/v') }}"
- uses: actions/upload-artifact@v4
with:
name: "cibw-wheels ${{ matrix.build || matrix.os }} ${{ matrix.archs }}"
path: ./wheelhouse/*.whl
build_sdist:
name: Build source distribution
needs: [lint]
runs-on: ubuntu-22.04
env:
CIBUILDWHEEL: 1 # make C extension mandatory
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build sdist
run: pipx run build --sdist
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: "3.11"
- name: Install
run: python -m pip install ${{ github.workspace }}/dist/pybase64*.tar.gz
working-directory: "${{ runner.temp }}"
- name: Test
run: |
python -m pip install -r requirements-test.txt
pytest
- uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_test_pypi:
name: Upload to Test PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-22.04
if: github.event_name == 'push' && github.repository == 'mayeut/pybase64'
environment:
name: test-pypi
url: https://test.pypi.org/p/pybase64
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Upload to Test PyPI
uses: pypa/[email protected]
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
upload_pypi:
name: Upload to PyPI
needs: [upload_test_pypi]
runs-on: ubuntu-22.04
if: github.event_name == 'push' && github.repository == 'mayeut/pybase64' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/pybase64
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Upload to PyPI
uses: pypa/[email protected]
with:
skip-existing: true