Merge pull request #311 from liberland/fix-llm-docs #13
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: Build and Check | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
- main | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
RUSTFLAGS: "-C debug-assertions=y -D warnings" | |
RUST_BACKTRACE: 1 | |
steps: | |
- name: Cancel previous runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y build-essential git clang curl libssl-dev llvm libudev-dev make protobuf-compiler pkg-config git-restore-mtime | |
- name: Install rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly-2023-01-01 | |
default: true | |
target: wasm32-unknown-unknown | |
components: rustfmt, clippy | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# this is needed to make sure that cargo uses the cached target files, | |
# which will have an older date than the checked out source code. | |
- name: Restore files timestamps | |
run: | | |
# set all dirs and files mtime to the fixed timestamp, this one was chosen | |
# symbolically as polkadot genesis block date | |
find . -exec touch -t 202005260100 {} + | |
# restore mtime based on git commit log | |
git restore-mtime | |
- name: Setup caching for rust/cargo | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-rust-${{ hashFiles('**/Cargo.lock') }} | |
- name: Format code with rustfmt | |
run: cargo fmt --check -p pallet-liberland-initializer -p pallet-liberland-legislation -p liberland-traits -p pallet-llm -p pallet-office -p pallet-registry | |
- name: Run cargo test suite | |
run: cargo test --release --features runtime-benchmarks |