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

170 Call Gitlab CI job to Automate Runtime Release #430

Merged
merged 27 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
136 changes: 136 additions & 0 deletions .github/workflows/release-old.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: Release and Propose an Upgrade
b-yap marked this conversation as resolved.
Show resolved Hide resolved

env:
SUBWASM_VERSION: 0.20.0

on:
pull_request:
types:
- closed
branches:
- 'main'

jobs:
srtool:
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'release:') }}
name: SrTool check on ${{ matrix.chain }} ${{ github.event.inputs.ref }}
strategy:
fail-fast: false
matrix:
chain: ["amplitude", "pendulum", "foucoco"]
shouldReleaseAmp:
- ${{ contains(github.event.pull_request.title, 'amplitude') }}
shouldReleasePen:
- ${{ contains(github.event.pull_request.title, 'pendulum') }}
shouldReleaseFou:
- ${{ contains(github.event.pull_request.title, 'foucoco') }}
exclude:
- shouldReleaseAmp: false
chain: "amplitude"
- shouldReleasePen: false
chain: "pendulum"
- shouldReleaseFou: false
chain: "foucoco"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0

- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
with:
chain: ${{ matrix.chain }}
runtime_dir: runtime/${{ matrix.chain }}
# this is important to avoid build fail. See https://github.com/paritytech/srtool/issues/62
tag: 1.66.1
- 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 }}"
echo '${{ steps.srtool_build.outputs.json }}'
cp ${{ steps.srtool_build.outputs.wasm }} ${{ matrix.chain }}_runtime.compact.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: |
${{ matrix.chain }}_runtime.compact.wasm
${{ matrix.chain }}_runtime.compact.compressed.wasm
${{ 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
run: |
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

- name: Archive Subwasm results
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.chain }}-runtime-${{ github.sha }}
path: |
${{ matrix.chain }}-info.json
${{ matrix.chain }}-info_compressed.json
${{ matrix.chain }}-metadata.json
${{ matrix.chain }}-diff.txt

propose_upgrade:
if: ${{ success() }}
needs: srtool
name: Perform runtime upgrade on ${{ matrix.chain }} ${{ github.event.inputs.ref }}
runs-on: ubuntu-latest
strategy:
matrix:
chain: ["amplitude", "pendulum"]
shouldReleaseAmp:
- ${{ contains(github.event.pull_request.title, 'amplitude') }}
shouldReleasePen:
- ${{ contains(github.event.pull_request.title, 'pendulum') }}
exclude:
- shouldReleaseAmp: false
chain: "amplitude"
- shouldReleasePen: false
chain: "pendulum"

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0

- name: download artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.chain }}-runtime

- name: prepare Node
uses: actions/setup-node@v4
with:
node-version: '21.x'
- name: Install dependencies
run: |
cd .github/scripts/js
npm init -y
npm install
- name: run script for parachain upgrade
run: |
node --version
node .github/scripts/js/parachain_authorize_upgrade.js ${{ matrix.chain }} ${{ matrix.chain }}_runtime.compact.compressed.wasm
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This action triggers a GitLab CI job that performs the following:
# * Srtool Check
# * Subwasm info of the compressed wasm file
# * Generate Release Notes
# * Propose a Parachain Upgrade
name: Release and Propose an Upgrade

on:
pull_request:
types:
- closed
branches:
- 'main'

jobs:
release_check:
# This job will only run if:
# * the pull request is closed and merged to main branch;
# * the pull request has the "release:" in its title
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.title, 'release:') }}
ebma marked this conversation as resolved.
Show resolved Hide resolved
name: Is ${{ matrix.chain }} need new release ${{ github.event.inputs.ref }}
strategy:
fail-fast: true
matrix:
chain: ["amplitude", "pendulum"]
b-yap marked this conversation as resolved.
Show resolved Hide resolved
shouldReleaseAmp:
- ${{ contains(github.event.pull_request.title, 'amplitude') }}
shouldReleasePen:
- ${{ contains(github.event.pull_request.title, 'pendulum') }}
exclude:
- shouldReleaseAmp: false
chain: "amplitude"
- shouldReleasePen: false
chain: "pendulum"
runs-on: ubuntu-latest

# steps:
# - name: trigger GitLab Ci Job
# uses: appleboy/gitlab-ci-action@master
# with:
# host: "https://gitlab.com"
# token: ${{ secrets.GITLABAPI }}
# project_id: 51267165
# debug: true
# ref: development

Loading