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

Automatically build and attach production and dev runtimes to GH releases #2054

Merged
merged 17 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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
69 changes: 69 additions & 0 deletions .github/workflows/build-and-attach-release-runtimes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build and Attach Runtimes to Releases/RC

on:
release:
types:
- created

env:
PROFILE: production

jobs:
build_and_upload:
strategy:
matrix:
runtime:
- { name: westend, package: westend-runtime, path: polkadot/runtime/westend }
- { name: rococo, package: rococo-runtime, path: polkadot/runtime/rococo }
- { name: asset-hub-rococo, package: asset-hub-rococo-runtime, path: cumulus/parachains/runtimes/assets/asset-hub-rococo }
- { name: asset-hub-westend, package: asset-hub-westend-runtime, path: cumulus/parachains/runtimes/assets/asset-hub-westend }
- { name: bridge-hub-rococo, package: bridge-hub-rococo-runtime, path: cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo }
- { name: contracts-rococo, package: contracts-rococo-runtime, path: cumulus/parachains/runtimes/contracts/contracts-rococo }
build_config:
# Release build has logging disabled and no dev features
- { type: on-chain-release, opts: --features on-chain-release-build }
# Debug build has logging enabled and developer features
- { type: dev-debug-build, opts: --features try-runtime }

runs-on: ubuntu-22.04

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Build ${{ matrix.runtime.name }} ${{ matrix.build_config.type }}
id: srtool_build
uses: chevdor/srtool-actions@v0.8.0
env:
BUILD_OPTS: ${{ matrix.build_config.opts }}
with:
chain: ${{ matrix.runtime.name }}
package: ${{ matrix.runtime.package }}
runtime_dir: ${{ matrix.runtime.path }}
profile: ${{ env.PROFILE }}

- name: Build Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ matrix.runtime.name }}-srtool-digest.json
liamaharon marked this conversation as resolved.
Show resolved Hide resolved
cat ${{ matrix.runtime.name }}-srtool-digest.json
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}"

- name: Set up paths and runtime names
id: setup
run: |
RUNTIME_BLOB_NAME=$(echo ${{ matrix.runtime.package }} | sed 's/-/_/g').compact.compressed.wasm
PREFIX=${{ matrix.build_config.type == 'dev-debug-build' && 'DEV_DEBUG_BUILD__' || '' }}

echo "RUNTIME_BLOB_NAME=$RUNTIME_BLOB_NAME" >> $GITHUB_ENV
echo "ASSET_PATH=./${{ matrix.runtime.path }}/target/srtool/${{ env.PROFILE }}/wbuild/${{ matrix.runtime.package }}/$RUNTIME_BLOB_NAME" >> $GITHUB_ENV
echo "ASSET_NAME=$PREFIX$RUNTIME_BLOB_NAME" >> $GITHUB_ENV

- name: Upload Runtime to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.ASSET_PATH }}
asset_name: ${{ env.ASSET_NAME }}
asset_content_type: application/octet-stream
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,8 @@ std = [
]

experimental = [ "pallet-aura/experimental" ]

# A feature that should be enabled when the runtime should be build for on-chain
liamaharon marked this conversation as resolved.
Show resolved Hide resolved
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = [ "sp-api/disable-logging" ]
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,8 @@ std = [
]

experimental = [ "pallet-aura/experimental" ]

# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = [ "sp-api/disable-logging" ]
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,8 @@ try-runtime = [
]

experimental = [ "pallet-aura/experimental" ]

# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = [ "sp-api/disable-logging" ]
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,8 @@ try-runtime = [
]

experimental = [ "pallet-aura/experimental" ]

# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = [ "sp-api/disable-logging" ]
5 changes: 5 additions & 0 deletions cumulus/parachains/runtimes/glutton/glutton-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,8 @@ try-runtime = [
]

experimental = [ "pallet-aura/experimental" ]

# A feature that should be enabled when the runtime should be build for on-chain
# deployment. This will disable stuff that shouldn't be part of the on-chain wasm
# to make it smaller like logging for example.
on-chain-release-build = [ "sp-api/disable-logging" ]
Loading