Skip to content
New issue

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

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

Already on GitHub? # to your account

Opt/srtool release #1584

Merged
merged 5 commits into from
Jan 6, 2025
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
24 changes: 13 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
jobs:
srtool:
uses: ./.github/workflows/srtool.yml
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
release:
name: Create Release
needs: srtool
Expand All @@ -27,16 +29,16 @@ jobs:
target: wasm32-unknown-unknown
toolchain: 1.81.0

- name: Download kusama strool result
- name: Download kusama srtool result
uses: actions/download-artifact@v4
with:
name: bifrost-kusama-runtime
name: bifrost-kusama-runtime-${{ github.ref_name }}
path: ${{ github.workspace }}/artifacts

- name: Download polkadot strool result
- name: Download polkadot srtool result
uses: actions/download-artifact@v4
with:
name: bifrost-polkadot-runtime
name: bifrost-polkadot-runtime-${{ github.ref_name }}
path: ${{ github.workspace }}/artifacts

- name: Build bifrost
Expand All @@ -46,8 +48,8 @@ jobs:
make production-release
mkdir -p ${{ github.workspace }}/artifacts
mv ${{ github.workspace }}/target/production/bifrost ${{ github.workspace }}/artifacts/
mv ${{ github.workspace }}/artifacts/runtime/bifrost-kusama/target/srtool/production/wbuild/bifrost-kusama-runtime/bifrost_kusama_runtime.compact.compressed.wasm ${{ github.workspace }}/artifacts/
mv ${{ github.workspace }}/artifacts/runtime/bifrost-polkadot/target/srtool/production/wbuild/bifrost-polkadot-runtime/bifrost_polkadot_runtime.compact.compressed.wasm ${{ github.workspace }}/artifacts/

ls -a ${{ github.workspace }}/artifacts
pushd ${{ github.workspace }}/artifacts
sha256sum bifrost | tee bifrost.sha256
shasum -c bifrost.sha256
Expand All @@ -67,12 +69,12 @@ jobs:
Low: This is a low priority release and you may upgrade at your convenience." >> ${{ github.workspace }}-CHANGELOG.txt
echo "## Bifrost Kusama Runtime" >> ${{ github.workspace }}-CHANGELOG.txt
echo '```' >> ${{ github.workspace }}-CHANGELOG.txt
subwasm info ${{ github.workspace }}/artifacts/bifrost_kusama_runtime.compact.compressed.wasm >> ${{ github.workspace }}-CHANGELOG.txt
subwasm info ${{ github.workspace }}/artifacts/bifrost-kusama_runtime.compact.compressed.wasm >> ${{ github.workspace }}-CHANGELOG.txt
echo '```' >> ${{ github.workspace }}-CHANGELOG.txt
echo ' ' >> ${{ github.workspace }}-CHANGELOG.txt
echo "## Bifrost Polkadot Runtime" >> ${{ github.workspace }}-CHANGELOG.txt
echo '```' >> ${{ github.workspace }}-CHANGELOG.txt
subwasm info ${{ github.workspace }}/artifacts/bifrost_polkadot_runtime.compact.compressed.wasm >> ${{ github.workspace }}-CHANGELOG.txt
subwasm info ${{ github.workspace }}/artifacts/bifrost-polkadot_runtime.compact.compressed.wasm >> ${{ github.workspace }}-CHANGELOG.txt
echo '```' >> ${{ github.workspace }}-CHANGELOG.txt

- name: Create Release
Expand All @@ -87,13 +89,13 @@ jobs:
files: |
${{ github.workspace }}/artifacts/bifrost
${{ github.workspace }}/artifacts/bifrost.sha256
${{ github.workspace }}/artifacts/bifrost_kusama_runtime.compact.compressed.wasm
${{ github.workspace }}/artifacts/bifrost_polkadot_runtime.compact.compressed.wasm
${{ github.workspace }}/artifacts/bifrost-kusama_runtime.compact.compressed.wasm
${{ github.workspace }}/artifacts/bifrost-polkadot_runtime.compact.compressed.wasm

- uses: 8398a7/action-slack@v3
if: always()
with:
status: ${{ job.status }}
fields: repo,author,eventName,workflow,ref,commit
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
83 changes: 54 additions & 29 deletions .github/workflows/srtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,29 @@ env:
on:
workflow_dispatch:
workflow_call:
secrets:
SLACK_WEBHOOK_URL:
required: true
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+'

jobs:
build:
name: Build ${{ matrix.chain }} ${{ github.event.inputs.ref }}
name: Build ${{ matrix.chain }} ${{ github.event.inputs.ref || github.ref_name }}
strategy:
fail-fast: false
matrix:
chain: ["bifrost-kusama", "bifrost-polkadot"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "📥 Checkout"
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
ref: ${{ github.event.inputs.ref || github.ref }}
fetch-depth: 1

- name: Srtool build
- name: "🏗️ Build Runtime"
id: srtool_build
uses: chevdor/srtool-actions@v0.8.0
env:
Expand All @@ -30,45 +37,63 @@ jobs:
profile: production
chain: ${{ matrix.chain }}
runtime_dir: runtime/${{ matrix.chain }}
- name: Summary

- name: "🔍 Summary"
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.chain }}-srtool-digest.json
cat ${{ matrix.chain }}-srtool-digest.json
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}"
cp ${{ steps.srtool_build.outputs.wasm_compressed }} ./${{ matrix.chain }}_runtime.compact.compressed.wasm

# it takes a while to build the runtime, so let's save the artifact as soon as we have it
- name: Archive Artifacts for ${{ matrix.chain }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.chain }}-runtime
path: |
${{ steps.srtool_build.outputs.wasm }}
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ matrix.chain }}-srtool-digest.json

# We now get extra information thanks to subwasm,
- name: Install subwasm ${{ env.SUBWASM_VERSION }}
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

- name: "🔍 Get Runtime information"
id: runtime_info
run: |
echo "compressed_info<<EOF" >> $GITHUB_OUTPUT
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
subwasm info ${{ steps.srtool_build.outputs.wasm }}
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }}
subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.chain }}-info.json
subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.chain }}-info_compressed.json
- name: Extract the metadata
run: |
subwasm meta ${{ steps.srtool_build.outputs.wasm }}
subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.chain }}-metadata.json
subwasm info ${{ steps.srtool_build.outputs.wasm }} > runtime_info.txt
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} >> runtime_info.txt

- name: Archive Subwasm results
- name: Archive Artifacts for ${{ matrix.chain }}
id: upload_artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.chain }}-runtime-${{ github.sha }}
name: ${{ matrix.chain }}-runtime-${{ github.event.inputs.ref || github.ref_name }}
path: |
${{ matrix.chain }}-info.json
${{ matrix.chain }}-info_compressed.json
${{ matrix.chain }}-metadata.json
${{ matrix.chain }}-diff.txt
${{ matrix.chain }}_runtime.compact.compressed.wasm
${{ matrix.chain }}-srtool-digest.json
runtime_info.txt

- uses: 8398a7/action-slack@v3
name: "Send Slack Notification"
if: success()
with:
status: custom
fields: workflow,job,commit,repo,ref,author,took
custom_payload: |
{
"attachments": [{
"color": "good",
"text": ":rocket: New runtime build for ${{ matrix.chain }} (${{ github.event.inputs.ref || github.ref_name }})\nDownload artifacts: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/${{ steps.upload_artifacts.outputs.artifact-id }}"
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

- name: Debug Trigger
run: |
echo "github.ref: ${{ github.ref }}"
echo "github.ref_name: ${{ github.ref_name }}"
echo "github.event_name: ${{ github.event_name }}"
echo "github.action: ${{ github.action }}"