chore: update Rust installation action to use rust-toolchain #2
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| # JavaScript tests | |
| test-js: | |
| name: Test JS (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| node: [18, 20] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'npm' | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build native module | |
| run: | | |
| cd crates/opencontext-node | |
| npm ci | |
| npm run build | |
| - name: Run JS tests | |
| run: npm test | |
| # Rust tests | |
| test-rust: | |
| name: Test Rust | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Run Rust tests | |
| run: | | |
| cd crates/opencontext-core | |
| cargo test --release --features search | |
| # Lint | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: clippy, rustfmt | |
| - name: Check Rust formatting | |
| run: | | |
| cd crates/opencontext-core | |
| cargo fmt --check | |
| - name: Run Clippy | |
| run: | | |
| cd crates/opencontext-core | |
| cargo clippy --features search -- -D warnings | |