diff --git a/.github/workflows/check-formatting.yml b/.github/workflows/check-formatting.yml index f51087093..15f51c44a 100644 --- a/.github/workflows/check-formatting.yml +++ b/.github/workflows/check-formatting.yml @@ -3,6 +3,7 @@ name: Check formatting on: pull_request: workflow_dispatch: + workflow_call: push: branches: - develop diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2a904db55..792c00bd9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -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 diff --git a/.github/workflows/fork-test.yml b/.github/workflows/fork-test.yml index 09d847f2f..5a7938630 100644 --- a/.github/workflows/fork-test.yml +++ b/.github/workflows/fork-test.yml @@ -3,10 +3,7 @@ name: Fork test on: pull_request: workflow_dispatch: - push: - branches: - - develop - - main + workflow_call: jobs: forktest: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12ee8cd7a..9a17de491 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,19 @@ -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 @@ -14,7 +21,7 @@ jobs: 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 @@ -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/ @@ -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 @@ -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 @@ -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 @@ -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 \ No newline at end of file + mainnet-${{ steps.version.outputs.version }}.wasm + bastiat-${{ steps.version.outputs.version }}.wasm \ No newline at end of file diff --git a/.github/workflows/test-contracts.yml b/.github/workflows/test-contracts.yml index 65b4cc01f..ffb8d524a 100644 --- a/.github/workflows/test-contracts.yml +++ b/.github/workflows/test-contracts.yml @@ -3,10 +3,7 @@ name: Run contracts tests on: pull_request: workflow_dispatch: - push: - branches: - - develop - - main + workflow_call: jobs: test: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 37864349e..bb3a78e31 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,10 +3,7 @@ name: Run tests on: pull_request: workflow_dispatch: - push: - branches: - - develop - - main + workflow_call: jobs: test: diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index d426316e5..1aa374e32 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -3,10 +3,7 @@ name: Try Runtime on: pull_request: workflow_dispatch: - push: - branches: - - develop - - main + workflow_call: jobs: tryruntime: diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 000000000..0b71cf3f0 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,21 @@ +# Releasing new version + +## Sanity checks: + +1. Check `spec_version` value in [runtime's lib.rs](./substrate/bin/node/runtime/src/lib.rs). There are 2: one for mainnet and one for testnet. They should be the same and higher than the last release. +2. Check `version` in [runtime's Cargo.toml](./substrate/bin/node/runtime/Cargo.toml). Major version should match the `spec_version`. +3. Check `version` in [cli's Cargo.toml](./substrate/bin/node/cli/Cargo.toml). Major version should match the `spec_version`. This is the version that will be used as the name of the release and tag. + +## Release + +1. Go to the [Release new version](https://github.com/liberland/liberland_substrate/actions/workflows/release.yml) action in GitHub, select `Run workflow`, choose the branch (usually `develop` or `main`) and run it. This action will do the following: + * Run unit-tests + * Run `try-runtime` migration checks (which detects things like state inconsitencies or pallet/state version mismatches) + * Run fork test for both bastiat and mainnet and check if whole state is still parsable post-fork + * Build runtimes in a reproducible way + * Build new binary + * Create a new GitHub Release + * Build & publish new Docker Image +2. Wait for the `Release new version` action to finish. +3. Go to [GitHub Releases](https://github.com/liberland/liberland_substrate/releases). New release should be there, ready for deployment. +4. (Optional) Open a new PR that bumps versions for the next release. [Sample PR](https://github.com/liberland/liberland_substrate/pull/404/files). \ No newline at end of file diff --git a/substrate/scripts/fork-test/mainnet.config.sh b/substrate/scripts/fork-test/mainnet.config.sh index 4e83ef0a3..6c81062fc 100644 --- a/substrate/scripts/fork-test/mainnet.config.sh +++ b/substrate/scripts/fork-test/mainnet.config.sh @@ -3,4 +3,4 @@ BUILDDIR="$(realpath "$(dirname "$0")/../../..")/target/release" BINARY="$BUILDDIR/substrate-node" RUNTIME="${RUNTIME:-$BUILDDIR/wbuild/kitchensink-runtime/kitchensink_runtime.compact.compressed.wasm}" ORIG_CHAIN="mainnet" -WS_ENDPOINT="wss://mainnet.liberland.org" +WS_ENDPOINT="wss://liberland-rpc.dwellir.com" \ No newline at end of file