Skip to content

refactor: canister build & sync #629

refactor: canister build & sync

refactor: canister build & sync #629

Workflow file for this run

name: checks
on:
push:
branches:
- main
pull_request:
jobs:
compile:
name: compile:required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.rustup/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: build
run: cargo build
env:
RUST_BACKTRACE: 1
lint:
name: lint:required
needs: compile # Run after compilation to use the cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.rustup/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: Run Lint
run: cargo clippy --verbose --tests --benches -- -D warnings
env:
RUST_BACKTRACE: 1
format:
name: fmt:required
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Install Rust toolchain from rust-toolchain.toml
run: rustup show
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.rustup/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
#
# Runs a series of checks to make sure that all the docs
# that need to be generated have been genrated an are up
# to date.
#
cli-ref:
#
# generate the CLI reference file and check if it is up to date
#
name: cli-ref:required
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Show Rust toolchain
run: rustup show
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.rustup/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: generate docs
run: ./scripts/generate-cli-docs.sh
- name: Check for uncommitted changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "❌ The cli-reference documentation is not up to date"
echo ""
echo " Run ./scripts/generate-cli-docs.sh to update them"
echo ""
git status --porcelain
exit 1
else
echo "✅ Git state is clean."
fi
icp-yaml-schema:
#
# generate the icp yaml schema file and check if it is up to date
#
name: icp-yaml-schema:required
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- name: Show Rust toolchain
run: rustup show
- uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.rustup/
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ubuntu-latest-cargo-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('**/Cargo.lock') }}
- name: generate icp.yaml schema
run: ./scripts/generate-config-schemas.sh
- name: Check for uncommitted changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "❌ The schema docs are not up to date"
echo ""
echo " Run ./scripts/generate-config-schema.sh to update them"
echo ""
git status --porcelain
exit 1
else
echo "✅ Git state is clean."
fi