This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
ci: use srtool-actions to build runtimes #3423
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,38 +24,27 @@ jobs: | |
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
runtime: ['polkadot', 'kusama'] | ||
container: | ||
image: paritytech/srtool:nightly-2021-03-15 | ||
volumes: | ||
- ${{ github.workspace }}:/build | ||
env: | ||
PACKAGE: ${{ matrix.runtime }}-runtime | ||
RUSTC_VERSION: nightly-2020-10-27 | ||
runtime: ["polkadot", "kusama", "westend"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Cache target dir | ||
uses: actions/cache@v2 | ||
with: | ||
path: '${{ github.workspace }}/runtime/${{ matrix.runtime }}/target' | ||
path: "${{ github.workspace }}/runtime/${{ matrix.runtime }}/target" | ||
key: srtool-target-${{ matrix.runtime }}-${{ github.sha }} | ||
restore-keys: | | ||
srtool-target-${{ matrix.runtime }}- | ||
srtool-target- | ||
- name: Build ${{ matrix.runtime }} runtime | ||
id: build-runtime | ||
shell: bash | ||
env: | ||
srtool_output_filename: ${{ matrix.runtime }}_srtool_output.json | ||
id: srtool_build | ||
uses: chevdor/srtool-actions@v0.3.0 | ||
with: | ||
# This is the default with chevdor/srtool-actions@v0.3.0 but we make it clear | ||
image: paritytech/srtool | ||
chain: ${{ matrix.runtime }} | ||
- name: Store srtool digest to disk | ||
run: | | ||
cd /build | ||
pwd | ||
ls -la | ||
build --json | tee $srtool_output_filename | ||
cat $srtool_output_filename | ||
while IFS= read -r line; do | ||
echo "::set-output name=$line::$(jq -r ".$line" < $srtool_output_filename)" | ||
done <<< "$(jq -r 'keys[]' < $srtool_output_filename)" | ||
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.runtime }}_srtool_output.json | ||
- name: Upload ${{ matrix.runtime }} srtool json | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
|
@@ -65,49 +54,52 @@ jobs: | |
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.runtime }}-runtime | ||
path: "${{ steps.build-runtime.outputs.wasm }}" | ||
path: | | ||
${{ steps.srtool_build.outputs.wasm }} | ||
${{ steps.srtool_build.outputs.wasm_compressed }} | ||
|
||
publish-draft-release: | ||
runs-on: ubuntu-latest | ||
needs: ['get-rust-versions', 'build-runtimes'] | ||
needs: ["get-rust-versions", "build-runtimes"] | ||
outputs: | ||
release_url: ${{ steps.create-release.outputs.html_url }} | ||
asset_upload_url: ${{ steps.create-release.outputs.upload_url }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
path: polkadot | ||
- name: Set up Ruby 2.7 | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
- name: Download srtool json output | ||
uses: actions/download-artifact@v2 | ||
- name: Generate release text | ||
env: | ||
RUSTC_STABLE: ${{ needs.get-rust-versions.outputs.rustc-stable }} | ||
RUSTC_NIGHTLY: ${{ needs.get-rust-versions.outputs.rustc-nightly }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gem install changelogerator git toml | ||
ruby $GITHUB_WORKSPACE/polkadot/scripts/github/generate_release_text.rb | tee release_text.md | ||
- name: Create draft release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Polkadot ${{ github.ref }} | ||
body_path: ./release_text.md | ||
draft: true | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
path: polkadot | ||
- name: Set up Ruby 2.7 | ||
uses: actions/setup-ruby@v1 | ||
with: | ||
ruby-version: 2.7 | ||
- name: Download srtool json output | ||
uses: actions/download-artifact@v2 | ||
- name: Generate release text | ||
env: | ||
RUSTC_STABLE: ${{ needs.get-rust-versions.outputs.rustc-stable }} | ||
RUSTC_NIGHTLY: ${{ needs.get-rust-versions.outputs.rustc-nightly }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gem install changelogerator git toml | ||
ruby $GITHUB_WORKSPACE/polkadot/scripts/github/generate_release_text.rb | tee release_text.md | ||
Comment on lines
+72
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks huge There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR did not change that content (despite the diff). It looks like the identation changed though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then PR is good, but in general, it's something that would need some love. |
||
- name: Create draft release | ||
id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Polkadot ${{ github.ref }} | ||
body_path: ./release_text.md | ||
draft: true | ||
|
||
publish-runtimes: | ||
runs-on: ubuntu-latest | ||
needs: ['publish-draft-release'] | ||
needs: ["publish-draft-release"] | ||
strategy: | ||
matrix: | ||
runtime: ['polkadot', 'kusama'] | ||
runtime: ["polkadot", "kusama", "westend"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v2 | ||
|
@@ -122,7 +114,7 @@ jobs: | |
ls "${{ matrix.runtime }}-runtime" | ||
runtime_ver="$(ruby -e 'require "./scripts/github/lib.rb"; puts get_runtime("${{ matrix.runtime }}")')" | ||
echo "::set-output name=runtime_ver::$runtime_ver" | ||
- name: Upload ${{ matrix.runtime }} wasm | ||
- name: Upload compact ${{ matrix.runtime }} wasm | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -131,6 +123,15 @@ jobs: | |
asset_path: "${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.wasm" | ||
asset_name: ${{ matrix.runtime }}_runtime-v${{ steps.get-runtime-ver.outputs.runtime_ver }}.compact.wasm | ||
asset_content_type: application/wasm | ||
- name: Upload compressed ${{ matrix.runtime }} wasm | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.publish-draft-release.outputs.asset_upload_url }} | ||
asset_path: "${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm" | ||
asset_name: ${{ matrix.runtime }}_runtime-v${{ steps.get-runtime-ver.outputs.runtime_ver }}.compact.compressed.wasm | ||
asset_content_type: application/wasm | ||
|
||
post_to_matrix: | ||
runs-on: ubuntu-latest | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, what happens when you use two lines for the path here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that are the names of two artifacts from
id: srtool_build
jobThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The artifact
${{ matrix.runtime }}-runtime
is an id. Listing several files or a pattern means you end up with several files in this artifact.