chore: update CI workflows to cache Rust and remove Linux support for… #4
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 (only macOS and Windows - no Linux native module support) | |
| test-js: | |
| name: Test JS (${{ matrix.os }}, Node ${{ matrix.node }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [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: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: crates/opencontext-node -> target | |
| - name: Install Protobuf (macOS) | |
| if: runner.os == 'macOS' | |
| run: brew install protobuf | |
| - name: Install Protobuf (Windows) | |
| if: runner.os == 'Windows' | |
| run: choco install protoc -y | |
| - 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: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: crates/opencontext-core -> target | |
| - name: Install Protobuf | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - 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: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: crates/opencontext-core -> target | |
| - name: Install Protobuf | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - 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 | |