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

Revert "ci(srtool): optimize runtime build workflow (#1562)" #1571

Merged
merged 1 commit into from
Dec 27, 2024
Merged
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
80 changes: 29 additions & 51 deletions .github/workflows/srtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,22 @@ env:
on:
workflow_dispatch:
workflow_call:
push:
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+'

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

- name: "🏗️ Build Runtime"
- name: Srtool build
id: srtool_build
uses: chevdor/srtool-actions@v0.8.0
env:
Expand All @@ -34,63 +30,45 @@ 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: "🔍 Get Runtime information"
id: runtime_info
- name: Show Runtime information
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 info ${{ steps.srtool_build.outputs.wasm }} > runtime_info.txt
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} >> runtime_info.txt
subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.chain }}-metadata.json

- name: Archive Artifacts for ${{ matrix.chain }}
id: upload_artifacts
- name: Archive Subwasm results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.chain }}-runtime-${{ github.event.inputs.ref || github.ref_name }}
name: ${{ matrix.chain }}-runtime-${{ github.sha }}
path: |
${{ 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 }}"


${{ matrix.chain }}-info.json
${{ matrix.chain }}-info_compressed.json
${{ matrix.chain }}-metadata.json
${{ matrix.chain }}-diff.txt