Skip to content

CI

CI #599

Workflow file for this run

name: CI
on:
release:
types: [created]
push:
schedule:
# Runs every Thursday at 20:23 GMT to avoid bit rot
- cron: "20 23 * * 4"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt, clippy
- name: Lint with rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
- name: Lint with clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features
- name: Test with cargo
uses: actions-rs/cargo@v1.0.1
with:
command: test
toolchain: stable
native-build:
runs-on: ${{ matrix.os }}
needs: lint
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Run image
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.3.2
- name: Install package deps
run: |
poetry install
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Rust aarch64-apple-darwin target
if: matrix.os == 'macos-latest'
run: rustup target add aarch64-apple-darwin
- name: Build on macOS universal2
if: matrix.os == 'macos-latest'
shell: bash
env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer
MACOSX_DEPLOYMENT_TARGET: "10.9"
ARCHFLAGS: -arch x86_64 -arch arm64
PYO3_CROSS_LIB_DIR: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib
run: poetry run python setup.py bdist_wheel && poetry install
- name: Build Python package
if: matrix.os != 'macos-latest'
run: poetry run python setup.py bdist_wheel && poetry install
- name: pytest
run: poetry run pytest tests
- name: archive wheels
uses: actions/upload-artifact@v2
if: matrix.os != 'ubuntu-latest'
with:
name: wheels
path: dist/*.whl
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.os != 'ubuntu-latest'
with:
files: dist/sqloxide*.whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
manylinux-build:
if: true
strategy:
fail-fast: false
matrix:
include:
- { tag: manylinux2014, arch: x86_64 }
- { tag: manylinux2014, arch: i686 }
# TODO: figure out a way to renable these, for now far too slow
# to run in github actions (> 6hrs)
# - {tag: manylinux2014, arch: ppc64le}
# - {tag: manylinux2014, arch: aarch64}
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2
with:
path: io
- name: Set up QEMU for multi-arch build
uses: docker/setup-qemu-action@v1
- name: Build Wheels
run: >-
docker run --rm
-e PLAT=${{ matrix.tag }}_${{ matrix.arch }}
-e PACKAGE_NAME=sqloxide
-v `pwd`:/io
--workdir /io
quay.io/pypa/${{ matrix.tag }}_${{ matrix.arch }}
io/build-wheels.sh
- name: Archive Wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: io/dist/*${{ matrix.tag }}_${{ matrix.arch }}.whl
source-build:
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v2
- name: Build source distribution
run: |
pip install -U setuptools wheel setuptools-rust
python setup.py sdist
- name: Archive source distribution
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/*
publish:
runs-on: ubuntu-latest
needs: [manylinux-build, native-build, source-build]
steps:
- uses: actions/download-artifact@v2
with:
name: wheels
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
with:
user: __token__
password: ${{ secrets.PYPI }}
skip_existing: true