api/v2: Update hash fn to root_hash #561
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: | |
- "*" | |
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: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- 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 verison 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: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt, clippy | |
- 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 -- -D warnings | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: 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: Run tests | |
run: cargo test --verbose | |
e2e: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: 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: Run simple example | |
run: RUST_BACKTRACE=1 cargo run --example simple | |
- name: Run dump example | |
run: RUST_BACKTRACE=1 cargo run --example dump | |
# 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 rev example | |
run: RUST_BACKTRACE=1 cargo run --example rev | |
docs: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: 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: Lint intra docs links | |
run: cargo rustdoc -p firewood --lib -- -D rustdoc::broken-intra-doc-links | |
- name: Lint missing crate-level docs | |
run: cargo rustdoc -p firewood --lib -- -D rustdoc::missing-crate-level-docs |