. #141
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: test | |
on: | |
push: | |
paths: | |
- 'matcher_py/src/**' | |
- 'matcher_rs/src/**' | |
- 'matcher_c/src/**' | |
- '.github/workflows/test.yml' | |
- '.cargo/config.toml' | |
pull_request: | |
paths: | |
- 'matcher_py/src/**' | |
- 'matcher_rs/src/**' | |
- 'matcher_c/src/**' | |
- '.github/workflows/test.yml' | |
- '.cargo/config.toml' | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
suffix: so | |
# - runner: ubuntu-latest | |
# target: aarch64-unknown-linux-gnu | |
- runner: macos-12 | |
target: x86_64-apple-darwin | |
suffix: dylib | |
- runner: macos-14 | |
target: aarch64-apple-darwin | |
suffix: dylib | |
- runner: windows-latest | |
target: x86_64-pc-windows-gnu | |
suffix: dll | |
- runner: windows-latest | |
target: x86_64-pc-windows-msvc | |
suffix: dll | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
if: matrix.platform.runner == 'ubuntu-latest' && matrix.platform.target == 'aarch64-unknown-linux-gnu' | |
run: sudo apt-get install gcc-aarch64-linux-gnu | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
target: ${{ matrix.platform.target }} | |
- name: Build | |
run: cargo build --release --target ${{ matrix.platform.target }} | |
- name: Test | |
run: cargo test -p matcher_rs --target ${{ matrix.platform.target }} --verbose --no-default-features | |
- name: Test dfa | |
run: cargo test -p matcher_rs --target ${{ matrix.platform.target }} --verbose --no-default-features --features "dfa" | |
- name: Test runtime_build and dfa | |
run: cargo test -p matcher_rs --target ${{ matrix.platform.target }} --verbose --no-default-features --features "runtime_build,dfa" | |
- name: Test serde and dfa | |
run: cargo test -p matcher_rs --target ${{ matrix.platform.target }} --verbose --no-default-features --features "serde,dfa" | |
- name: Run doc | |
run: cargo doc | |
- name: Rename & move | |
shell: bash | |
run: | | |
cp ./target/${{ matrix.platform.target }}/release/*matcher_c.${{ matrix.platform.suffix }} matcher_c/matcher_c.so | |
cp ./target/${{ matrix.platform.target }}/release/*matcher_py.${{ matrix.platform.suffix }} matcher_py/python/matcher_py/matcher_py.so | |
- name: Install Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
env: | |
RUSTFLAGS: "-Z threads=2 -D warnings" | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release -i python3.12 | |
sccache: 'true' | |
rust-toolchain: nightly | |
working-directory: matcher_py | |
- name: Python Test | |
shell: bash | |
if: matrix.platform.runner == 'ubuntu-latest' | |
run: | | |
pip install -U pytest msgspec numpy typing_extensions | |
pip install ./target/wheels/*.whl | |
pytest matcher_py/test |