Skip to content

Commit

Permalink
Followup fixes #28 (#43)
Browse files Browse the repository at this point in the history
* Update README

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add one more clippy lint from Polkadot-SDK

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update CI dependencies

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use workspace version 1.1.0

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Cleanup Cargo.toml and rename glutton-runtime

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Add GPL-3.0 license

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Use version 1.0.0

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update .gitignore and rustfmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Delete empty CHANGELOG

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update Cargo.lock

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Set authors to the Fellowship

Co-authored-by: Bastian Köcher <git@kchr.de>

* Add the `on-chain-release-build` feature to all runtimes

* Rework release action

* Test the action

* Don't use deprecated command

* Use correct name

* Try to get it running

* Try

* Fixes

* ...

* Try

* Now?

* Rename

* Revert and let it only run on main

---------

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Bastian Köcher <info@kchr.de>
  • Loading branch information
3 people authored Sep 29, 2023
1 parent dcb9f62 commit bfcabce
Show file tree
Hide file tree
Showing 22 changed files with 867 additions and 307 deletions.
3 changes: 2 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ rustflags = [
"-Aclippy::needless_option_as_deref", # false positives
"-Aclippy::derivable_impls", # false positives
"-Aclippy::stable_sort_primitive", # prefer stable sort
]
"-Aclippy::extra-unused-type-parameters", # stylistic
]
4 changes: 2 additions & 2 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
uses: actions/checkout@v3

- name: Fetch cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0

- name: Clippy
run: cargo +nightly clippy --all-targets
run: cargo +nightly clippy --all-targets --locked -q
env:
SKIP_WASM_BUILD: 1
10 changes: 10 additions & 0 deletions .github/workflows/release-matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{ "name": "polkadot", "package": "polkadot-runtime", "path": "relay/polkadot" },
{ "name": "kusama", "package": "staging-kusama-runtime", "path": "relay/kusama" },
{ "name": "glutton-kusama", "package": "glutton-kusama-runtime", "path": "system-parachains/gluttons/glutton-kusama" },
{ "name": "asset-hub-kusama", "package": "asset-hub-kusama-runtime", "path": "system-parachains/asset-hubs/asset-hub-kusama" },
{ "name": "asset-hub-polkadot", "package": "asset-hub-polkadot-runtime", "path": "system-parachains/asset-hubs/asset-hub-polkadot" },
{ "name": "bridge-hub-kusama", "package": "bridge-hub-kusama-runtime", "path": "system-parachains/bridge-hubs/bridge-hub-kusama" },
{ "name": "bridge-hub-polkadot", "package": "bridge-hub-polkadot-runtime", "path": "system-parachains/bridge-hubs/bridge-hub-polkadot" },
{ "name": "collectives-polkadot", "package": "collectives-polkadot-runtime", "path": "system-parachains/collectives/collectives-polkadot" }
]
75 changes: 34 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,78 +2,73 @@ name: Create Draft Release

on:
push:
branches:
- main
paths:
- CHANGELOG.md
branches: [ "main" ]
paths: [ "CHANGELOG.md" ]
workflow_dispatch:

jobs:
enumerate:
runtime-matrix:
runs-on: ubuntu-latest
outputs:
runtime: ${{ steps.generate-matrix.outputs.runtime }}
runtime: ${{ steps.runtime.outputs.runtime }}
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Generate runtime matrix
id: generate-matrix
- uses: actions/checkout@v2
- id: runtime
run: |
>>$GITHUB_OUTPUT echo runtime="[$(find * -name "lib.rs" -not -path "*/common/*" -not -path "*/constants/*" | awk -F/ '{sub("/src/lib.rs",""); print "[\"" gensub("/" $NF "$", "", "g") "\",\"" $NF "\"],"}' | tr -d $'\n')]"
TASKS=$(echo $(cat .github/workflows/release-matrix.json) | sed 's/ //g' )
echo $TASKS
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
build-runtimes:
needs: [ runtime-matrix ]
continue-on-error: true
runs-on: ubuntu-latest
needs:
- enumerate
strategy:
matrix:
runtime: ${{ fromJSON(needs.enumerate.outputs.runtime) }}
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Cache target dir
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/${{ matrix.runtime[0] }}/${{ matrix.runtime[1] }}/target"
key: srtool-target-${{ matrix.runtime[0] }}-${{ matrix.runtime[1] }}-${{ github.sha }}
path: "${{ github.workspace }}/${{ matrix.runtime.path }}/target"
key: srtool-target-${{ matrix.runtime.path }}-${{ matrix.runtime.name }}-${{ github.sha }}
restore-keys: |
srtool-target-${{ matrix.runtime[0] }}-${{ matrix.runtime[1] }}-
srtool-target-${{ matrix.runtime[0] }}-
srtool-target-${{ matrix.runtime.path }}-${{ matrix.runtime.name }}-
srtool-target-${{ matrix.runtime.path }}-
- name: Build ${{ matrix.runtime[1] }}
- name: Build ${{ matrix.runtime.name }}
id: srtool_build
uses: chevdor/srtool-actions@v0.8.0
env:
BUILD_OPTS: "--features on-chain-release-build"
with:
chain: ${{ matrix.runtime[1] }}
runtime_dir: "${{ matrix.runtime[0] }}/${{ matrix.runtime[1] }}"
chain: ${{ matrix.runtime.name }}
package: ${{ matrix.runtime.package }}
runtime_dir: ${{ matrix.runtime.path }}
profile: "production"

- name: Store ${{ matrix.runtime[1] }} srtool digest to disk
- name: Store ${{ matrix.runtime.name }} srtool digest to disk
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.runtime[1] }}_srtool_output.json
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.runtime.name }}_srtool_output.json
- name: Upload ${{ matrix.runtime[1] }} srtool json
- name: Upload ${{ matrix.runtime.name }} srtool json
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime[1] }}-srtool-json
path: ${{ matrix.runtime[1] }}_srtool_output.json
name: ${{ matrix.runtime.name }}-srtool-json
path: ${{ matrix.runtime.name }}_srtool_output.json

- name: Upload ${{ matrix.runtime[1] }}
- name: Upload ${{ matrix.runtime.name }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime[1] }}
name: ${{ matrix.runtime.name }}
path: |
${{ steps.srtool_build.outputs.wasm_compressed }}
publish-draft-release:
runs-on: ubuntu-latest
needs:
- build-runtimes
needs: [ build-runtimes ]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
Expand All @@ -99,7 +94,7 @@ jobs:
tee -a DRAFT <<-EOF
## Changelog
EOF
tee -a DRAFT <CHANGELOG
tee -a DRAFT <CHANGELOG.md
tee -a DRAFT <<-EOF
## Runtime info
*These runtimes were built with **$(SRTOOL rustc)** using **[$(SRTOOL gen)](https://github.com/paritytech/srtool)***
Expand Down Expand Up @@ -132,16 +127,14 @@ jobs:
draft: true

publish-runtimes:
needs: [ runtime-matrix, publish-draft-release ]
continue-on-error: true
runs-on: ubuntu-latest
env:
RUNTIME_DIR: runtime
needs:
- publish-draft-release
- enumerate
strategy:
matrix:
runtime: ${{ fromJSON(needs.enumerate.outputs.runtime) }}
runtime: ${{ fromJSON(needs.runtime-matrix.outputs.runtime) }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand All @@ -151,18 +144,18 @@ jobs:

- name: Get runtime info
env:
JSON: release-notes-context/${{ matrix.runtime[1] }}-srtool-json/${{ matrix.runtime[1] }}_srtool_output.json
JSON: release-notes-context/${{ matrix.runtime.name }}-srtool-json/${{ matrix.runtime.name }}_srtool_output.json
run: |
>>$GITHUB_ENV echo ASSET=$(find ${{ matrix.runtime[1] }} -name '*.compact.compressed.wasm')
>>$GITHUB_ENV echo ASSET=$(find ${{ matrix.runtime.name }} -name '*.compact.compressed.wasm')
>>$GITHUB_ENV echo SPEC=$(<${JSON} jq -r .runtimes.compact.subwasm.core_version.specVersion)
>>$GITHUB_ENV echo TXVER=$(<${JSON} jq -r .runtimes.compact.subwasm.core_version.transactionVersion)
- name: Upload compressed ${{ matrix.runtime[1] }} v${{ env.SPEC }} tx${{ env.TXVER }} wasm
- name: Upload compressed ${{ matrix.runtime.name }} v${{ env.SPEC }} tx${{ env.TXVER }} wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish-draft-release.outputs.asset_upload_url }}
asset_path: ${{ env.ASSET }}
asset_name: ${{ matrix.runtime[1] }}_runtime-v${{ env.SPEC }}.tx${{ env.TXVER }}.compact.compressed.wasm
asset_name: ${{ matrix.runtime.name }}_runtime-v${{ env.SPEC }}.tx${{ env.TXVER }}.compact.compressed.wasm
asset_content_type: application/wasm
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ jobs:
uses: actions/checkout@v3

- name: Fetch cache
uses: Swatinem/rust-cache@6fd3edff6979b79f87531400ad694fb7f2c84b1f # v2.2.1
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0

- name: Test all features
run: cargo test --workspace --release --locked --features=runtime-benchmarks,runtime-metrics,try-runtime
run: cargo test --workspace --release --locked -q --features=runtime-benchmarks,runtime-metrics,try-runtime
env:
RUSTFLAGS: "-C debug-assertions -D warnings"
SKIP_WASM_BUILD: 1
45 changes: 36 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
**/target/
**/*.rs.bk
*.swp
.wasm-binaries
runtime/wasm/target/
**/._*
!polkadot.service
.cargo-remote.toml
.direnv/
.DS_Store
.env*
.idea
.local
.vscode
.wasm-binaries
*.adoc
*.bin
*.iml
*.orig
*.rej
*.swp
**/._*
**/.criterion/
**/*.rs.bk
**/chains/
**/hfuzz_target/
**/hfuzz_workspace/
**/node_modules
**/target/
**/wip/*.stderr
/.cargo/config
/.envrc
artifacts
bin/node-template/Cargo.lock
nohup.out
polkadot_argument_parsing
polkadot.*
!polkadot.service
.DS_Store
.env
pwasm-alloc/Cargo.lock
pwasm-libc/Cargo.lock
release-artifacts
release.json
rls*.log
runtime/wasm/target/
substrate.code-workspace
target/
8 changes: 4 additions & 4 deletions rustfmt.toml → .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Basic
edition = "2021"
hard_tabs = true
max_width = 100
use_small_heuristics = "Max"
Expand All @@ -18,7 +19,6 @@ match_block_trailing_comma = true
trailing_comma = "Vertical"
trailing_semicolon = false
use_field_init_shorthand = true
ignore = [
"bridges",
]
edition = "2021"
# Format comments
comment_width = 100
wrap_comments = true
1 change: 0 additions & 1 deletion CHANGELOG

This file was deleted.

10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace.package]
authors = ["Parity Technologies <admin@parity.io>"]
version = "1.0.0"
authors = ["Polkadot Fellowship"]
edition = "2021"
repository = "https://github.com/polkadot-fellows/runtimes.git"
license = "GPL-3.0-only" # TODO <https://github.com/polkadot-fellows/runtimes/issues/29>
Expand Down
Loading

0 comments on commit bfcabce

Please sign in to comment.