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

Release v0.13.0 #1898

Merged
merged 29 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dd23213
chore: update deps to enable metadata hash check
wischli Jul 5, 2024
0a26688
chore: update srtool + add on-chain-release-build opts
wischli Jul 5, 2024
3da4e2e
chore: bump spec versions + cleanup migrations
wischli Jul 5, 2024
595b275
fmt: taplo
wischli Jul 5, 2024
d90644b
ci: fix srtool fmt
wischli Jul 5, 2024
4cb3180
ci: apply proper CLI
wischli Jul 5, 2024
3e02647
attempt2 to enable on-chain-release-build
wischli Jul 5, 2024
4f58c15
change srtool build for chevdor/strool-actions action
gpmayorga Jul 5, 2024
a882fd9
desperate attempts to get it working
wischli Jul 6, 2024
805273f
override workdir
gpmayorga Jul 8, 2024
7dd5f48
Try to set permissions wide open before running docker
gpmayorga Jul 8, 2024
559e568
add RUST_BACKTRACE
gpmayorga Jul 8, 2024
9d142f8
revert to our GHA manual process & add enhancements
gpmayorga Jul 8, 2024
b3a97bc
fix package name
gpmayorga Jul 8, 2024
8a259a4
Output information about srtool
gpmayorga Jul 8, 2024
99dce4b
Revert "desperate attempts to get it working"
wischli Jul 9, 2024
4601e21
fix: some scripts
wischli Jul 9, 2024
4ee87b6
fix bad colon on echo command
gpmayorga Jul 9, 2024
a649876
Fix missing colon and remove docker publish release
gpmayorga Jul 9, 2024
cfa9880
upload wasm to release
gpmayorga Jul 9, 2024
6472be0
fix issue with gchr tags
gpmayorga Jul 9, 2024
4a981c0
more semicolon issues
gpmayorga Jul 9, 2024
e52d367
Merge branch 'main' into release-v0.13.0
gpmayorga Jul 9, 2024
5edb9bf
unique name for delete untagged
gpmayorga Jul 9, 2024
d43b773
fix delete_untagged
gpmayorga Jul 9, 2024
ac4d669
move delete_untagged under workflows
gpmayorga Jul 9, 2024
acc6ff5
move delete untagged to manual runs
gpmayorga Jul 9, 2024
c4785b1
review bash syntax for wasm build
gpmayorga Jul 9, 2024
209167e
recover cache and limit sanity check build time
gpmayorga Jul 9, 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
17 changes: 9 additions & 8 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
- name: Build and push centrifugeio/centrifuge-chain
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 #v5.3.0
with:
provenance: false # Solves untagged containers getting into the GH registry https://github.com/docker/build-push-action/issues/894
context: .
file: ./docker/centrifuge-chain/Dockerfile
build-args: |
Expand All @@ -111,14 +112,14 @@ jobs:
short-description: ${{ github.event.repository.description }}
enable-url-completion: true

- name: Update GitHub release
if: github.event_name == 'release' && github.event.action == 'released' && matrix.target == 'release'
uses: softprops/action-gh-release@v1
with:
append_body: true
body: |
**Docker tags (${{ env.NOW }}):**
${{ steps.meta.outputs.tags }}
# - name: Update GitHub release
# if: github.event_name == 'release' && github.event.action == 'released' && matrix.target == 'release'
# uses: softprops/action-gh-release@v1
# with:
# append_body: true
# body: |
# **Docker tags (${{ env.NOW }}):**
# ${{ steps.meta.outputs.tags }}
Comment on lines +115 to +122
Copy link
Contributor

@lemunozm lemunozm Jul 10, 2024

Choose a reason for hiding this comment

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

Tech-debt: should it be maintained in the repo or removed? @gpmayorga

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. IMO, we can remove this!


- if: failure()
name: Check available space after build failed
Expand Down
111 changes: 84 additions & 27 deletions .github/workflows/build-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ jobs:
# Benchmark (with cache hit)
# ubuntu-latest 50 min
# ubuntu-latest-4-cores 34 min
runs-on: ubuntu-latest-4-cores
runs-on: ubuntu-latest-4-cores
strategy:
matrix:
target: [build-runtime]
package: [altair-runtime, centrifuge-runtime, development-runtime]
name: ${{ matrix.target }}-${{ matrix.package }}
chain: [ altair, centrifuge, development ]
name: build-runtime-${{ matrix.chain }}
steps:
# PREP
# PREP
- name: Check out code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b #4.1.4

Expand All @@ -42,22 +41,12 @@ jobs:
./target/srtool
cache-directories: ./runtime

# BUILD
- name: Run srtool # https://docs.substrate.io/reference/command-line-tools/srtool/
run: >
docker run --rm --user root --platform=linux/amd64
-e PACKAGE=${{ matrix.package }} -v /home/runner/.cargo:/cargo-home
-v ${{ github.workspace }}:/build paritytech/srtool:1.75.0-0.14.0
/srtool/build --app

# Alternative way of running SRTool that allows for "script-like" execution,
# extremely useful to debug:

# Use this to debug what's going on inside the srtool container
# - name: Run Docker SRTool
# uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 #v3
# with:
# image: paritytech/srtool:${{ matrix.rust_version }}
# options: --user root -v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e BUILD_OPTS=${{ env.BUILD_OPTS || ''}} -e PACKAGE=${{ matrix.package }}
# options: --user root -v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e BUILD_OPTS=${{ env.BUILD_OPTS || ''}} -e PACKAGE=${{ matrix.chain }}-runtime
# run: |
# echo "---- Env VARS ----"
# echo "BUILD_OPT=${BUILD_OPT}"
Expand All @@ -66,13 +55,60 @@ jobs:
# ls -la /cargo-home/
# du -sh /cargo-home/*
# echo "---- RUNNING BUILD ----"
# /srtool/build --save
# /srtool/build --app --json -cM


# Build and setup env vars:
- name: Run srtool # https://docs.substrate.io/reference/command-line-tools/srtool/
id: srtool_build
shell: bash
run: |
##"RUNNING SRTOOL"
echo ::group::Docker run srtool build ${{ inputs.chain }}
CMD="docker run --rm --user root --platform=linux/amd64
-e PROFILE=release -e PACKAGE=${{ matrix.chain }}-runtime -e BUILD_OPTS="--features=on-chain-release-build"
-v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build
paritytech/srtool:1.77.0-0.15.0 /srtool/build --app --json -cM"
echo ::debug::build::docker_run $CMD
echo ::endgroup
# 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

- name: Upload srtool report
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
with:
name: srtool-wasm-report.txt
path: ./${{ matrix.package }}-srtool-wasm-report.json
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
}

- name: Summary
run: |
## Summary and JSON output
echo "::group::Summary"
echo "- version: ${{ steps.srtool_build.outputs.version }}"
echo "- info: ${{ steps.srtool_build.outputs.info }}"
echo "- prop: ${{ steps.srtool_build.outputs.proposal_hash }}"
echo "- runtime location: ${{ steps.srtool_build.outputs.wasm }}"
echo "::endgroup"

echo "::group::JSON output"
PRETTY_JSON=$(echo '${{ steps.srtool_build.outputs.json }}' | jq .)
echo '${{ steps.srtool_build.outputs.json }}' | jq . > "${{ matrix.chain }}-srtool-digest.json"
echo "JSON Output:"
cat "${{ matrix.chain }}-srtool-digest.json"
echo "::endgroup"

- id: 'auth'
if: github.event_name != 'pull_request'
Expand All @@ -89,8 +125,29 @@ jobs:
if: ${{ steps.auth.outcome == 'success' }}
shell: bash
run: |
runtime_name=$(echo "${{ matrix.package }}" | sed -e "s/-runtime$//" )
filename=$(echo "${{ matrix.package }}" | sed -e 's/-/_/g' )
## Publish WASM and JSON summary
echo '${{ steps.srtool_build.outputs.json }}' | jq . > "${{ matrix.chain }}-srtool-digest.json"
gsutil cp \
./runtime/${runtime_name}/target/srtool/release/wbuild/${{ matrix.package }}/${filename}.compact.compressed.wasm \
gs://centrifuge-wasm-repo/${runtime_name}/${runtime_name}-$(git rev-parse --short HEAD).wasm
"${{ steps.srtool_build.outputs.wasm }}" \
"gs://centrifuge-wasm-repo/${{ matrix.chain }}/${{ matrix.chain }}-$(git rev-parse --short HEAD).wasm"
gsutil cp \
"${{ matrix.chain }}-srtool-digest.json" \
"gs://centrifuge-wasm-repo/${{ matrix.chain }}/${{ matrix.chain }}-$(git rev-parse --short HEAD)-srtool-digest.json"

- name: Upload WASM to release tag ${{ github.ref_name }}
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # @v1
if: github.event_name == 'release'
# https://github.com/ncipollo/release-action
with:
tag: ${{ github.ref_name }}
commit: ${{ github.sha }}
artifacts: "${{ steps.srtool_build.outputs.wasm }}, ${{ matrix.chain }}-srtool-digest.json"
replacesArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
# updateOnlyUnreleased: true # When allowUpdates is enabled, this will fail the action if the release it is updating is not a draft or a prerelease.

45 changes: 45 additions & 0 deletions .github/workflows/delete_untagged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Delete untagged
on:
workflow_dispatch:
jobs:
delete_untagged:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# id-token: write
steps:
- name: Delete untagged ghcr
uses: Chizkiyahu/delete-untagged-ghcr-action@v3
with:
# Personal access token (PAT) used to fetch the repository. The PAT is configured
# with the local git config, which enables your scripts to run authenticated git
# commands. The post-job step removes the PAT.
# needs delete:packages permissions
# required: true
# [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)
token: ${{ secrets.GITHUB_TOKEN }}
# Repository name or name with owner
# Delete only from repository name
# Default: ${{ github.repository }}
repository: 'centrifuge-chain'
# 'The repository owner name'
# Default: ${{ github.repository_owner }}
# repository_owner: ''
# 'The package names'
# Delete only from comma separated package names
# required: false
package_name: 'centrifuge-chain'
# Delete only package versions without tag
# required: false
# Default: true
# choices: true, false
untagged_only: true
# Except untagged multiplatform packages from deletion
# only for untagged_only=true
# needs docker installed
except_untagged_multiplatform: false
# the owner type
# required: true
# choices: org, user
owner_type: 'org'
2 changes: 2 additions & 0 deletions .github/workflows/sanity-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ permissions:
contents: read
jobs:
test-n-lint:
timeout-minutes: 90
name: ${{ matrix.target }}
runs-on: ubuntu-latest-8-cores
strategy:
Expand Down Expand Up @@ -40,6 +41,7 @@ jobs:
RUSTC_WRAPPER: "sccache"

benchmark-check:
# timeout-minutes: 90 # <- Not needed as ubunt-latest is free of charge
name: bench-check-${{ matrix.runtime }}
runs-on: ubuntu-latest #-4-cores
strategy:
Expand Down
Loading