Fix linux #393
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: | |
branches: | |
- main | |
tags: [ "*" ] | |
pull_request: | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Rustfmt | |
run: cargo fmt --all -- --check | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
# TODO: Put ruff in pyproject.toml dev dependencies and use lockfile version | |
# or ruff github action | |
- uses: chartboost/ruff-action@v1 | |
with: | |
version: 0.0.292 | |
- uses: psf/[email protected] | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: Swatinem/rust-cache@v2 | |
- name: Clippy | |
run: cargo clippy --tests --all-features -- -D warnings | |
test-cargo: | |
name: Test Cargo | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
archive: maturin-x86_64-unknown-linux-gnu.tar.gz | |
- os: macos-latest | |
archive: maturin-x86_64-apple-darwin.tar.gz | |
- os: windows-latest | |
archive: maturin-x86_64-pc-windows-msvc.zip | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Make this the active python | |
- name: Install python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: 'pip' | |
cache-dependency-path: 'requirements-test.txt' | |
- run: pip install pytest virtualenv | |
- uses: Swatinem/rust-cache@v2 | |
# We need normal poetry as reference; Pin to a specific version since we diff against the output | |
- name: Install poetry | |
run: pipx install poetry==1.6.1 | |
- name: cargo build | |
run: cargo build --release --features cli | |
- name: Cache popular wheels | |
id: cache-popular-wheels | |
uses: actions/cache@v3 | |
with: | |
path: test-data/popular-wheels | |
key: cache-popular-wheels-${{ runner.os }}-${{ hashFiles('test-data/popular.txt') }} | |
- name: Download popular wheels | |
if: steps.cache-popular-wheels.outputs.cache-hit != 'true' | |
run: pip download -d test-data/popular-wheels -r test-data/popular.txt | |
- name: cargo test | |
run: cargo test --release --features cli | |
env: | |
RUST_LOG: monotrail=trace # For debugging ci failures | |
- name: pytest test/install_wheel_rs | |
run: pytest test/install_wheel_rs | |
- name: pytest test/monotrail_bin | |
run: pytest test/monotrail_bin | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: hyperfine | |
- name: Benchmark plotly and tqdm | |
#if: matrix.os == 'ubuntu-latest' | |
if: matrix.os == 'skip-for-slowness' | |
run: | | |
virtualenv .venv-benchmark | |
VIRTUAL_ENV=.venv-benchmark hyperfine -r 5 -p ".venv-benchmark/bin/pip uninstall -y plotly" \ | |
"target/release/monotrail install test-data/popular-wheels/plotly-5.5.0-py2.py3-none-any.whl" \ | |
".venv-benchmark/bin/pip install --no-deps test-data/popular-wheels/plotly-5.5.0-py2.py3-none-any.whl" | |
VIRTUAL_ENV=.venv-benchmark hyperfine -p ".venv-benchmark/bin/pip uninstall -y tqdm" \ | |
"target/release/monotrail install test-data/popular-wheels/tqdm-4.62.3-py2.py3-none-any.whl" \ | |
".venv-benchmark/bin/pip install --no-deps test-data/popular-wheels/tqdm-4.62.3-py2.py3-none-any.whl" | |
#VIRTUAL_ENV=.venv-benchmark hyperfine -r 5 -p ".venv-benchmark/bin/pip uninstall -y plotly" \ | |
# "target/release/monotrail install --no-compile wheels/plotly-5.5.0-py2.py3-none-any.whl" \ | |
# ".venv-benchmark/bin/pip install --no-compile --no-deps wheels/plotly-5.5.0-py2.py3-none-any.whl" | |
rm -r .venv-benchmark | |
- name: Archive binary (windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
cd target/release | |
7z a ../../${{ matrix.archive }} monotrail.exe | |
cd - | |
- name: Archive binary (linux and macOS) | |
if: matrix.os != 'windows-latest' | |
run: | | |
cd target/release | |
tar czvf ../../${{ matrix.archive }} monotrail | |
cd - | |
- name: Upload Binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: binaries | |
path: ${{ matrix.archive }} | |
upload-binaries: | |
name: Upload Binaries | |
runs-on: ubuntu-latest | |
needs: [ test-cargo ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download wheels | |
uses: actions/download-artifact@v3 | |
with: | |
name: binaries | |
path: binaries | |
- name: Deploy to github pages | |
if: ${{ github.event_name != 'pull_request' }} | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: binaries | |
target-folder: ${{ github.ref_name }} | |
test-maturin: | |
name: Test Maturin | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-latest, windows-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Make this the active python | |
- name: Install python 3.8 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
cache: 'pip' | |
cache-dependency-path: 'requirements-test.txt' | |
- name: Install virtualenv requirements-test.txt | |
run: pip install -r requirements-test.txt | |
- uses: dtolnay/rust-toolchain@stable | |
# We need normal poetry as reference; Pin to a specific version since we diff against the output | |
- name: Install poetry | |
run: pipx install poetry==1.6.1 | |
# For some reason, alternating between maturin and cargo invalidates the cache | |
- name: Cache maturin build | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ". -> target-maturin" | |
cache-on-failure: true | |
# The whole venv management is overly complex | |
- name: make paper | |
if: matrix.os != 'windows-latest' # TODO | |
run: python make_paper.py | |
- name: pip install pytest | |
if: matrix.os != 'windows-latest' | |
run: .venv/bin/pip install pytest jupyter nbconvert | |
- name: pytest test/python | |
if: matrix.os != 'windows-latest' | |
run: .venv/bin/pytest test/python |