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

Small CI improvements #1924

Merged
merged 11 commits into from
Jul 23, 2024
32 changes: 14 additions & 18 deletions .github/workflows/build-wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ jobs:
# Benchmark (with cache hit)
# ubuntu-latest 50 min
# ubuntu-latest-4-cores 34 min
runs-on: ubuntu-latest-4-cores
# As this is not a critical PR feedback item, we can run it on free ubuntu-latest
runs-on: ubuntu-latest
strategy:
matrix:
chain: [ altair, centrifuge, development ]
name: build-runtime-${{ matrix.chain }}
env:
SRTOOL_IMAGE: "paritytech/srtool:1.77.0-0.15.0"
steps:
# PREP
- name: Check out code
Expand All @@ -47,6 +50,7 @@ jobs:
# 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.chain }}-runtime
# 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 @@ -68,7 +72,7 @@ jobs:
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"
${{ env.SRTOOL_IMAGE }} /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
Expand All @@ -79,30 +83,17 @@ jobs:
JSON="$line"
done
echo "json=$JSON" >> $GITHUB_OUTPUT

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"

## JSON output
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"
Expand All @@ -128,7 +119,12 @@ jobs:
## Publish WASM and JSON summary
echo '${{ steps.srtool_build.outputs.json }}' | jq . > "${{ matrix.chain }}-srtool-digest.json"
gsutil cp \
"${{ steps.srtool_build.outputs.wasm }}" \
"${{ steps.srtool_build.wasm_compressed }}" \
"gs://centrifuge-wasm-repo/${{ matrix.chain }}/${{ matrix.chain }}-$(git rev-parse --short HEAD).wasm"
## Publish WASM and JSON summary
echo '${{ steps.srtool_build.outputs.json }}' | jq . > "${{ matrix.chain }}-srtool-digest.json"
gsutil cp \
"${{ steps.srtool_build.wasm_compressed }}" \
"gs://centrifuge-wasm-repo/${{ matrix.chain }}/${{ matrix.chain }}-$(git rev-parse --short HEAD).wasm"
gsutil cp \
"${{ matrix.chain }}-srtool-digest.json" \
Expand All @@ -141,7 +137,7 @@ jobs:
with:
tag: ${{ github.ref_name }}
commit: ${{ github.sha }}
artifacts: "${{ steps.srtool_build.outputs.wasm }}, ${{ matrix.chain }}-srtool-digest.json"
artifacts: "${{ steps.srtool_build.wasm_compressed }}, ${{ matrix.chain }}-srtool-digest.json"
replacesArtifacts: true
allowUpdates: true
artifactErrorsFailBuild: true
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
pull_request_review:
types: [submitted]
workflow_dispatch:
name: Code coverage
concurrency:
group: 'codecov-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Expand All @@ -11,8 +15,13 @@ permissions:
contents: read
jobs:
codecov:
runs-on: ubuntu-latest-8-cores
if: github.event.pull_request.draft == false || github.ref == 'refs/heads/main'
runs-on: ubuntu-latest-4-cores
if: >
github.event.pull_request.draft == false ||
github.ref == 'refs/heads/main' ||
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved') ||
github.event.action == 'ready_for_review' ||
github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@master

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sanity-checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
name: Sanity checks
concurrency:
group: 'tests-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
Expand Down
Loading