Skip to content

Commit

Permalink
Merge pull request #409 from liberland/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
DorianSternVukotic authored Sep 22, 2024
2 parents 761fdf5 + a29d0a8 commit 77b5fc5
Show file tree
Hide file tree
Showing 37 changed files with 1,904 additions and 448 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/check-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: Check formatting
on:
pull_request:
workflow_dispatch:
workflow_call:
push:
branches:
- develop
Expand Down Expand Up @@ -48,4 +49,8 @@ jobs:
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 -p pallet-custom-account -p pallet-contracts-registry
run: cargo fmt --check -p pallet-liberland-initializer -p pallet-liberland-legislation -p liberland-traits -p pallet-llm -p pallet-office -p pallet-registry -p pallet-custom-account -p pallet-contracts-registry -p liberland-extension -p liberland-extension-runtime

- name: Format code with rustfmt
working-directory: contracts/
run: cargo fmt --check
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/fork-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Fork test
on:
pull_request:
workflow_dispatch:
push:
branches:
- develop
- main
workflow_call:

jobs:
forktest:
Expand Down
64 changes: 43 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
name: Build runtimes & draft release
name: Release new version

on:
workflow_dispatch:
push:
tags:
- "v*.*.*"

jobs:
check-formatting:
uses: ./.github/workflows/check-formatting.yml
fork-test:
uses: ./.github/workflows/fork-test.yml
test-contracts:
uses: ./.github/workflows/test-contracts.yml
test:
uses: ./.github/workflows/test.yml
try-runtime:
uses: ./.github/workflows/try-runtime.yml
build_binary:
# use old ubuntu for GLIBC compatibility
runs-on: ubuntu-20.04
env:
RUST_BACKTRACE: 1
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- 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
Expand All @@ -30,7 +37,7 @@ jobs:
git restore-mtime
- name: Setup caching for rust/cargo
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
Expand All @@ -55,7 +62,7 @@ jobs:
build_runtimes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Srtool build mainnet runtime
id: srtool_build
Expand All @@ -66,18 +73,22 @@ jobs:
runtime_dir: ./substrate/bin/node/runtime
tag: "1.74.0"

- name: Check version
id: version
run: echo "version=v$(cargo pkgid -p node-cli | cut -d'@' -f2)" >> "$GITHUB_OUTPUT"

- name: Mainnet Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > liberland-srtool-digest.mainnet.json
cat liberland-srtool-digest.mainnet.json
cp "${{ steps.srtool_build.outputs.wasm_compressed }}" ./mainnet-${{github.ref_name}}.wasm
cp "${{ steps.srtool_build.outputs.wasm_compressed }}" ./mainnet-${{ steps.version.outputs.version }}.wasm
ls
- name: Upload mainnet runtime
uses: actions/upload-artifact@v3
with:
name: mainnet-${{github.ref_name}}.wasm
path: mainnet-${{github.ref_name}}.wasm
name: mainnet-${{ steps.version.outputs.version }}.wasm
path: mainnet-${{ steps.version.outputs.version }}.wasm

- name: Srtool build bastiat runtime
id: srtool_build_bastiat
Expand All @@ -94,23 +105,33 @@ jobs:
run: |
echo '${{ steps.srtool_build_bastiat.outputs.json }}' | jq . > liberland-srtool-digest.bastiat.json
cat liberland-srtool-digest.bastiat.json
cp "${{ steps.srtool_build_bastiat.outputs.wasm_compressed }}" ./bastiat-${{github.ref_name}}.wasm
cp "${{ steps.srtool_build_bastiat.outputs.wasm_compressed }}" ./bastiat-${{ steps.version.outputs.version }}.wasm
ls
- name: Upload Bastiat runtime
uses: actions/upload-artifact@v3
with:
name: bastiat-${{github.ref_name}}.wasm
path: bastiat-${{github.ref_name}}.wasm
name: bastiat-${{ steps.version.outputs.version }}.wasm
path: bastiat-${{ steps.version.outputs.version }}.wasm

release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
needs:
- build_runtimes
- build_binary
- check-formatting
- fork-test
- test-contracts
- test
- try-runtime
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Check version
id: version
run: echo "version=v$(cargo pkgid -p node-cli | cut -d'@' -f2)" >> "$GITHUB_OUTPUT"

- name: Download binary
uses: actions/download-artifact@v3
Expand All @@ -120,19 +141,20 @@ jobs:
- name: Download Bastiat runtime
uses: actions/download-artifact@v3
with:
name: bastiat-${{github.ref_name}}.wasm
name: bastiat-${{ steps.version.outputs.version }}.wasm

- name: Download mainnet runtime
uses: actions/download-artifact@v3
with:
name: mainnet-${{github.ref_name}}.wasm
name: mainnet-${{ steps.version.outputs.version }}.wasm

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
tag_name: ${{ steps.version.outputs.version }}
target_commitish: "${{ github.sha }}"
files: |
linux_x86_build
mainnet-${{github.ref_name}}.wasm
bastiat-${{github.ref_name}}.wasm
mainnet-${{ steps.version.outputs.version }}.wasm
bastiat-${{ steps.version.outputs.version }}.wasm
38 changes: 38 additions & 0 deletions .github/workflows/test-contracts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Run contracts tests

on:
pull_request:
workflow_dispatch:
workflow_call:

jobs:
test:
runs-on: ubuntu-latest
env:
RUSTFLAGS: "-C debug-assertions=y"
RUST_BACKTRACE: 1
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- name: Install Rust toolchain
run: |
rustup set profile minimal
rustup update --no-self-update 1.78.0
rustup component add --toolchain 1.78.0 rustfmt rust-src
rustup target add wasm32-unknown-unknown
rustup default 1.78.0
- name: Checkout
uses: actions/checkout@v4

- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
workspaces: "contracts -> contracts/target"

- name: Run tests
working-directory: contracts
run: cargo test
5 changes: 1 addition & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Run tests
on:
pull_request:
workflow_dispatch:
push:
branches:
- develop
- main
workflow_call:

jobs:
test:
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ name: Try Runtime
on:
pull_request:
workflow_dispatch:
push:
branches:
- develop
- main
workflow_call:

jobs:
tryruntime:
Expand Down Expand Up @@ -36,11 +33,17 @@ jobs:
- name: Install try-runtime CLI
run: cargo install --git https://github.com/paritytech/try-runtime-cli --locked

- name: try-runtime bastiat
run: try-runtime --runtime ./target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm on-runtime-upgrade --disable-idempotency-checks --no-weight-warnings live --uri wss://archive.testchain.liberland.org:443
- name: try-runtime on-runtime-upgrade bastiat
run: try-runtime --runtime ./target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm on-runtime-upgrade live --uri wss://archive.testchain.liberland.org:443

- name: try-runtime fast-forward bastiat
run: try-runtime --runtime ./target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm fast-forward --n-blocks 5 --blocktime 6000 live --uri wss://archive.testchain.liberland.org:443

- name: Build try-runtime mainnet runtime
run: cargo build --release --features try-runtime -p kitchensink-runtime

- name: try-runtime mainnet
run: try-runtime --runtime ./target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm on-runtime-upgrade --disable-idempotency-checks --no-weight-warnings live --uri wss://mainnet.liberland.org:443
- name: try-runtime on-runtime-upgrade mainnet
run: try-runtime --runtime ./target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm on-runtime-upgrade live --uri wss://mainnet.liberland.org:443

- name: try-runtime fast-forward mainnet
run: try-runtime --runtime ./target/release/wbuild/kitchensink-runtime/kitchensink_runtime.wasm fast-forward --n-blocks 5 --blocktime 6000 live --uri wss://mainnet.liberland.org:443
Loading

0 comments on commit 77b5fc5

Please sign in to comment.