Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to polkadot v1.6.0 and depend on fellowship/runtimes #213

Merged
merged 9 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
253 changes: 0 additions & 253 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,48 +72,6 @@ jobs:
name: encointer-collator-${{ github.sha }}
path: target/release/encointer-collator

build_try_runtime_and_benchmark_binaries:
name: extra flags build ${{ matrix.binary }} for ${{ matrix.rust-target }} on (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
rust: [stable]
binary: [release]
env:
RUST_BACKTRACE: full
RUSTV: ${{ matrix.rust }}
TARGET: ${{ matrix.rust-target }}
RUST_BIN_DIR: target/${{ matrix.rust-target }}/debug
RELEASE_NAME: debug
steps:
- uses: actions/checkout@v3
- name: Install protoc
run: sudo apt-get install protobuf-compiler

- name: Print env
run: |
echo "RUST_BIN_DIR = ${{ env.RUST_BIN_DIR }} "

# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: rustup show

- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ env.RUST_BIN_DIR }}-${{ matrix.binary }}

- name: Release
if: ${{ matrix.binary == 'release' }}
run: cargo build --locked --release --features try-runtime,runtime-benchmarks

# Upload artifacts
- name: Upload encointer-collator
uses: actions/upload-artifact@v3
with:
name: encointer-collator-benchmark-try-runtime-${{ github.sha }}
path: target/release/encointer-collator

# Run all checks and unit test. This always run on debug mode
check:
Expand Down Expand Up @@ -165,214 +123,3 @@ jobs:
if: failure()
uses: andymckay/[email protected]

build-runtimes:
name: Build Runtimes
runs-on: ubuntu-latest
strategy:
matrix:
runtime: ["encointer", "launch"]
steps:
- uses: actions/checkout@v3

- name: Install protoc
run: sudo apt-get install protobuf-compiler

- name: Cache target dir
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/runtime/${{ matrix.runtime }}/target"
key: srtool-target-${{ matrix.runtime }}-${{ github.sha }}
restore-keys: |
srtool-target-${{ matrix.runtime }}-
srtool-target-

- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
with:
chain: ${{ matrix.runtime }}
# todo: remove this again as soon as srtool is released for latest stable
tag: 1.74.0
runtime_dir: polkadot-parachains/${{ matrix.runtime }}-runtime

- name: Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.runtime }}-srtool-digest.json
cat ${{ matrix.runtime }}-srtool-digest.json
echo "Compact Runtime: ${{ steps.srtool_build.outputs.wasm }}"
echo "Compressed Runtime: ${{ steps.srtool_build.outputs.wasm_compressed }}"

# We now get extra information thanks to subwasm
- name: Install subwasm
run: |
wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb
subwasm --version

- name: Show Runtime information
shell: bash
run: |
subwasm info ${{ steps.srtool_build.outputs.wasm }}
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }}
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime }}-info.json
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.runtime }}-compressed-info.json

- name: Extract the metadata
shell: bash
run: |
subwasm meta ${{ steps.srtool_build.outputs.wasm }}
subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.runtime }}-metadata.json

# This is unsupported it wants to diff the metadata with a running chain. i.e. wss://kusama-<matrix.chain>-rpc.parity.io
# - name: Check the metadata diff
# shell: bash
# run: |
# subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ matrix.chain }} > ${{ matrix.chain }}-diff.txt
# cat ${{ matrix.chain }}-diff.txt

- name: Upload ${{ matrix.runtime }} srtool json
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime }}-srtool-json-${{ github.sha }}
path: |
${{ matrix.runtime }}-srtool-digest.json
${{ matrix.runtime }}-info.json
${{ matrix.runtime }}-compressed-info.json
${{ matrix.runtime }}-metadata.json
# ${{ matrix.runtime }}-diff.txt


- name: Upload ${{ matrix.runtime }} runtime
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime }}-runtime-${{ github.sha }}
path: |
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}

create_artifacts:
needs: [ build_primary_binaries, build-runtimes ]
runs-on: ubuntu-20.04
env:
CHAIN_SPEC: ${{ matrix.chain }}-${{ matrix.config }}
strategy:
fail-fast: false
matrix:
chain: [encointer]
config: [rococo, westend, kusama]
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: encointer-collator-${{ github.sha }}

- name: 'Create binaries for artifacts'
# The build-spec cmd does not create a deterministic key order in the produced json. Hence, we sort the keys
# before we use it to deterministically create the state.
run: |
chmod +x ./encointer-collator
./encointer-collator build-spec --chain ${{ env.CHAIN_SPEC }} --disable-default-bootnode --raw > ${{ env.CHAIN_SPEC }}-unsorted.json
jq --sort-keys . ${{ env.CHAIN_SPEC }}-unsorted.json > ${{ env.CHAIN_SPEC }}.json
./encointer-collator export-genesis-state --chain ${{ env.CHAIN_SPEC }}.json > ${{ env.CHAIN_SPEC }}.json.state
./encointer-collator export-genesis-state --chain ${{ env.CHAIN_SPEC }} > ${{ env.CHAIN_SPEC }}.state

- name: Compute file metadata
id: vars
run: |
sha256sum ${{ env.CHAIN_SPEC }}.state >> checksums.txt
sha256sum ${{ env.CHAIN_SPEC }}.json >> checksums.txt
sha256sum ${{ env.CHAIN_SPEC }}.json.state >> checksums.txt

- name: Upload ${{ env.CHAIN_SPEC }} Files
uses: actions/upload-artifact@v3
with:
name: ${{ env.CHAIN_SPEC }}-genesis-spec-${{ github.sha }}
path: |
checksums.txt
${{ env.CHAIN_SPEC }}.state
${{ env.CHAIN_SPEC }}.json
${{ env.CHAIN_SPEC }}.json.state

release:
name: Draft Release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [create_artifacts, build_primary_binaries, check]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- uses: actions/checkout@v3

- name: Download Integritee Collator
uses: actions/download-artifact@v3
with:
name: encointer-collator-${{ github.sha }}

- name: Create required package.json
run: test -f package.json || echo '{}' >package.json

- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: Changelog

- name: Display structure of downloaded files
run: ls -R
working-directory: .

- name: Release
id: create-release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
${{ steps.Changelog.outputs.changelog }}
draft: true
files: |
encointer-collator

publish-runtimes:
name: Publish Runtimes
runs-on: ubuntu-latest
needs: ["release"]
strategy:
matrix:
runtime: ["encointer", "launch"]
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Set up Ruby 3
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'

- name: Get runtime version
id: get-runtime-ver
run: |
ls
ls "${{ matrix.runtime }}-runtime-${{ github.sha }}"
runtime_ver="$(ruby -e 'require "./scripts/github/lib.rb"; puts get_runtime("${{ matrix.runtime }}")')"
echo "::set-output name=runtime_ver::$runtime_ver"

- name: Upload compact ${{ matrix.runtime }} wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.asset_upload_url }}
asset_path: "${{ matrix.runtime }}-runtime-${{ github.sha }}/${{ matrix.runtime }}_runtime.compact.wasm"
asset_name: ${{ matrix.runtime }}_runtime-v${{ steps.get-runtime-ver.outputs.runtime_ver }}.compact.wasm
asset_content_type: application/wasm

- name: Upload compressed ${{ matrix.runtime }} wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.asset_upload_url }}
asset_path: "${{ matrix.runtime }}-runtime-${{ github.sha }}/${{ matrix.runtime }}_runtime.compact.compressed.wasm"
asset_name: ${{ matrix.runtime }}_runtime-v${{ steps.get-runtime-ver.outputs.runtime_ver }}.compact.compressed.wasm
asset_content_type: application/wasm
Loading
Loading