From 491eee4b26d38b69b1d53b37d456254453e34637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=98=E7=A5=9E=E8=A5=BF=E7=BA=A2=E6=9F=BF?= <34213033+TomatoAres@users.noreply.github.com> Date: Fri, 27 Dec 2024 11:19:23 +0800 Subject: [PATCH] Revert [skip ci]"ci(srtool): optimize runtime build workflow (#1562)" (#1571) This reverts commit 112b9d27a24cf3d9e882c78e1fd0dfa571252152. --- .github/workflows/srtool.yml | 80 +++++++++++++----------------------- 1 file changed, 29 insertions(+), 51 deletions(-) diff --git a/.github/workflows/srtool.yml b/.github/workflows/srtool.yml index 69eb5c0a0..2cdcacfa8 100644 --- a/.github/workflows/srtool.yml +++ b/.github/workflows/srtool.yml @@ -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: @@ -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<> $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