Skip to content
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
18 changes: 10 additions & 8 deletions .github/actions/shared/action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 'Shared action'
description: 'Frees runner disk space, installs protobuf and caches the cargo registry'
runs:
using: "composite"
steps:
Expand All @@ -13,20 +14,21 @@ runs:
sudo rm -rf /usr/local/share/boost
sudo rm -rf /opt/hostedtoolcache
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
sudo apt-get remove -y 'php.*' --fix-missing
sudo apt-get remove -y '^mongodb-.*' --fix-missing
sudo apt-get remove -y '^mysql-.*' --fix-missing
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing
sudo apt-get remove -y google-cloud-sdk --fix-missing
sudo apt-get remove -y google-cloud-cli --fix-missing
# Runner images differ in what they ship; remove only what is installed.
for pattern in 'php.*' '^mongodb-.*' '^mysql-.*'; do
sudo apt-get remove -y "$pattern" --fix-missing || echo "nothing matches $pattern"
done
for pkg in azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri google-cloud-sdk google-cloud-cli; do
if dpkg -s "$pkg" >/dev/null 2>&1; then sudo apt-get remove -y "$pkg" --fix-missing; fi
done
sudo apt-get autoremove -y
sudo apt-get clean
df -h
shell: bash

# Free GitHub Actions Environment Disk Space
- name: Maximize Build Space
uses: jlumbroso/free-disk-space@main
uses: jlumbroso/free-disk-space@36e9a5af4eddb91fc11aec4c6f6f79b3cc0cb523 # main
with:
tool-cache: false
large-packages: false
Expand All @@ -45,7 +47,7 @@ runs:

# Steps taken from https://github.com/actions/cache/blob/master/examples.md#rust---cargo
- name: Cache cargo registry
uses: actions/cache@v4
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: |
~/.cargo/registry
Expand Down
5 changes: 4 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ updates:
schedule:
interval: "daily"
- package-ecosystem: github-actions
directory: "/"
# "/" covers the workflows only; the composite action pins its own actions.
directories:
- "/"
- "/.github/actions/shared"
schedule:
interval: daily
24 changes: 11 additions & 13 deletions .github/workflows/clippy-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,28 @@ on:
branches:
- main

permissions:
contents: read

jobs:
clippy-checks:
runs-on: ubuntu-latest
# The bundled RocksDB (librocksdb-sys 0.11) does not build with the GCC of newer images.
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v5
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0

- name: Free up Space and Installation
uses: ./.github/actions/shared

- name: Clippy -- Main
uses: actions-rs/cargo@v1
with:
command: clippy
# `manual_inspect` (clippy 1.81) fires inside the `#[pallet::pallet]` expansion of our
# polkadot-sdk fork; the `deny(warnings)` pallets cannot allow it from the outside.
args: --release --all-features -- -W clippy::all -A clippy::style -A clippy::manual_inspect -A forgetting_copy_types -A forgetting_references
# `manual_inspect` (clippy 1.81) fires inside the `#[pallet::pallet]` expansion of our
# polkadot-sdk fork; the `deny(warnings)` pallets cannot allow it from the outside.
run: cargo clippy --release --all-features -- -W clippy::all -A clippy::style -A clippy::manual_inspect -A forgetting_copy_types -A forgetting_references

- name: Clippy -- All Targets (except integration)
uses: actions-rs/cargo@v1
with:
command: clippy
# We are a bit more forgiving when it comes to the code in tests and only check for correctness
args: --release --workspace --all-features --all-targets --exclude runtime-integration-tests -- -A clippy::all -W clippy::correctness -A forgetting_copy_types -A forgetting_references
# We are a bit more forgiving when it comes to the code in tests and only check for correctness
run: cargo clippy --release --workspace --all-features --all-targets --exclude runtime-integration-tests -- -A clippy::all -W clippy::correctness -A forgetting_copy_types -A forgetting_references

# Disabled until we move to crates.io and fix runtime-integration-tests.
# - name: Clippy -- Integration
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ on:
branches:
- main

permissions:
contents: read

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: gaurav-nelson/github-action-markdown-link-check@v1
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
- uses: gaurav-nelson/github-action-markdown-link-check@5c5dfc0ac2e225883c0e5f03a85311ec2830d368 # v1
with:
use-quiet-mode: 'yes'
config-file: '.github/workflows/mlc_config.json'
13 changes: 8 additions & 5 deletions .github/workflows/migration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Migration Tests
# The PEN -> Base migration stack lives outside the Rust workspace: the
# Foundry contracts and the three TypeScript daemons. `test-code.yml` covers
# the pallet through `cargo test`; this job covers everything else, so a
# green check on the PR means the suites the review log cites actually ran.
# green check on the PR means the contract and daemon suites actually ran.

on:
pull_request:
Expand All @@ -17,6 +17,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
contracts:
name: Foundry (contracts)
Expand All @@ -25,11 +28,11 @@ jobs:
run:
working-directory: contracts
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
submodules: recursive

- uses: foundry-rs/foundry-toolchain@v1
- uses: foundry-rs/foundry-toolchain@908c540300062bd5a7e473851cdb4282204cee09 # v1.9.1
with:
version: stable

Expand All @@ -50,9 +53,9 @@ jobs:
run:
working-directory: ${{ matrix.package }}
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0

- uses: actions/setup-node@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 20
cache: npm
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/release-node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- 'main'

permissions:
contents: read

jobs:
release_check:
# This job will only run if:
Expand All @@ -21,7 +24,7 @@ jobs:

steps:
- name: Check out repository code
uses: actions/checkout@v5
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0

- name: Get Node Version
id: get-version
Expand All @@ -30,6 +33,10 @@ jobs:
echo "version=${vers}" >> "$GITHUB_OUTPUT"

- name: trigger gitlab
env:
GITLAB_TRIGGER: ${{ secrets.GITLAB_TRIGGER }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
VERSION: ${{ steps.get-version.outputs.version }}
run: |
ls ${{ github.workspace }}
curl -X POST -F "token=${{ secrets.GITLAB_TRIGGER }}" -F "ref=development" -F "variables[PREPCOMPILE]=Y" -F "variables[COMPILE]=Y" -F "variables[COMPILEMOONBEAM]=N" -F "variables[DOCKER]=Y" -F "variables[DOCKERAMP]=Y" -F "variables[DEBIAN]=Y" -F "variables[TEMPUPLOAD]=Y" -F "variables[DOWNUPLOAD]=Y" -F "variables[PRODUPLOAD]=Y" -F "variables[VERSION]=${{ steps.get-version.outputs.version }}" https://gitlab.com/api/v4/projects/${{ secrets.PROJECT_ID }}/trigger/pipeline
ls "$GITHUB_WORKSPACE"
curl -X POST -F "token=$GITLAB_TRIGGER" -F "ref=development" -F "variables[PREPCOMPILE]=Y" -F "variables[COMPILE]=Y" -F "variables[COMPILEMOONBEAM]=N" -F "variables[DOCKER]=Y" -F "variables[DOCKERAMP]=Y" -F "variables[DEBIAN]=Y" -F "variables[TEMPUPLOAD]=Y" -F "variables[DOWNUPLOAD]=Y" -F "variables[PRODUPLOAD]=Y" -F "variables[VERSION]=$VERSION" "https://gitlab.com/api/v4/projects/$PROJECT_ID/trigger/pipeline"
119 changes: 91 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
#
# The wasm that goes into a runtime-upgrade referendum must be reproducible:
# anyone with the same commit, srtool image and build options must arrive at
# the same hash. This job builds the runtime inside the pinned srtool image
# (rustc matching rust-toolchain.toml), records the srtool/subwasm report,
# and — when a release tag is known — attaches the compressed wasm and the
# report to the GitHub release for that tag.
# the same hash. The build job builds the runtime inside the srtool image
# pinned by digest (rustc matching rust-toolchain.toml) and records the
# srtool/subwasm report; when a release tag is known, the publish job (the
# only one with write access) attaches the compressed wasm and the report to
# the GitHub release for that tag.
#
# Usage:
# * Push a tag `pendulum-release-<spec>` (or `amplitude-release-<spec>`) on
Expand All @@ -33,29 +34,44 @@ on:
required: false
default: ""

permissions:
contents: read

jobs:
build:
name: srtool build
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
chain: ${{ steps.meta.outputs.chain }}
tag: ${{ steps.meta.outputs.tag }}
sha: ${{ steps.commit.outputs.sha }}
env:
# srtool passes this to cargo. The runtimes keep CheckMetadataHash in
# their signed extensions; without the embedded metadata hash every
# transaction signed with it (mode 1, as Ledger signs) is rejected.
BUILD_OPTS: --features metadata-hash
# The srtool image (rustc 1.81.0), pinned by digest so a moved tag cannot
# change the build.
SRTOOL_IMAGE_TAG: 1.81.0-0.17.0@sha256:9cff8845b2640c89524f4df6f176c43d55b02d0e75ba58dd517d501b33e26f1a
steps:
- name: Resolve chain and tag
id: meta
shell: bash
env:
INPUT_TAG: ${{ github.event.inputs.tag }}
INPUT_CHAIN: ${{ github.event.inputs.chain }}
run: |
if [ "${{ github.event_name }}" = "push" ]; then
TAG="${{ github.ref_name }}"
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
TAG="$GITHUB_REF_NAME"
CHAIN="${TAG%%-release-*}"
else
TAG="${{ github.event.inputs.tag }}"
CHAIN="${{ github.event.inputs.chain }}"
TAG="$INPUT_TAG"
CHAIN="$INPUT_CHAIN"
fi
# A dispatched tag is free text; it goes into step outputs and log lines.
case "$TAG" in
*[!A-Za-z0-9._-]*) echo "::error::a release tag may contain only letters, digits, '.', '_' and '-'"; exit 1 ;;
esac
case "$CHAIN" in
pendulum|amplitude) ;;
*) echo "cannot derive the chain from '$TAG'; expected <chain>-release-<spec>"; exit 1 ;;
Expand All @@ -67,12 +83,14 @@ jobs:
fi
echo "chain=$CHAIN" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "ref=${TAG:-${{ github.ref }}}" >> "$GITHUB_OUTPUT"
echo "ref=${TAG:-$GITHUB_REF}" >> "$GITHUB_OUTPUT"

- uses: actions/checkout@v5
- uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
ref: ${{ steps.meta.outputs.ref }}
fetch-depth: 0
# The srtool container mounts the workspace; keep the token out of it.
persist-credentials: false

- name: Check the commit to build
id: commit
Expand All @@ -90,11 +108,12 @@ jobs:

- name: Build with srtool
id: srtool
uses: chevdor/srtool-actions@v0.9.2
uses: chevdor/srtool-actions@48e9baed50ca414936dfac59d34d8b9bbe581abd # v0.9.2
with:
package: ${{ steps.meta.outputs.chain }}-runtime
runtime_dir: runtime/${{ steps.meta.outputs.chain }}
tag: "1.81.0"
# The action runs <image>:<tag>, so the tag carries the digest.
tag: ${{ env.SRTOOL_IMAGE_TAG }}

- name: Check that the metadata hash is embedded
shell: bash
Expand All @@ -114,24 +133,29 @@ jobs:

- name: Record the srtool report
shell: bash
env:
CHAIN: ${{ steps.meta.outputs.chain }}
SHA: ${{ steps.commit.outputs.sha }}
SRTOOL_JSON: ${{ steps.srtool.outputs.json }}
WASM_COMPRESSED: ${{ steps.srtool.outputs.wasm_compressed }}
run: |
echo '${{ steps.srtool.outputs.json }}' | jq . > srtool-${{ steps.meta.outputs.chain }}.json
printf '%s\n' "$SRTOOL_JSON" | jq . > "srtool-$CHAIN.json"
{
echo "## ${{ steps.meta.outputs.chain }} runtime — srtool build"
echo "## $CHAIN runtime — srtool build"
echo
echo "Commit: \`${{ steps.commit.outputs.sha }}\` · srtool image: \`paritytech/srtool:1.81.0\` · BUILD_OPTS: \`$BUILD_OPTS\` · reproduce with the same commit, image and BUILD_OPTS."
echo "Commit: \`$SHA\` · srtool image: \`paritytech/srtool:$SRTOOL_IMAGE_TAG\` · BUILD_OPTS: \`$BUILD_OPTS\` · reproduce with the same commit, image and BUILD_OPTS."
echo
echo "For \`parachainSystem.authorizeUpgrade\` use **\`blake2_256\`** below (the code hash the chain recomputes from the wasm at enactment); \`proposal_hash\` is the preimage hash of a \`system.setCode\` call and \`parachain_authorize_upgrade_hash\` is derived from the authorize call — neither is the value to authorize."
echo
echo '```json'
jq '.runtimes.compressed.subwasm // .' srtool-${{ steps.meta.outputs.chain }}.json
jq '.runtimes.compressed.subwasm // .' "srtool-$CHAIN.json"
echo '```'
} > release-notes.md
cat release-notes.md >> "$GITHUB_STEP_SUMMARY"
cp "${{ steps.srtool.outputs.wasm_compressed }}" ./${{ steps.meta.outputs.chain }}_runtime.compact.compressed.wasm
sha256sum ./${{ steps.meta.outputs.chain }}_runtime.compact.compressed.wasm | tee -a release-notes.md
cp "$WASM_COMPRESSED" "./${CHAIN}_runtime.compact.compressed.wasm"
sha256sum "./${CHAIN}_runtime.compact.compressed.wasm" | tee -a release-notes.md

- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ steps.meta.outputs.chain }}-runtime-${{ steps.commit.outputs.sha }}
path: |
Expand All @@ -140,13 +164,52 @@ jobs:
release-notes.md
if-no-files-found: error

- name: Publish the GitHub release
if: steps.meta.outputs.tag != ''
uses: softprops/action-gh-release@v2
publish:
name: Publish the GitHub release
needs: build
if: needs.build.outputs.tag != ''
runs-on: ubuntu-latest
# A second run for the same tag waits for the first, then finds its assets.
concurrency:
group: publish-${{ needs.build.outputs.tag }}
cancel-in-progress: false
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
tag_name: ${{ steps.meta.outputs.tag }}
name: ${{ steps.meta.outputs.tag }}
name: ${{ needs.build.outputs.chain }}-runtime-${{ needs.build.outputs.sha }}

# A published runtime is never rebuilt in place: a later build of the same
# tag (other build options or image) need not match the hash enacted on
# chain. Publishing again needs the old assets removed by hand.
- name: Refuse to change a release that already has assets
shell: bash
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.build.outputs.tag }}
run: |
# The lookup the release action makes; any error but a missing release fails the step.
if REL="$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$TAG")"; then
ASSETS="$(jq -r '[.assets[].name] | join(" ")' <<<"$REL")"
elif [ "$(jq -r '.status? // empty' <<<"$REL" 2>/dev/null)" = 404 ]; then
ASSETS=""
else
echo "::error::could not look up the release for $TAG"
exit 1
fi
if [ -n "$ASSETS" ]; then
echo "::error::release $TAG already has assets ($ASSETS); refusing to change it"
exit 1
fi

- uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2
with:
tag_name: ${{ needs.build.outputs.tag }}
name: ${{ needs.build.outputs.tag }}
body_path: release-notes.md
# Never delete an attached asset, even one another run added after the check.
overwrite_files: false
files: |
${{ steps.meta.outputs.chain }}_runtime.compact.compressed.wasm
srtool-${{ steps.meta.outputs.chain }}.json
${{ needs.build.outputs.chain }}_runtime.compact.compressed.wasm
srtool-${{ needs.build.outputs.chain }}.json
Loading
Loading