Skip to content

Commit

Permalink
Fix/srtool ci (#1907)
Browse files Browse the repository at this point in the history
* Update srtool.yml

* Update srtool.yml

* Update srtool.yml

* add LP-DOT/sDOT
  • Loading branch information
mclyk authored Nov 30, 2022
1 parent 25b24d0 commit 4f2f8f0
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 96 deletions.
67 changes: 5 additions & 62 deletions .github/workflows/srtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,20 @@ on:
- "v*"

jobs:
start-runner:
name: start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.PAT_RUNNER }}
ec2-image-id: ${{ secrets.EC2_IMAGE_ID }}
ec2-instance-type: ${{ secrets.EC2_INSTANCE_TYPE }}
subnet-id: ${{ secrets.SUBNET_ID }}
security-group-id: ${{ secrets.SECURITY_GROUP_ID }}
aws-resource-tags: >
[
{"Key": "Name", "Value": "${{ github.workflow }}"},
{"Key": "GitHubRepository", "Value": "${{ github.repository }}"}
]
srtool:
if: github.repository == 'parallel-finance/parallel'
needs: start-runner
runs-on: ${{ needs.start-runner.outputs.label }}
runs-on: ubuntu-latest
strategy:
matrix:
chain: ["heiko", "parallel", "vanilla", "kerria"]
steps:
- name: cleaning up
run: |
echo '${{ secrets.RUNNER_PASSWORD }}' | sudo -S chown -R $USER:$USER $GITHUB_WORKSPACE
echo "HOME=/home/ubuntu" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
- name: Srtool build
id: srtool_build
run: |
make RUNTIME=${{ matrix.chain }}-runtime wasm
uses: chevdor/[email protected]
with:
chain: ${{ matrix.chain }}
runtime_dir: runtime/${{ matrix.chain }}
- name: Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.chain }}-srtool-digest.json
Expand Down Expand Up @@ -149,27 +116,3 @@ jobs:
uses: Ilshidur/action-discord@master
with:
args: "Parallel ${{ steps.git_tag.outputs.tag }} has just been released! Go check it out: https://github.com/${{ github.repository }}/releases/tag/${{ steps.git_tag.outputs.tag }}"

stop-runner:
name: stop self-hosted EC2 runner
needs:
- start-runner
- srtool
- postrelease
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.PAT_RUNNER }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}
15 changes: 14 additions & 1 deletion scripts/helper/src/config/heiko.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"symbol": "sKSM",
"assetId": 1000,
"decimal": 12,
"balances": []
"balances": [["5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf", "11000000000"]]
},
{
"name": "Parallel Crowdloans Kusama - (0 ~ 7)",
Expand Down Expand Up @@ -102,6 +102,13 @@
"decimal": 12,
"balances": []
},
{
"name": "Parallel LP-KSM/sKSM",
"symbol": "LP-KSM/sKSM",
"assetId": 5003,
"decimal": 12,
"balances": []
},
{
"name": "Shiden",
"symbol": "SDN",
Expand Down Expand Up @@ -257,6 +264,12 @@
"liquidityAmounts": ["10000000000000000", "30000000000000000000"],
"lptokenReceiver": "5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf",
"liquidityProviderToken": 5002
},
{
"pool": [1000, 100],
"liquidityAmounts": ["10000000000", "10000000000"],
"lptokenReceiver": "5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf",
"liquidityProviderToken": 6003
}
],
"crowdloans": [
Expand Down
15 changes: 14 additions & 1 deletion scripts/helper/src/config/parallel.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"symbol": "sDOT",
"assetId": 1001,
"decimal": 10,
"balances": []
"balances": [["5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf", "1100000000"]]
},
{
"name": "Parallel Crowdloans Polkadot - (0 ~ 7)",
Expand Down Expand Up @@ -112,6 +112,13 @@
"decimal": 12,
"balances": []
},
{
"name": "Parallel LP-DOT/sDOT",
"symbol": "LP-DOT/sDOT",
"assetId": 6003,
"decimal": 12,
"balances": []
},
{
"name": "Parallel LP-DOT/CDOT-7-14",
"symbol": "LP-DOT/CDOT-7-14",
Expand Down Expand Up @@ -298,6 +305,12 @@
"liquidityAmounts": ["10000000000000000", "10000000000000000"],
"lptokenReceiver": "5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf",
"liquidityProviderToken": 6005
},
{
"pool": [1001, 101],
"liquidityAmounts": ["1000000000", "1000000000"],
"lptokenReceiver": "5HHMY7e8UAqR5ZaHGaQnRW5EDR8dP7QpAyjeBu6V7vdXxxbf",
"liquidityProviderToken": 6003
}
],
"crowdloans": [
Expand Down
39 changes: 7 additions & 32 deletions scripts/srtool-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,15 @@ cd $DIR/../

set -xe

RUSTC_VERSION=1.62.0;
RUSTC_VERSION=1.64.0;
PACKAGE=${PACKAGE:-vanilla-runtime};
BUILD_OPTS=$BUILD_OPTS;

CMD="docker run \
-i \
--rm \
-e PACKAGE=${PACKAGE} \
-e BUILD_OPTS="${BUILD_OPTS}" \
-v ${PWD}:/build \
-v ${TMPDIR}/cargo:/cargo-home \
docker run --rm -it \
-e PACKAGE=$PACKAGE \
-e BUILD_OPTS="$BUILD_OPTS" \
-v $PWD:/build \
-v $TMPDIR/cargo:/cargo-home \
--user root \
--network=host \
paritytech/srtool:${RUSTC_VERSION} \
build --app --json -cM"

stdbuf -oL $CMD | {
while IFS= read -r line
do
echo$line
JSON="$line"
done

echo ::set-output name=json::$JSON

PROP=`echo $JSON | jq -r .runtimes.compact.prop`
echo ::set-output name=proposal_hash::$PROP

WASM=`echo $JSON | jq -r .runtimes.compact.wasm`
echo ::set-output name=wasm::$WASM

Z_WASM=`echo $JSON | jq -r .runtimes.compressed.wasm`
echo ::set-output name=wasm_compressed::$Z_WASM

IPFS=`echo $JSON | jq -r .runtimes.compact.ipfs`
echo ::set-output name=ipfs::$IPFS
}
paritytech/srtool:$RUSTC_VERSION

0 comments on commit 4f2f8f0

Please sign in to comment.