release #6
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: release | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: build ${{ matrix.os }} ${{ matrix.py }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-latest"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: prep pysqlcipher3 | |
run: | | |
git clone --depth=1 --branch=master https://github.com/rigglemania/pysqlcipher3.git | |
cd pysqlcipher3 | |
mkdir amalgamation | |
cp ../sqlcipher/sqlite3.[ch] amalgamation | |
mkdir src/python3/sqlcipher | |
cp ../sqlcipher/sqlite3.[ch] src/python3/sqlcipher | |
pip install setuptools | |
- name: build pysqlcipher3 linux | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
cd pysqlcipher3 | |
python setup.py build_amalgamation | |
python setup.py build | |
echo 'PLATFORM_TAG="manylinux2014_x86_64"' >> $GITHUB_ENV | |
- name: build pysqlcipher3 macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
brew install openssl | |
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" | |
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" | |
cd pysqlcipher3 | |
python setup.py build_amalgamation | |
python setup.py build | |
echo 'PLATFORM_TAG="macosx_10_9_universal2"' >> $GITHUB_ENV | |
- name: post-build pysqlcipher3 | |
run: | | |
mkdir src/pysqlcipher3 | |
for f in pysqlcipher3/build/lib.*/pysqlcipher3/*.{py,so}; do cp $f src/pysqlcipher3/; done | |
- name: build | |
run: | | |
pip install build | |
python -m build | |
cd dist | |
NEW_NAME=$(ls *.whl | sed "s/any.whl$/${{ env.PLATFORM_TAG }}.whl/") | |
mv *.whl $NEW_NAME | |
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_ENV | |
echo "SDIST_NAME=$(ls *.tar.gz)" >> $GITHUB_ENV | |
- name: test | |
run: | | |
pip install dist/*.whl pytest | |
pytest | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.WHEEL_NAME }} | |
path: "dist/*.whl" | |
- uses: actions/upload-artifact@v4 | |
# only do this once | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: ${{ env.SDIST_NAME }} | |
path: "dist/*.tar.gz" | |
upload: | |
needs: [build] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Copy artifacts to dist/ folder | |
run: | | |
mkdir -p dist/ | |
mv *.tar.gz dist/ | |
mv *.whl dist/ | |
- name: Upload | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip_existing: true |