Skip to content

Commit ee401ff

Browse files
wischligpmayorga
andauthored
Release v0.13.0 (#1898)
* chore: update deps to enable metadata hash check * chore: update srtool + add on-chain-release-build opts * chore: bump spec versions + cleanup migrations * fmt: taplo * ci: fix srtool fmt * ci: apply proper CLI * attempt2 to enable on-chain-release-build * change srtool build for chevdor/strool-actions action * desperate attempts to get it working * override workdir * Try to set permissions wide open before running docker * add RUST_BACKTRACE * revert to our GHA manual process & add enhancements * fix package name * Output information about srtool * Revert "desperate attempts to get it working" This reverts commit a882fd9. * fix: some scripts * fix bad colon on echo command * Fix missing colon and remove docker publish release * upload wasm to release * fix issue with gchr tags * more semicolon issues * unique name for delete untagged * fix delete_untagged * move delete_untagged under workflows * move delete untagged to manual runs * review bash syntax for wasm build * recover cache and limit sanity check build time --------- Co-authored-by: Guillermo Perez <[email protected]>
1 parent 2710a5f commit ee401ff

File tree

16 files changed

+436
-389
lines changed

16 files changed

+436
-389
lines changed

.github/workflows/build-docker.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ jobs:
8686
- name: Build and push centrifugeio/centrifuge-chain
8787
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 #v5.3.0
8888
with:
89+
provenance: false # Solves untagged containers getting into the GH registry https://github.com/docker/build-push-action/issues/894
8990
context: .
9091
file: ./docker/centrifuge-chain/Dockerfile
9192
build-args: |
@@ -111,14 +112,14 @@ jobs:
111112
short-description: ${{ github.event.repository.description }}
112113
enable-url-completion: true
113114

114-
- name: Update GitHub release
115-
if: github.event_name == 'release' && github.event.action == 'released' && matrix.target == 'release'
116-
uses: softprops/action-gh-release@v1
117-
with:
118-
append_body: true
119-
body: |
120-
**Docker tags (${{ env.NOW }}):**
121-
${{ steps.meta.outputs.tags }}
115+
# - name: Update GitHub release
116+
# if: github.event_name == 'release' && github.event.action == 'released' && matrix.target == 'release'
117+
# uses: softprops/action-gh-release@v1
118+
# with:
119+
# append_body: true
120+
# body: |
121+
# **Docker tags (${{ env.NOW }}):**
122+
# ${{ steps.meta.outputs.tags }}
122123

123124
- if: failure()
124125
name: Check available space after build failed

.github/workflows/build-wasm.yml

Lines changed: 84 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ jobs:
1818
# Benchmark (with cache hit)
1919
# ubuntu-latest 50 min
2020
# ubuntu-latest-4-cores 34 min
21-
runs-on: ubuntu-latest-4-cores
21+
runs-on: ubuntu-latest-4-cores
2222
strategy:
2323
matrix:
24-
target: [build-runtime]
25-
package: [altair-runtime, centrifuge-runtime, development-runtime]
26-
name: ${{ matrix.target }}-${{ matrix.package }}
24+
chain: [ altair, centrifuge, development ]
25+
name: build-runtime-${{ matrix.chain }}
2726
steps:
28-
# PREP
27+
# PREP
2928
- name: Check out code
3029
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b #4.1.4
3130

@@ -42,22 +41,12 @@ jobs:
4241
./target/srtool
4342
cache-directories: ./runtime
4443

45-
# BUILD
46-
- name: Run srtool # https://docs.substrate.io/reference/command-line-tools/srtool/
47-
run: >
48-
docker run --rm --user root --platform=linux/amd64
49-
-e PACKAGE=${{ matrix.package }} -v /home/runner/.cargo:/cargo-home
50-
-v ${{ github.workspace }}:/build paritytech/srtool:1.75.0-0.14.0
51-
/srtool/build --app
52-
53-
# Alternative way of running SRTool that allows for "script-like" execution,
54-
# extremely useful to debug:
55-
44+
# Use this to debug what's going on inside the srtool container
5645
# - name: Run Docker SRTool
5746
# uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 #v3
5847
# with:
5948
# image: paritytech/srtool:${{ matrix.rust_version }}
60-
# options: --user root -v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e BUILD_OPTS=${{ env.BUILD_OPTS || ''}} -e PACKAGE=${{ matrix.package }}
49+
# options: --user root -v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e BUILD_OPTS=${{ env.BUILD_OPTS || ''}} -e PACKAGE=${{ matrix.chain }}-runtime
6150
# run: |
6251
# echo "---- Env VARS ----"
6352
# echo "BUILD_OPT=${BUILD_OPT}"
@@ -66,13 +55,60 @@ jobs:
6655
# ls -la /cargo-home/
6756
# du -sh /cargo-home/*
6857
# echo "---- RUNNING BUILD ----"
69-
# /srtool/build --save
58+
# /srtool/build --app --json -cM
59+
60+
61+
# Build and setup env vars:
62+
- name: Run srtool # https://docs.substrate.io/reference/command-line-tools/srtool/
63+
id: srtool_build
64+
shell: bash
65+
run: |
66+
##"RUNNING SRTOOL"
67+
echo ::group::Docker run srtool build ${{ inputs.chain }}
68+
CMD="docker run --rm --user root --platform=linux/amd64
69+
-e PROFILE=release -e PACKAGE=${{ matrix.chain }}-runtime -e BUILD_OPTS="--features=on-chain-release-build"
70+
-v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build
71+
paritytech/srtool:1.77.0-0.15.0 /srtool/build --app --json -cM"
72+
echo ::debug::build::docker_run $CMD
73+
echo ::endgroup
74+
# here we keep streaming the progress and fetch the last line for the json result
75+
stdbuf -oL $CMD | {
76+
while IFS= read -r line
77+
do
78+
echo ║ $line
79+
JSON="$line"
80+
done
81+
echo "json=$JSON" >> $GITHUB_OUTPUT
7082
71-
- name: Upload srtool report
72-
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
73-
with:
74-
name: srtool-wasm-report.txt
75-
path: ./${{ matrix.package }}-srtool-wasm-report.json
83+
PROP=`echo $JSON | jq -r .runtimes.compact.prop`
84+
echo "proposal_hash=$PROP" >> $GITHUB_OUTPUT
85+
86+
WASM=`echo $JSON | jq -r .runtimes.compact.wasm`
87+
echo "wasm=$WASM" >> $GITHUB_OUTPUT
88+
89+
Z_WASM=`echo $JSON | jq -r .runtimes.compressed.wasm`
90+
echo "wasm_compressed=$Z_WASM" >> $GITHUB_OUTPUT
91+
92+
IPFS=`echo $JSON | jq -r .runtimes.compact.ipfs`
93+
echo "ipfs=$IPFS" >> $GITHUB_OUTPUT
94+
}
95+
96+
- name: Summary
97+
run: |
98+
## Summary and JSON output
99+
echo "::group::Summary"
100+
echo "- version: ${{ steps.srtool_build.outputs.version }}"
101+
echo "- info: ${{ steps.srtool_build.outputs.info }}"
102+
echo "- prop: ${{ steps.srtool_build.outputs.proposal_hash }}"
103+
echo "- runtime location: ${{ steps.srtool_build.outputs.wasm }}"
104+
echo "::endgroup"
105+
106+
echo "::group::JSON output"
107+
PRETTY_JSON=$(echo '${{ steps.srtool_build.outputs.json }}' | jq .)
108+
echo '${{ steps.srtool_build.outputs.json }}' | jq . > "${{ matrix.chain }}-srtool-digest.json"
109+
echo "JSON Output:"
110+
cat "${{ matrix.chain }}-srtool-digest.json"
111+
echo "::endgroup"
76112
77113
- id: 'auth'
78114
if: github.event_name != 'pull_request'
@@ -89,8 +125,29 @@ jobs:
89125
if: ${{ steps.auth.outcome == 'success' }}
90126
shell: bash
91127
run: |
92-
runtime_name=$(echo "${{ matrix.package }}" | sed -e "s/-runtime$//" )
93-
filename=$(echo "${{ matrix.package }}" | sed -e 's/-/_/g' )
128+
## Publish WASM and JSON summary
129+
echo '${{ steps.srtool_build.outputs.json }}' | jq . > "${{ matrix.chain }}-srtool-digest.json"
94130
gsutil cp \
95-
./runtime/${runtime_name}/target/srtool/release/wbuild/${{ matrix.package }}/${filename}.compact.compressed.wasm \
96-
gs://centrifuge-wasm-repo/${runtime_name}/${runtime_name}-$(git rev-parse --short HEAD).wasm
131+
"${{ steps.srtool_build.outputs.wasm }}" \
132+
"gs://centrifuge-wasm-repo/${{ matrix.chain }}/${{ matrix.chain }}-$(git rev-parse --short HEAD).wasm"
133+
gsutil cp \
134+
"${{ matrix.chain }}-srtool-digest.json" \
135+
"gs://centrifuge-wasm-repo/${{ matrix.chain }}/${{ matrix.chain }}-$(git rev-parse --short HEAD)-srtool-digest.json"
136+
137+
- name: Upload WASM to release tag ${{ github.ref_name }}
138+
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # @v1
139+
if: github.event_name == 'release'
140+
# https://github.com/ncipollo/release-action
141+
with:
142+
tag: ${{ github.ref_name }}
143+
commit: ${{ github.sha }}
144+
artifacts: "${{ steps.srtool_build.outputs.wasm }}, ${{ matrix.chain }}-srtool-digest.json"
145+
replacesArtifacts: true
146+
allowUpdates: true
147+
artifactErrorsFailBuild: true
148+
omitBodyDuringUpdate: true
149+
omitDraftDuringUpdate: true
150+
omitNameDuringUpdate: true
151+
omitPrereleaseDuringUpdate: true
152+
# updateOnlyUnreleased: true # When allowUpdates is enabled, this will fail the action if the release it is updating is not a draft or a prerelease.
153+

.github/workflows/delete_untagged.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Delete untagged
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
delete_untagged:
6+
runs-on: ubuntu-latest
7+
permissions:
8+
contents: read
9+
packages: write
10+
# id-token: write
11+
steps:
12+
- name: Delete untagged ghcr
13+
uses: Chizkiyahu/delete-untagged-ghcr-action@v3
14+
with:
15+
# Personal access token (PAT) used to fetch the repository. The PAT is configured
16+
# with the local git config, which enables your scripts to run authenticated git
17+
# commands. The post-job step removes the PAT.
18+
# needs delete:packages permissions
19+
# required: true
20+
# [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
# Repository name or name with owner
23+
# Delete only from repository name
24+
# Default: ${{ github.repository }}
25+
repository: 'centrifuge-chain'
26+
# 'The repository owner name'
27+
# Default: ${{ github.repository_owner }}
28+
# repository_owner: ''
29+
# 'The package names'
30+
# Delete only from comma separated package names
31+
# required: false
32+
package_name: 'centrifuge-chain'
33+
# Delete only package versions without tag
34+
# required: false
35+
# Default: true
36+
# choices: true, false
37+
untagged_only: true
38+
# Except untagged multiplatform packages from deletion
39+
# only for untagged_only=true
40+
# needs docker installed
41+
except_untagged_multiplatform: false
42+
# the owner type
43+
# required: true
44+
# choices: org, user
45+
owner_type: 'org'

.github/workflows/sanity-checks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ permissions:
99
contents: read
1010
jobs:
1111
test-n-lint:
12+
timeout-minutes: 90
1213
name: ${{ matrix.target }}
1314
runs-on: ubuntu-latest-8-cores
1415
strategy:
@@ -40,6 +41,7 @@ jobs:
4041
RUSTC_WRAPPER: "sccache"
4142

4243
benchmark-check:
44+
# timeout-minutes: 90 # <- Not needed as ubunt-latest is free of charge
4345
name: bench-check-${{ matrix.runtime }}
4446
runs-on: ubuntu-latest #-4-cores
4547
strategy:

0 commit comments

Comments
 (0)