79 lines
2.2 KiB
YAML
79 lines
2.2 KiB
YAML
name: pytest
|
|
|
|
on: [ workflow_dispatch, workflow_call, push, pull_request ]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
pypi_publish:
|
|
name: Publish (pypi.org)
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CARGO_HOME: ${{ github.workspace }}/.cargo
|
|
RUSTUP_HOME: ${{ github.workspace }}/.rustup
|
|
RUSTUP_TOOLCHAIN: stable
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: 3.x
|
|
|
|
- name: Restore cache
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
~/.cache/pip
|
|
~/.cache/pip-wheel
|
|
~/.cache/sccache
|
|
${{ env.CARGO_HOME }}
|
|
key: cache-ubuntu-maturin-cross-compile
|
|
|
|
- name: Install build dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y build-essential cmake clang llvm lld libclang
|
|
shell: bash
|
|
|
|
- name: Install Rust
|
|
run: |
|
|
export PATH="$CARGO_HOME/bin:$PATH"
|
|
if ! command -v rustup >/dev/null 2>&1; then
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
fi
|
|
rustup toolchain install stable --profile minimal
|
|
rustup default stable
|
|
echo "$CARGO_HOME/bin" >> "$GITHUB_PATH"
|
|
cargo --version
|
|
shell: bash
|
|
|
|
- name: Install sccache and maturin
|
|
run: |
|
|
python -m pip install --upgrade pip maturin ziglang cargo-zigbuild
|
|
# in case an older copy was cargo-installed into the CARGO_HOME cache,
|
|
# prevent it from shadowing the pip-installed one
|
|
rm -f "${CARGO_HOME:?}/bin/cargo-zigbuild" || true
|
|
if ! command -v sccache >/dev/null 2>&1; then
|
|
cargo install sccache || pip install sccache
|
|
fi
|
|
shell: bash
|
|
|
|
- name: PyTest
|
|
run: |
|
|
python -m pip install .
|
|
python -m pytest
|
|
|
|
- name: Store cache
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
~/.cache/pip
|
|
~/.cache/pip-wheel
|
|
~/.cache/sccache
|
|
~/.cache/cargo-xwin
|
|
${{ env.CARGO_HOME }}
|
|
~/.osxcross
|
|
key: cache-ubuntu-maturin-cross-compile
|