Respects torch.device(0) new behavior without breaking backward compatibility #836
Workflow file for this run
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: Rust | |
on: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
defaults: | |
run: | |
working-directory: ./safetensors | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Rust Stable | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy, llvm-tools-preview | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install cargo-audit | |
run: cargo install cargo-audit | |
- name: Install cargo-llvm-cov for Ubuntu | |
if: matrix.os == 'ubuntu-latest' | |
run: cargo install cargo-llvm-cov | |
- name: Build | |
run: cargo build --all-targets --verbose | |
- name: Lint with Clippy | |
run: cargo clippy --all-targets --all-features -- -D warnings | |
- name: Run Tests | |
run: cargo test --verbose | |
- name: Run Audit | |
# RUSTSEC-2021-0145 is criterion so only within benchmarks | |
run: cargo audit -D warnings --ignore RUSTSEC-2021-0145 | |
- name: Coverage report | |
if: matrix.os == 'ubuntu-latest' | |
run: cargo llvm-cov --release --lcov --output-path lcov.info | |
- name: Upload to codecov.io | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
working-directory: ./safetensors | |
fail_ci_if_error: true |