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

Switch self-hosted runners to ubicloud github runners #1877

Merged
merged 37 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
be8050c
runs-on: ubicloud
saraswatpuneet Feb 13, 2024
5d017dc
runs-on: ubicloud-standard-2
saraswatpuneet Feb 13, 2024
8d751fb
address feedback and fix code cov action
saraswatpuneet Feb 14, 2024
0ad82f8
ubicloud-standard-4
saraswatpuneet Feb 14, 2024
2f0f723
try root user
saraswatpuneet Feb 14, 2024
a8c63ca
try use permission on/build
saraswatpuneet Feb 14, 2024
e81f21e
mkdir and give permissions
saraswatpuneet Feb 14, 2024
f52282a
run as root
saraswatpuneet Feb 14, 2024
22ddc0f
try standar-8 for code cov?
saraswatpuneet Feb 15, 2024
d505150
try 4 again
saraswatpuneet Feb 15, 2024
20a6f11
use standard 8 for code coverage
saraswatpuneet Feb 15, 2024
c77da2b
run benchmarks on self hosted
saraswatpuneet Feb 15, 2024
38e3a86
to prevent network issues, setting this is suggested
saraswatpuneet Feb 16, 2024
9188ec3
try standard 4 for code coverage jobs
saraswatpuneet Feb 26, 2024
0ad29e0
revert back to standard 8 for code coverage
saraswatpuneet Feb 26, 2024
31261af
Touch rust file to test rust flows
wilwade Apr 23, 2024
6ab24cf
Enable retry instead of git-fetch-with-cli
wilwade Apr 24, 2024
a336077
Are required packages actually required?
wilwade Apr 24, 2024
369491c
Upgrade srtool to use image 1.77.0
wilwade Apr 24, 2024
deaca70
Unused workflow
wilwade Apr 24, 2024
6a21aad
Switch e2e tests to use ubicloud
wilwade Apr 24, 2024
ff9e9c7
Tweaking what runs on what power runner
wilwade Apr 24, 2024
1a8c72f
srtool action instead of using srtool-cli
wilwade Apr 27, 2024
23bc711
runtime_dir
wilwade Apr 27, 2024
1c86a3f
runtime-dir
wilwade Apr 27, 2024
9d2fd98
Set the srtool job id
wilwade Apr 27, 2024
1a01e0a
Merge remote-tracking branch 'origin/main' into ubicloud
wilwade Apr 30, 2024
0b3ce58
Testing workflow
wilwade Apr 30, 2024
0a11459
Setting GHA permissions to write to create release and release branch
wilwade Apr 30, 2024
8a746a5
Remove custom base image where not needed
wilwade Apr 30, 2024
1dd8296
Add arch back in
wilwade Apr 30, 2024
d2916bc
Revert "Testing workflow"
wilwade Apr 30, 2024
0f8af34
Remove unneeded comment
wilwade May 1, 2024
16e79cc
Remove unneeded ci image use
wilwade May 1, 2024
1c5a338
Switch around CI power levels
wilwade May 1, 2024
93dd3ba
16 is the max
wilwade May 1, 2024
6d2915e
Revert "Switch around CI power levels"
wilwade May 1, 2024
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
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ rustflags = [
"-Dclippy::unwrap_used",
"-Dclippy::expect_used",
]

[net]
retry = 5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needed due to the location of the ubicloud runners

43 changes: 0 additions & 43 deletions .github/workflows/common/reset-self-hosted-runner/action.yml

This file was deleted.

234 changes: 234 additions & 0 deletions .github/workflows/common/srtool/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# This is a copy of the action file from https://github.com/chevdor/srtool-actions/blob/48e9baed50ca414936dfac59d34d8b9bbe581abd/action.yml
# It is pulled in and modified for the following reasons:
# 1. We needed to add an additional environment variable to the docker run (CARGO_NET_RETRY=10)
# 2. Local for direct auditing of the action building the runtime

name: "Srtool"
description: "Build WASM Runtime with SRTOOL"
author: chevdor
branding:
icon: "package"
color: "blue"

inputs:
chain:
description: >
Name of the chain, ie. polkadot
required: true

package:
description: >
Runtime package to build, ie. polkadot-runtime.
If your runtime follows this pattern, you don't have and should not provide this input.

If not provided, it will be set to <chain>-runtime
required: false

image:
description: >
You can use an alternate image, use with caution!
default: "paritytech/srtool"
required: true

tag:
description: >
Tag of the srtool image to use. Omit to use the latest (recommended)
required: false

workdir:
description: >
Path of the project, this is where your main Cargo.toml is located. This is relative to $GITHUB_WORKSPACE.
default: "."
required: false

runtime_dir:
description: >
Location of the runtime in your repo. The default is 'runtime/<chain_name>'
required: false

profile:
description: >
Which profile to use with cargo build.
required: false
default: "release"

outputs:
json:
description: >
The full json output of srtool. If you need more information than this action provides by default,
you can use this json output and extract some content using 'jq'.
value: ${{ steps.build.outputs.json }}

proposal_hash:
description: The proposal hash as it will show on-chain
value: ${{ steps.build.outputs.proposal_hash }}

version:
description: The version of srtool
value: ${{ steps.build.outputs.version }}

info:
description: Some information from srtool about the current project
value: ${{ steps.build.outputs.info }}

ipfs:
description: ipfs hash
value: ${{ steps.build.outputs.ipfs }}

wasm:
description: Path of the produced compact runtime
value: ${{ steps.build.outputs.wasm }}

wasm_compressed:
description: Path of the produced compressed runtime
value: ${{ steps.build.outputs.wasm_compressed }}

runs:
using: "composite"
steps:
- id: check_latest_srtool
name: Check the version of the latest srtool
shell: bash
run: |
echo ::group::Inputs
echo "- image: ${{ inputs.image }}"
echo "- chain: ${{ inputs.chain }}"
echo ::endgroup::

RUSTC_VERSION_URL=https://raw.githubusercontent.com/${{ inputs.image }}/master/RUSTC_VERSION
echo Fetching RUSTC_VERSION from $RUSTC_VERSION_URL
RUSTC_VERSION=`curl -s $RUSTC_VERSION_URL`

SRTOOL_VERSION_URL=https://raw.githubusercontent.com/${{ inputs.image }}/master/VERSION
echo Fetching SRTOOL_VERSION from $SRTOOL_VERSION_URL
SRTOOL_VERSION=`curl -s $SRTOOL_VERSION_URL`

echo "RUSTC_VERSION=$RUSTC_VERSION" >> $GITHUB_ENV
echo "SRTOOL_VERSION=$SRTOOL_VERSION" >> $GITHUB_ENV
echo "SRTOOL_LATEST=$RUSTC_VERSION" >> $GITHUB_ENV

- id: env_setup
name: Setting Env
shell: bash
run: |
echo ::group::Debug
echo "RUSTC_VERSION=$RUSTC_VERSION"
echo "SRTOOL_VERSION=$SRTOOL_VERSION"
echo "SRTOOL_LATEST=$RUSTC_VERSION"
echo ::endgroup::

echo ::group::Environment setup
SRTOOL_TAG=${{ inputs.tag || env.SRTOOL_LATEST }}
echo "SRTOOL_TAG=$SRTOOL_TAG" >> $GITHUB_ENV
echo "SRTOOL_IMAGE=${{ inputs.image }}:$SRTOOL_TAG" >> $GITHUB_ENV
echo "WORKDIR=${{ github.workspace }}/${{ inputs.workdir }}" >> $GITHUB_ENV

RUNTIME_DIR=${{ inputs.runtime_dir }}
RUNTIME_DIR=${RUNTIME_DIR:-'runtime/'${{ inputs.chain }}}
echo "RUNTIME_DIR=$RUNTIME_DIR" >> $GITHUB_ENV

PACKAGE=${{ inputs.package }}
PACKAGE=${PACKAGE:-${{ inputs.chain }}'-runtime'}
echo "PACKAGE=$PACKAGE" >> $GITHUB_ENV

echo "BUILD_OPTS=${{ env.BUILD_OPTS }}" >> $GITHUB_ENV

PROFILE=${{ inputs.profile }}
echo "PROFILE=$PROFILE" >> $GITHUB_ENV

PARACHAIN_PALLET_ID=${{ env.PARACHAIN_PALLET_ID }}
PARACHAIN_PALLET_ID=${PARACHAIN_PALLET_ID:-0x01}
AUTHORIZE_UPGRADE_PREFIX=${{ env.AUTHORIZE_UPGRADE_PREFIX }}
AUTHORIZE_UPGRADE_PREFIX=${AUTHORIZE_UPGRADE_PREFIX:-0x02}
echo "PARACHAIN_PALLET_ID=$PARACHAIN_PALLET_ID" >> $GITHUB_ENV
echo "AUTHORIZE_UPGRADE_PREFIX=$AUTHORIZE_UPGRADE_PREFIX" >> $GITHUB_ENV

echo ::endgroup::

- id: env_check
name: Checking Env
shell: bash
run: |
echo ::group::Environment check

echo ℹ️ SRTOOL_LATEST: ${{ env.SRTOOL_LATEST }}
echo ℹ️ image: ${{ env.SRTOOL_IMAGE }}
echo ℹ️ chain: ${{ inputs.chain }}
echo ℹ️ package: ${{ env.PACKAGE }}
echo ℹ️ Github Workspace: ${{ github.workspace }}
echo ℹ️ workdir: ${{ env.WORKDIR }}
echo ℹ️ runtime_dir: ${{ env.RUNTIME_DIR }}
echo ℹ️ build_opts: ${{ env.BUILD_OPTS }}
echo ℹ️ parachain_pallet_id: ${{ env.PARACHAIN_PALLET_ID }}
echo ℹ️ profile: ${{ env.PROFILE }}
echo ℹ️ authorize_upgrade_prefix: ${{ env.AUTHORIZE_UPGRADE_PREFIX }}
echo ℹ️ .git folder: `ls -ald ${{ env.WORKDIR }}/.git`
echo ℹ️ Cargo.toml: `ls -al ${{ env.WORKDIR }}/Cargo.toml`

echo ::endgroup::

- id: pulling_srtool
name: Build ${{ env.PACKAGE }} using ${{ env.SRTOOL_IMAGE }}
shell: bash
run: |
echo ::group::Pulling the srtool docker image: ${{ env.SRTOOL_IMAGE }}
docker pull ${{ env.SRTOOL_IMAGE }}
echo ::endgroup::

- id: version
shell: bash
run: |
echo ::group::Srtool version
CMD="docker run -i --rm -v ${{ env.WORKDIR }}:/build ${{ env.SRTOOL_IMAGE }} version -cM"
JSON=`$CMD`
echo $JSON | jq .
echo "version=$JSON" >> $GITHUB_OUTPUT
echo ::endgroup::

- id: info
shell: bash
run: |
echo ::group::srtool info
CMD="docker run -i --rm -v ${{ env.WORKDIR }}:/build ${{ env.SRTOOL_IMAGE }} info -cM"
JSON=`$CMD`
echo $JSON | jq .
echo "info=$JSON" >> $GITHUB_OUTPUT
echo ::endgroup::

- id: build
name: Build ${{ env.PACKAGE }} using ${{ env.SRTOOL_IMAGE }}
shell: bash
env:
# https://github.com/paritytech/polkadot-sdk/pull/2217
WASM_BUILD_STD: "0"
run: |
echo ::group::Srtool build of chain ${{ inputs.chain }}
CMD="docker run -i --rm -e CARGO_NET_RETRY=10 -e PACKAGE=${{ env.PACKAGE }} -e RUNTIME_DIR=${{ env.RUNTIME_DIR }} -e BUILD_OPTS -e
PARACHAIN_PALLET_ID -e AUTHORIZE_UPGRADE_PREFIX -e PROFILE -e WASM_BUILD_STD -v ${{ env.WORKDIR }}:/build ${{ env.SRTOOL_IMAGE
}} build --app --json -cM"

echo ::debug::build::docker_run $CMD
# here we keep streaming the progress and fetch the last line for the json result
stdbuf -oL $CMD | {
while IFS= read -r line
do
echo ║ $line
JSON="$line"
done

echo "json=$JSON" >> $GITHUB_OUTPUT
echo $JSON | jq .

PROP=`echo $JSON | jq -r .runtimes.compact.prop`
echo "proposal_hash=$PROP" >> $GITHUB_OUTPUT

WASM=`echo $JSON | jq -r .runtimes.compact.wasm`
echo "wasm=$WASM" >> $GITHUB_OUTPUT

Z_WASM=`echo $JSON | jq -r .runtimes.compressed.wasm`
echo "wasm_compressed=$Z_WASM" >> $GITHUB_OUTPUT

IPFS=`echo $JSON | jq -r .runtimes.compact.ipfs`
echo "ipfs=$IPFS" >> $GITHUB_OUTPUT
}
echo ::endgroup::
2 changes: 1 addition & 1 deletion .github/workflows/e2e-testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
jobs:
run-e2e:
name: Run E2E Tests
runs-on: [self-hosted, Linux, X64, build, v2]
runs-on: ubuntu-22.04
container: ghcr.io/libertydsnp/frequency/ci-base-image:latest
steps:
- name: Validate
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/merge-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jobs:
changes:
name: Determine Changed Files
runs-on: ubuntu-22.04
container: ghcr.io/libertydsnp/frequency/ci-base-image:latest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll see a lot of places where I removed the use of the ci-base-image. It really is only needed for things that use rust.

outputs:
ci-base-image: ${{steps.filter.outputs.ci-base-image}}
steps:
Expand All @@ -28,7 +27,7 @@ jobs:

publish-js-api-augment-rc:
name: Merge - Publish JS API Augment Release Candidate
runs-on: [self-hosted, Linux, X64, build, v2]
runs-on: ubicloud-standard-4
container: ghcr.io/libertydsnp/frequency/ci-base-image:latest
steps:
- name: Check Out Repo
Expand Down Expand Up @@ -65,7 +64,7 @@ jobs:

calc-code-coverage:
name: Merge - Calculate Code Coverage
runs-on: [self-hosted, Linux, X64, build, v2]
runs-on: ubicloud-standard-8
saraswatpuneet marked this conversation as resolved.
Show resolved Hide resolved
container: ghcr.io/libertydsnp/frequency/ci-base-image:latest
steps:
- name: Check Out Repo
Expand Down
Loading