bouquin-sqlcipher4/.github/workflows/pythonpackage.yml
2024-02-25 11:13:16 +08:00

183 lines
No EOL
4.7 KiB
YAML

name: Python package
on:
push:
tags:
- 'v*'
jobs:
prepare-sqlite:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- if: steps.sqlite-amalgamation.outputs.cache-hit != 'true'
run: |
cd sqlcipher/
LIBS="-lm" ./configure --disable-tcl --enable-tempstore=always
make sqlite3.c
- uses: actions/upload-artifact@v3
with:
name: sqlite-amalgamation
path: |
sqlcipher/sqlite3.c
sqlcipher/sqlite3.h
build-sdist:
needs: prepare-sqlite
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: false
- uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/download-artifact@v3
with:
name: sqlite-amalgamation
path: ./src/sqlcipher
- name: Build sdist
run: pipx run build --sdist
- name: Test sdist
run: |
python -m pip install dist/sqlcipher3-wheels-*.tar.gz
mv sqlcipher3 sqlcipher3_
python -m test
mv sqlcipher3_ sqlcipher3
- uses: actions/upload-artifact@v3
with:
path: dist/sqlcipher3-wheels-*.tar.gz
build-wheels:
needs: prepare-sqlite
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
cibw_archs: x86_64
cibw_build: "cp*-manylinux_*"
compile_target: x86_64
- os: ubuntu-20.04
cibw_archs: x86_64
cibw_build: "cp*-musllinux_*"
compile_target: x86_64
- os: ubuntu-20.04
cibw_archs: aarch64
cibw_build: "cp*-manylinux_*"
compile_target: armv8
- os: ubuntu-20.04
cibw_archs: aarch64
cibw_build: "cp*-musllinux_*"
compile_target: armv8
- os: ubuntu-20.04
cibw_archs: i686
cibw_build: "cp*-manylinux_*"
compile_target: x86
- os: ubuntu-20.04
cibw_archs: i686
cibw_build: "cp*-musllinux_*"
compile_target: x86
- os: ubuntu-20.04
cibw_archs: ppc64le
cibw_build: "cp*-manylinux_*"
compile_target: ppc64le
- os: ubuntu-20.04
cibw_archs: ppc64le
cibw_build: "cp*-musllinux_*"
compile_target: ppc64le
- os: ubuntu-20.04
cibw_archs: s390x
cibw_build: "cp*-manylinux_*"
compile_target: s390x
- os: ubuntu-20.04
cibw_archs: s390x
cibw_build: "cp*-musllinux_*"
compile_target: s390x
- os: windows-2019
cibw_archs: AMD64
cibw_build: "cp*"
compile_target: x86_64
- os: windows-2019
cibw_archs: x86
cibw_build: "cp*"
compile_target: x86
- os: windows-2019
cibw_archs: ARM64
cibw_build: "cp*"
compile_target: armv8
- os: macos-11
cibw_archs: x86_64
cibw_build: "cp*"
compile_target: x86_64
- os: macos-11
cibw_archs: arm64
cibw_build: "cp*"
compile_target: armv8
- os: macos-11
cibw_archs: universal2
cibw_build: "cp*"
compile_target: universal2
steps:
- uses: actions/checkout@v3
with:
submodules: false
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- uses: actions/download-artifact@v3
with:
name: sqlite-amalgamation
path: ./src/sqlcipher
- name: Build wheels for ${{ matrix.os }} ${{ matrix.cibw_archs }} ${{ matrix.cibw_build }}
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_BUILD_FRONTEND: build
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_ENVIRONMENT: SQLCIPHER3_COMPILE_TARGET=${{ matrix.compile_target }}
CIBW_TEST_COMMAND: >
cd {project} &&
mv sqlcipher3 sqlcipher3_ &&
python -m test &&
mv sqlcipher3_ sqlcipher3
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
upload-pypi:
needs: [build-wheels, build-sdist]
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}