Add build prerequisites to readme #2814
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: ci | |
on: | |
pull_request: | |
branches: ['*'] | |
push: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key: ${{ steps.cargo-cache.outputs.cache-primary-key }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v2 | |
# caution: this is the same restore as in gh-pages.yaml | |
- name: Restore Cargo Cache | |
id: cargo-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
# We can do this now because we use specific version and update with Dependabot | |
# but if we make the deps any less specifc, we'll have to fix | |
key: ${{ runner.os }}-deps-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/*.rs') }} | |
# start from the previous set of cached dependencies | |
restore-keys: | | |
${{ runner.os }}-deps-${{ hashFiles('**/Cargo.toml') }}- | |
${{ runner.os }}-deps- | |
- name: Check | |
run: cargo check --workspace --tests --examples --benches | |
- name: Build | |
run: cargo build --workspace --tests --examples --benches | |
# Always update the cache | |
- name: Cleanup | |
run: | | |
gh extension install actions/gh-actions-cache | |
REPO=${{ github.repository }} | |
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" | |
echo "Fetching list of cache key" | |
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | |
## Setting this to not fail the workflow while deleting cache keys. | |
set +e | |
echo "Deleting caches..." | |
for cacheKey in $cacheKeysForPR | |
do | |
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | |
done | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Save Cargo Cache | |
uses: actions/cache/save@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ steps.cargo-cache.outputs.cache-primary-key }} | |
lint: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v2 | |
- name: Check license headers | |
uses: viperproject/check-license-header@v2 | |
with: | |
path: . | |
config: .github/check-license-headers.yaml | |
strict: true | |
- name: Restore Check Deps | |
id: cache-build-deps-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ needs.build.outputs.cache-key }} | |
- name: Format | |
run: cargo fmt -- --check | |
- name: Clippy | |
run: cargo clippy --tests --examples --benches -- -D warnings | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v2 | |
- name: Restore Check Deps | |
id: cache-build-deps-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ needs.build.outputs.cache-key }} | |
- name: Run tests | |
run: cargo test --verbose | |
examples: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v2 | |
- name: Restore Check Deps | |
id: cache-build-deps-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ needs.build.outputs.cache-key }} | |
# benchmarks were not being done in --release mode, we can enable this again later | |
# - name: Run benchmark example | |
# run: RUST_BACKTRACE=1 cargo run --example benchmark -- --nbatch 100 --batch-size 1000 | |
# - name: Run insert example | |
# run: RUST_BACKTRACE=1 cargo run --example insert | |
docs: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: arduino/setup-protoc@v2 | |
- name: Restore Check Deps | |
id: cache-build-deps-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ needs.build.outputs.cache-key }} | |
- run: RUSTDOCFLAGS="-D warnings" cargo doc --document-private-items --no-deps |