change ci #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
pull_request: | |
branches: | |
- "main" | |
- "release/*" | |
- "deps/*" | |
paths-ignore: | |
- "LICENSE" | |
- "SECURITY.md" | |
- "README.md" | |
- "makefile" | |
- ".gitingore" | |
#- ".github/workflows/*" | |
push: | |
branches: | |
- "main" | |
- "release/*" | |
- "deps/*" | |
paths-ignore: | |
- "LICENSE" | |
- "SECURITY.md" | |
- "README.md" | |
- "makefile" | |
- ".gitingore" | |
#- ".github/workflows/*" | |
env: | |
PKG_CONFIG_ALLOW_CROSS: 1 | |
jobs: | |
rust-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: cache-rust | |
name: cache rust | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: run test | |
run: cargo test -p database -p convert -p py_types | |
build: | |
name: build on ${{ matrix.platform || matrix.os }} (${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }}) | |
needs: [rust-test] | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu, macos, windows] | |
target: [x86_64, aarch64] | |
manylinux: [auto] | |
include: | |
- os: ubuntu | |
platform: linux | |
- os: windows | |
ls: dir | |
interpreter: 3.7 3.8 3.9 3.10 3.11 | |
- os: windows | |
ls: dir | |
target: i686 | |
python-architecture: x86 | |
interpreter: 3.7 3.8 3.9 3.10 3.11 | |
- os: macos | |
target: aarch64 | |
interpreter: 3.7 3.8 3.9 3.10 3.11 | |
- os: ubuntu | |
platform: linux | |
target: i686 | |
# GCC 4.8.5 in manylinux2014 container doesn't support c11 atomic | |
# we use manylinux_2_24 container for aarch64 and armv7 targets instead, | |
- os: ubuntu | |
platform: linux | |
target: aarch64 | |
container: messense/manylinux_2_24-cross:aarch64 | |
- os: ubuntu | |
platform: linux | |
target: armv7 | |
container: messense/manylinux_2_24-cross:armv7 | |
interpreter: 3.7 3.8 3.9 3.10 3.11 | |
# musllinux | |
- os: ubuntu | |
platform: linux | |
target: x86_64 | |
manylinux: musllinux_1_1 | |
- os: ubuntu | |
platform: linux | |
target: aarch64 | |
manylinux: musllinux_1_1 | |
- os: ubuntu | |
platform: linux | |
target: ppc64le | |
container: messense/manylinux_2_24-cross:ppc64le | |
interpreter: 3.7 3.8 3.9 3.10 3.11 | |
- os: ubuntu | |
platform: linux | |
target: s390x | |
container: messense/manylinux_2_24-cross:s390x | |
interpreter: 3.7 3.8 3.9 3.10 3.11 | |
exclude: | |
# Optimized PGO builds for x86_64 manylinux and windows follow a different matrix, | |
# maybe in future maturin-action can support this automatically | |
- os: ubuntu | |
target: x86_64 | |
manylinux: auto | |
- os: windows | |
target: x86_64 | |
# Windows on arm64 only supports Python 3.11+ | |
- os: windows | |
target: aarch64 | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
architecture: ${{ matrix.python-architecture || 'x64' }} | |
- run: pip install -U twine 'black>=22.3.0,<23' typing_extensions httpx toml | |
- name: production - check package version | |
if: github.ref == 'refs/heads/main' | |
run: | | |
python .github/prod.py | |
- name: release - check package version | |
if: contains(github.ref, 'release') | |
run: | | |
python .github/release.py | |
- name: build sdist | |
if: ${{ matrix.os == 'ubuntu' && matrix.target == 'x86_64' && matrix.manylinux == 'auto' }} | |
uses: messense/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
rust-toolchain: stable | |
- name: build wheels | |
uses: messense/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: ${{ matrix.manylinux || 'auto' }} | |
container: ${{ matrix.container }} | |
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9' }} | |
rust-toolchain: stable | |
- run: ${{ matrix.ls || 'ls -lh' }} dist/ | |
- run: twine check --strict dist/* | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pypi_files | |
path: dist | |
build-pgo: | |
name: build pgo-optimized on ${{ matrix.platform || matrix.os }} (${{ matrix.interpreter}} - ${{ matrix.target }} - ${{ matrix.manylinux || 'auto' }}) | |
needs: [rust-test] | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu, windows] | |
target: [x86_64] | |
manylinux: [auto] | |
interpreter: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12-dev", "pypy3.7", "pypy3.8", "pypy3.9", "pypy3.10"] | |
include: | |
- os: ubuntu | |
platform: linux | |
- os: windows | |
ls: dir | |
- interpreter: 3.12-dev | |
maturin-interpreter: "3.12" | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.interpreter }} | |
architecture: ${{ matrix.python-architecture || 'x64' }} | |
- name: install rust stable | |
id: rust-toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
components: llvm-tools | |
- run: pip install -U 'black>=22.3.0,<23' typing_extensions | |
- name: build initial wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: ${{ matrix.manylinux || 'auto' }} | |
args: > | |
--release | |
--out pgo-wheel | |
--interpreter ${{ matrix.maturin-interpreter || matrix.interpreter }} | |
rust-toolchain: stable | |
docker-options: -e CI | |
env: | |
RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata" | |
- name: detect rust host | |
run: echo RUST_HOST=$(rustc -Vv | grep host | cut -d ' ' -f 2) >> "$GITHUB_ENV" | |
shell: bash | |
- name: generate pgo data | |
run: | | |
pip install -U pip poetry | |
poetry export -f requirements.txt --without-hashes -o requirements.txt --with dev | |
pip install -r requirements.txt | |
pip install pysqlx-core --no-index --no-deps --find-links pgo-wheel --force-reinstall | |
rustup run stable bash -c 'echo LLVM_PROFDATA=$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata >> "$GITHUB_ENV"' | |
- name: merge pgo data | |
run: ${{ env.LLVM_PROFDATA }} merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata | |
- name: build pgo-optimized wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
manylinux: ${{ matrix.manylinux || 'auto' }} | |
args: > | |
--release | |
--out dist | |
--interpreter ${{ matrix.maturin-interpreter || matrix.interpreter }} | |
rust-toolchain: stable | |
docker-options: -e CI | |
env: | |
RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata" | |
- run: ${{ matrix.ls || 'ls -lh' }} dist/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pypi_files | |
path: dist | |
release: | |
name: Release | |
if: contains(github.ref, 'main') || contains(github.ref, 'release') | |
needs: [build,build-pgo] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: install deps | |
run: pip install -U twine httpx toml | |
- name: production - check package version | |
if: github.ref == 'refs/heads/main' | |
run: | | |
python .github/prod.py | |
- name: release - check package version | |
if: contains(github.ref, 'release') | |
run: | | |
python .github/release.py | |
- name: download articart | |
uses: actions/download-artifact@v2 | |
with: | |
name: pypi_files | |
path: dist | |
- run: twine check --strict dist/* | |
- name: upload to pypi | |
run: twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
- name: create release | |
if: github.ref == 'refs/heads/main' | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.PY_SQLX_VERSION }} | |
release_name: ${{ env.PY_SQLX_VERSION }} | |
body: | | |
Changes in this Release | |
${{ github.event.head_commit.message }} | |
draft: false | |
prerelease: false |