perf(rust): argpcp: reduce re-allocations of intermediate matrices (#9) #64
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: 'Python: Build and Test' | |
on: | |
push: | |
branches: | |
- main | |
- master | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- 'changepoint/**' | |
- 'pychangepoint/**' | |
- '.github/workflows/python-build-test.yaml' | |
jobs: | |
lint-python: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: pychangepoint | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: "pychangepoint/requirements-lint.txt" | |
- name: Install Python dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements-lint.txt | |
pip install black[jupyter] | |
- name: Lint Python | |
run: | | |
black --check . | |
blackdoc --check . | |
ruff . --exit-non-zero-on-fix | |
lint-rust: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: pychangepoint | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Run rustfmt | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
env: | |
RUSTFLAGS: -C debuginfo=0 # Do not produce debug symbols to keep memory usage down | |
run : | | |
cargo clippy | |
linux: | |
runs-on: ubuntu-latest | |
needs: ["lint-python", "lint-rust"] | |
strategy: | |
matrix: | |
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --manifest-path pychangepoint/Cargo.toml | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
windows: | |
runs-on: windows-latest | |
needs: ["lint-python", "lint-rust"] | |
strategy: | |
matrix: | |
target: [x64, x86] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
architecture: ${{ matrix.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --manifest-path pychangepoint/Cargo.toml | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
macos: | |
runs-on: macos-latest | |
needs: ["lint-python", "lint-rust"] | |
strategy: | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --manifest-path pychangepoint/Cargo.toml | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/py') | |
needs: [linux, windows, macos] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --skip-existing * |