Skip to content

Upgrade circleci to Python 3.11. #55

Upgrade circleci to Python 3.11.

Upgrade circleci to Python 3.11. #55

Workflow file for this run

name: Build, test, release
on:
push:
branches:
- '*'
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+.dev[0-9]+'
env:
PY_VERSIONS_STR: >-
["3.8", "3.9", "3.10", "3.11"]
VERSIONS_LINUX_STR: >-
["manylinux2014", "manylinux_2_24"]
VERSIONS_MACOS_STR: >-
["macos-11", "macos-12"]
VERSIONS_WINDOWS_STR: >-
["windows-2019"]
jobs:
pass-env:
runs-on: ubuntu-latest
outputs:
py-versions-str: ${{ steps.set-env.outputs.py-versions-str }}
versions-linux-str: ${{ steps.set-env.outputs.versions-linux-str }}
versions-macos-str: ${{ steps.set-env.outputs.versions-macos-str }}
versions-windows-str: ${{ steps.set-env.outputs.versions-windows-str }}
is-from-tag-str: ${{ steps.set-env.outputs.is-from-tag-str }}
is-for-release-str: ${{ steps.set-env.outputs.is-for-release-str }}
steps:
- id: set-env
run: |
echo "::set-output name=py-versions-str::${{ toJSON(env.PY_VERSIONS_STR) }}"
echo "::set-output name=versions-linux-str::${{ toJSON(env.VERSIONS_LINUX_STR) }}"
echo "::set-output name=versions-macos-str::${{ toJSON(env.VERSIONS_MACOS_STR) }}"
echo "::set-output name=versions-windows-str::${{ toJSON(env.VERSIONS_WINDOWS_STR) }}"
echo "::set-output name=is-from-tag-str::${{ toJSON(github.ref_type == 'tag') }}"
echo "::set-output name=is-for-release-str::${{ toJSON(!contains(github.ref_name, 'dev')) }}"
build-linux:
needs: pass-env
strategy:
fail-fast: false
matrix:
image-name: ${{ fromJSON(needs.pass-env.outputs.versions-linux-str) }}
image-arch:
- x86_64
py-version: ${{ fromJSON(needs.pass-env.outputs.py-versions-str) }}
runs-on: ubuntu-latest
container:
image: quay.io/pypa/${{ matrix.image-name }}_${{ matrix.image-arch }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: ./.github/actions/setup-poetry
with:
key-base: ${{ matrix.image-name }}_${{ matrix.image-arch }}-py${{ matrix.py-version }}
use-pipx: true
use-specific-python-version: true
specific-python-version: ${{ matrix.py-version }}
- run: make test
- uses: ./.github/actions/upload-artifacts
with:
make-binary: true
repair-manylinux: true
manylinux-target: ${{ matrix.image-name}}_${{ matrix.image-arch }}
if: ${{ fromJSON(needs.pass-env.outputs.is-from-tag-str) }}
build-macos:
needs: pass-env
strategy:
fail-fast: false
matrix:
arch: ${{ fromJSON(needs.pass-env.outputs.versions-macos-str) }}
py-version: ${{ fromJSON(needs.pass-env.outputs.py-versions-str) }}
runs-on: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.py-version }}
- uses: ./.github/actions/setup-poetry
with:
key-base: ${{ matrix.arch }}-py${{ matrix.py-version }}
use-pipx: false
use-specific-python-version: false
- run: make test
- uses: ./.github/actions/upload-artifacts
with:
make-binary: true
if: ${{ fromJSON(needs.pass-env.outputs.is-from-tag-str) }}
build-windows:
needs: pass-env
strategy:
fail-fast: false
matrix:
arch: ${{ fromJSON(needs.pass-env.outputs.versions-windows-str) }}
py-version: ${{ fromJSON(needs.pass-env.outputs.py-versions-str) }}
runs-on: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: ./.github/actions/setup-mingw
with:
key-base: ${{ matrix.arch }}-py${{ matrix.py-version }}
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.py-version }}
- uses: ./.github/actions/setup-poetry
with:
key-base: ${{ matrix.arch }}-py${{ matrix.py-version }}
use-pipx: false
use-specific-python-version: false
- run: make test
- uses: ./.github/actions/upload-artifacts
with:
make-binary: true
if: ${{ fromJSON(needs.pass-env.outputs.is-from-tag-str) }}
package-source:
needs:
- pass-env
- build-linux
- build-macos
- build-windows
runs-on: ubuntu-latest
if: ${{ fromJSON(needs.pass-env.outputs.is-from-tag-str) }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v3
with:
python-version: ${{ fromJSON(needs.pass-env.outputs.py-versions-str)[0] }}
- uses: ./.github/actions/setup-poetry
with:
key-base: source_linux-py${{ fromJSON(needs.pass-env.outputs.py-versions-str)[0] }}
use-pipx: false
use-specific-python-version: false
- uses: ./.github/actions/upload-artifacts
with:
make-binary: false
upload-pypi:
needs:
- pass-env
- build-linux
- build-macos
- build-windows
- package-source
runs-on: ubuntu-latest
if: ${{ fromJSON(needs.pass-env.outputs.is-from-tag-str) }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v3
with:
python-version: ${{ fromJSON(needs.pass-env.outputs.py-versions-str)[0] }}
- uses: actions/download-artifact@v2
with:
path: dist
- uses: ./.github/actions/setup-poetry
with:
key-base: source_linux-py${{ fromJSON(needs.pass-env.outputs.py-versions-str)[0] }}
use-pipx: false
use-specific-python-version: false
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/artifact/
if: ${{ fromJSON(needs.pass-env.outputs.is-for-release-str) }}
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TESTPYPI_API_TOKEN }}
packages_dir: dist/artifact/
repository_url: https://test.pypi.org/legacy/
if: ${{ !fromJSON(needs.pass-env.outputs.is-for-release-str) }}