Sketchlib rust migration #83
Workflow file for this run
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: Rust Projects CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'asap-query-engine/**' | |
| - 'asap-common/dependencies/rs/**' | |
| - 'asap-common/tests/**' | |
| - 'asap-common/sketch-core/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - '.github/workflows/rust.yml' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'asap-query-engine/**' | |
| - 'asap-common/dependencies/rs/**' | |
| - 'asap-common/tests/**' | |
| - 'asap-common/sketch-core/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| - '.github/workflows/rust.yml' | |
| workflow_dispatch: | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| format-and-lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@v0.0.4 | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} | |
| - name: Validate lockfile | |
| run: | | |
| cp Cargo.lock Cargo.lock.bak | |
| cargo generate-lockfile | |
| if ! diff -q Cargo.lock Cargo.lock.bak >/dev/null; then | |
| echo "::error::Cargo.lock is out of sync. Run 'cargo update' or 'rm Cargo.lock && cargo build' locally and commit the updated Cargo.lock." | |
| exit 1 | |
| fi | |
| rm Cargo.lock.bak | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| env: | |
| RUSTC_WRAPPER: sccache | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - name: Run sccache-cache | |
| uses: mozilla-actions/sccache-action@v0.0.4 | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }} | |
| - name: Validate lockfile | |
| run: | | |
| cp Cargo.lock Cargo.lock.bak | |
| cargo generate-lockfile | |
| if ! diff -q Cargo.lock Cargo.lock.bak >/dev/null; then | |
| echo "::error::Cargo.lock is out of sync. Run 'cargo update' or 'rm Cargo.lock && cargo build' locally and commit the updated Cargo.lock." | |
| exit 1 | |
| fi | |
| rm Cargo.lock.bak | |
| - name: Run all workspace tests | |
| run: cargo test --workspace | |
| env: | |
| RUSTC_WRAPPER: sccache | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: [format-and-lint, test] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # - name: Configure git for private dependencies | |
| # run: git config --global url."https://x-access-token:${{ secrets.PRIVATE_REPO_TOKEN }}@github.com/".insteadOf "https://github.com/" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Docker image | |
| run: docker build -f asap-query-engine/Dockerfile -t sketchdb-queryengine-rust:latest . |