Skip to content

Fix CI, update release workflow, bump to alpha.2 #5

Fix CI, update release workflow, bump to alpha.2

Fix CI, update release workflow, bump to alpha.2 #5

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
build-and-test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact: graphqlite.so
artifact-name: graphqlite-linux-x86_64.so
- os: macos-14
arch: arm64
artifact: graphqlite.dylib
artifact-name: graphqlite-macos-arm64.dylib
- os: macos-14
arch: x86_64
artifact: graphqlite.dylib
artifact-name: graphqlite-macos-x86_64.dylib
- os: windows-latest
artifact: graphqlite.dll
artifact-name: graphqlite-windows-x86_64.dll
runs-on: ${{ matrix.os }}
defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}
steps:
- uses: actions/checkout@v4
- name: Setup MSYS2 (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-sqlite3
mingw-w64-x86_64-libsystre
bison
flex
make
- name: Install dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y bison flex libsqlite3-dev
- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install bison flex sqlite
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH
echo "HOMEBREW_PREFIX=$(brew --prefix)" >> $GITHUB_ENV
echo "SQLITE_PREFIX=$(brew --prefix sqlite)" >> $GITHUB_ENV
- name: Build extension (Linux)
if: runner.os == 'Linux'
run: make extension RELEASE=1
- name: Build extension (macOS arm64)
if: runner.os == 'macOS' && matrix.arch == 'arm64'
run: make extension RELEASE=1 EXTRA_INCLUDES="-I$HOMEBREW_PREFIX/include" EXTRA_LIBS="-L$HOMEBREW_PREFIX/lib"
- name: Build extension (macOS x86_64 cross-compile)
if: runner.os == 'macOS' && matrix.arch == 'x86_64'
run: make extension RELEASE=1 CC="clang -arch x86_64" EXTRA_INCLUDES="-I$HOMEBREW_PREFIX/include" EXTRA_LIBS="-L$HOMEBREW_PREFIX/lib"
- name: Build extension (Windows)
if: runner.os == 'Windows'
run: make extension RELEASE=1
# Python binding tests
- name: Set up Python (Linux/Windows)
if: runner.os != 'macOS'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install and test Python bindings (Linux)
if: runner.os == 'Linux'
run: |
pip install -e "./bindings/python[dev]"
cd bindings/python && pytest tests/ -v
- name: Install and test Python bindings (macOS)
if: runner.os == 'macOS' && matrix.arch == 'arm64'
run: |
# Use Homebrew Python which supports extension loading
brew install python@3.11
$(brew --prefix python@3.11)/libexec/bin/python -m pip install -e "./bindings/python[dev]"
DYLD_LIBRARY_PATH="$SQLITE_PREFIX/lib:$DYLD_LIBRARY_PATH" $(brew --prefix python@3.11)/libexec/bin/python -m pytest bindings/python/tests/ -v
- name: Install and test Python bindings (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
pip install -e "./bindings/python[dev]"
cd bindings/python && pytest tests/ -v
# Rust binding tests (skip for cross-compiled x86_64)
- name: Install Rust toolchain
if: matrix.arch != 'x86_64'
uses: dtolnay/rust-toolchain@stable
- name: Test Rust bindings
if: matrix.arch != 'x86_64'
working-directory: bindings/rust
shell: bash
run: cargo test -- --test-threads=1
- name: Rename artifact
run: cp build/${{ matrix.artifact }} build/${{ matrix.artifact-name }}
- name: Upload extension artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: build/${{ matrix.artifact-name }}
publish-python:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: pip install build twine
- name: Build source distribution
working-directory: bindings/python
run: python -m build --sdist
- name: Publish to PyPI
working-directory: bindings/python
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload dist/*
publish-rust:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
working-directory: bindings/rust
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --allow-dirty
create-release:
needs: [build-and-test, publish-python, publish-rust]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/**/*
generate_release_notes: true