Add test during building

This commit is contained in:
laggykiller 2024-02-25 10:55:29 +08:00
parent 24477fdc4d
commit d4eba9ac42
4 changed files with 71 additions and 32 deletions

View file

@ -12,11 +12,13 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: true submodules: true
- if: steps.sqlite-amalgamation.outputs.cache-hit != 'true' - if: steps.sqlite-amalgamation.outputs.cache-hit != 'true'
run: | run: |
cd sqlcipher/ cd sqlcipher/
LIBS="-lm" ./configure --disable-tcl --enable-tempstore=always LIBS="-lm" ./configure --disable-tcl --enable-tempstore=always
make sqlite3.c make sqlite3.c
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: sqlite-amalgamation name: sqlite-amalgamation
@ -24,8 +26,59 @@ jobs:
sqlcipher/sqlite3.c sqlcipher/sqlite3.c
sqlcipher/sqlite3.h 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: ./
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/sqlcipher3_wheels-*.tar.gz
test-sdist:
needs: build-sdist
runs-on: ubuntu-20.04
steps:
- name: Fetch source distribution
uses: actions/download-artifact@v3
with:
name: sdist
path: dist/
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install the package
run: |
python -m pip install dist/sqlcipher3_wheels-*.tar.gz
- name: Test
run: |
mv sqlcipher3 sqlcipher3_
python -m test
mv sqlcipher3_ sqlcipher3
build-wheels: build-wheels:
needs: [prepare-sqlite] needs: prepare-sqlite
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -99,7 +152,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
submodules: true submodules: false
- uses: actions/setup-python@v4 - uses: actions/setup-python@v4
with: with:
@ -123,44 +176,29 @@ jobs:
CIBW_BUILD: ${{ matrix.cibw_build }} CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS: ${{ matrix.cibw_archs }} CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_ENVIRONMENT: SQLCIPHER3_COMPILE_TARGET=${{ matrix.compile_target }} CIBW_ENVIRONMENT: SQLCIPHER3_COMPILE_TARGET=${{ matrix.compile_target }}
CIBW_TEST_COMMAND: >
mv sqlcipher3 sqlcipher3_ &&
python -m test &&
mv sqlcipher3_ sqlcipher3
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: wheels
path: ./wheelhouse/*.whl path: ./wheelhouse/*.whl
build-sdist:
needs: [prepare-sqlite]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
- uses: actions/setup-python@v4
with:
python-version: 3.8
- uses: actions/download-artifact@v3
with:
name: sqlite-amalgamation
path: ./
- name: Build sdist
run: pipx run build --sdist
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
upload-pypi: upload-pypi:
needs: [build-wheels, build-sdist] needs: [build-wheels, test-sdist]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/download-artifact@v3 - uses: actions/download-artifact@v3
with: with:
name: artifact name: sdist
path: dist
- uses: actions/download-artifact@v3
with:
name: wheels
path: dist path: dist
- uses: pypa/gh-action-pypi-publish@release/v1 - uses: pypa/gh-action-pypi-publish@release/v1

1
.gitignore vendored
View file

@ -4,3 +4,4 @@ dist/*
sqlcipher3.egg-info/* sqlcipher3.egg-info/*
_sqlite*.so _sqlite*.so
conan_output/* conan_output/*
__pycache__

View file

@ -1,6 +1,6 @@
[project] [project]
name = "sqlcipher3-wheels" name = "sqlcipher3-wheels"
version = "0.5.2" version = "0.5.2.post0"
description = "DB-API 2.0 interface for SQLCipher 3.x" description = "DB-API 2.0 interface for SQLCipher 3.x"
readme = { content-type = "text/markdown", file = "README.md" } readme = { content-type = "text/markdown", file = "README.md" }
authors = [{ name = "Charles Leifer", email = "coleifer@gmail.com" }] authors = [{ name = "Charles Leifer", email = "coleifer@gmail.com" }]

View file

@ -191,6 +191,6 @@ if __name__ == "__main__":
setup( setup(
# name and version for building python 3.6 wheel # name and version for building python 3.6 wheel
name="sqlcipher3-wheels", name="sqlcipher3-wheels",
version="0.5.2", version="0.5.2.post0",
ext_modules=[module], ext_modules=[module],
) )