This repository has been archived by the owner on May 15, 2024. It is now read-only.
* Adjust for 12s block times #178
Workflow file for this run
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
name: Release | |
on: | |
push: | |
branches: | |
- release/[0-9]+.[0-9]+.[0-9]+-?[a-z]* | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+-?[a-z]* | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
release-check: | |
if: startsWith(github.ref, 'refs/heads/release') | |
name: Check for release | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
strategy: | |
matrix: | |
runtime: [bajun, ajuna] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get crate and release versions | |
run: | | |
echo "CRATE_VERSIONS=$(cargo tree --depth=0 --workspace | egrep -o '[0-9]+\.[0-9]+\.[0-9]+' | uniq)" >> $GITHUB_ENV | |
echo "RELEASE_VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV | |
- name: Check release version is bumped | |
run: | | |
[ -z "$(git tag --list)" ] && { | |
echo "skipping as there are no tags yet" | |
exit 0 | |
} | |
TAG=$(git describe --tags --abbrev=0 | tr -d v) | |
echo "previous release version: $TAG" | |
echo "current release version: ${{ env.RELEASE_VERSION }}" | |
[ $TAG -eq ${{ env.RELEASE_VERSION }} ] && { | |
echo "release version must be bumped" | |
exit 1 | |
} | |
exit 0 | |
- name: Check crate and release versions match | |
run: | | |
[ $(echo ${{ env.CRATE_VERSIONS }} | wc -w | xargs) -ne 1 ] && { | |
echo "all crate versions should be equal" | |
exit 1 | |
} | |
[ "${{ env.CRATE_VERSIONS }}" != "${{ env.RELEASE_VERSION }}" ] && { | |
echo "release version (${{ env.CRATE_VERSIONS }}) is not equal to crate versions (${{ env.CRATE_VERSIONS }})" | |
exit 1 | |
} | |
echo "crate version: ${{ env.CRATE_VERSIONS }}" | |
echo "release version: ${{ env.RELEASE_VERSION }}" | |
exit 0 | |
- name: Check spec version match | |
run: | | |
RELEASE_VERSION=$(echo ${{ env.RELEASE_VERSION }} | tr -d .) | |
RELEASE_VERSION_INTEGER=$((10#$RELEASE_VERSION)) | |
SPEC_VERSION=$(grep "spec_version" runtime/${{ matrix.runtime }}/**/lib.rs | egrep -o "[0-9]+") | |
echo "release version as integer: $RELEASE_VERSION_INTEGER" | |
echo "spec version: $SPEC_VERSION" | |
[ "$RELEASE_VERSION_INTEGER" != "$SPEC_VERSION" ] && { | |
echo "spec version doesn't match release version" | |
exit 1 | |
} | |
exit 0 | |
- run: sudo apt-get install -y protobuf-compiler | |
- name: Check wasm build | |
run: cargo check --all-features --all-targets --release -p ${{ matrix.runtime }}-runtime | |
release-check-try-runtime: | |
if: startsWith(github.ref, 'refs/heads/release') | |
needs: [release-check] | |
name: Check release in try-runtime | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [bajun] | |
include: | |
- runtime: bajun | |
uri: "ws://rpc-rococo.bajun.network:9944" | |
env: | |
TRY_RUNTIME_VER: v0.5.0 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create testing directories | |
run: mkdir -p try-runtime-tests | |
- name: Build try-runtime compatible binary | |
run: | | |
sudo apt-get install -y protobuf-compiler | |
cargo build-${{ matrix.runtime }} --features try-runtime | |
cp target/release/wbuild/${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.compressed.wasm try-runtime-tests/runtime.wasm | |
- name: Install try-runtime tool | |
run: | | |
cd try-runtime-tests | |
wget -q "https://github.com/paritytech/try-runtime-cli/releases/download/${{ env.TRY_RUNTIME_VER }}/try-runtime-x86_64-unknown-linux-musl" | |
chmod +x try-runtime-x86_64-unknown-linux-musl && mv try-runtime-x86_64-unknown-linux-musl try-runtime | |
./try-runtime --version | |
- name: Run try-runtime checks | |
run: | | |
cd try-runtime-tests | |
./try-runtime --runtime=runtime.wasm --wasm-execution=compiled on-runtime-upgrade --checks "try-state" live --uri=${{ matrix.uri }} | |
release-check-zombienet: | |
if: startsWith(github.ref, 'refs/heads/release') | |
needs: [release-check, release-check-try-runtime] | |
name: Check release in zombienet | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [bajun, ajuna] | |
env: | |
ZOMBIENET_VERSION: v1.3.82 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Create testing directories | |
run: mkdir -p zombienet-tests/bin | |
- name: Setup zombienet binaries | |
run: | | |
cd zombienet-tests/bin | |
wget -q "https://github.com/paritytech/zombienet/releases/download/${{ env.ZOMBIENET_VERSION }}/zombienet-linux-x64" | |
chmod +x zombienet-linux-x64 | |
mv zombienet-linux-x64 zombienet | |
./zombienet setup polkadot -y || : | |
./zombienet version | |
- name: Copy network config and tests | |
run: cp .maintain/zombienet-* zombienet-tests/ | |
- name: Build and copy collator binary to zombienet binaries | |
run: | | |
sudo apt-get install -y protobuf-compiler | |
cargo build-${{ matrix.runtime }} | |
cp target/release/${{ matrix.runtime }}-para zombienet-tests/bin/collator | |
- name: Run zombienet tests | |
run: ./zombienet-tests/bin/zombienet -l "text" -p native test ./zombienet-tests/zombienet-tests.zndsl | |
release: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [bajun, ajuna] | |
env: | |
SUBWASM_VERSION: v0.19.1 | |
steps: | |
- uses: actions/checkout@v3 | |
- id: srtool_build | |
uses: chevdor/[email protected] | |
with: | |
image: paritytech/srtool | |
chain: ${{ matrix.runtime }} | |
tag: 1.70.0 | |
- name: Install subwasm {{ env.SUBWASM_VERSION }} | |
run: | | |
wget https://github.com/chevdor/subwasm/releases/download/${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_${{ env.SUBWASM_VERSION }}.deb -O subwasm.deb | |
sudo dpkg -i subwasm.deb | |
- name: Run subwasm info | |
run: | | |
echo "\`\`\`" > ${{ matrix.runtime }}-info.txt | |
echo -e "${{ matrix.runtime }}-runtime:\n" >> ${{ matrix.runtime }}-info.txt | |
subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} \ | |
| sed -E 's/^Running subwasm.+$//' \ | |
| sed '/^$/d' \ | |
>> ${{ matrix.runtime }}-info.txt | |
echo "\`\`\`" >> ${{ matrix.runtime }}-info.txt | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.runtime }}-artifact | |
path: | | |
${{ steps.srtool_build.outputs.wasm_compressed }} | |
${{ matrix.runtime }}-info.txt | |
if-no-files-found: error | |
release-draft: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
- run: | | |
echo "## Subwasm Info" > runtime-info.txt | |
cat **/*-info.txt >> runtime-info.txt | |
echo "---" >> runtime-info.txt | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
generate_release_notes: true | |
append_body: true | |
body_path: runtime-info.txt | |
files: "**/*_runtime.compact.compressed.wasm" | |
release-docker: | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
image: | |
- { | |
name: parachain-bajun, | |
build_arg_feature: bajun, | |
build_arg_bin: bajun-para, | |
} | |
- { | |
name: parachain-ajuna, | |
build_arg_feature: ajuna, | |
build_arg_bin: ajuna-para, | |
} | |
outputs: | |
image_tag: ${{ steps.set_image_tag.outputs.image_tag }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: ${{ matrix.image.name }} | |
- name: Get image tag from the tag name | |
id: set_image_tag | |
run: | | |
IMAGE_TAG="${GITHUB_REF#refs/tags/v}" | |
echo "image_tag=$IMAGE_TAG" >> $GITHUB_ENV | |
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT | |
- uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/Dockerfile | |
push: true | |
tags: | | |
ajuna/${{ matrix.image.name }}:${{ env.image_tag }} | |
ajuna/${{ matrix.image.name }}:latest | |
build-args: | | |
features=${{ matrix.image.build_arg_feature }} | |
bin=${{ matrix.image.build_arg_bin }} | |
cache-from: type=registry,ref=ajuna/${{ matrix.image.name }}:buildcache | |
cache-to: type=registry,ref=ajuna/${{ matrix.image.name }}:buildcache,mode=max | |
release-onf: | |
needs: release-docker | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
runtime: [bajun, ajuna] | |
include: | |
- runtime: bajun | |
network_key: ONF_BAJUN_NETWORK_KEY | |
- runtime: ajuna | |
network_key: ONF_AJUNA_NETWORK_KEY | |
steps: | |
- uses: OnFinality-io/action-onf-release@v1 | |
with: | |
onf-access-key: ${{ secrets.ONF_ACCESS_KEY }} | |
onf-secret-key: ${{ secrets.ONF_SECRET_KEY }} | |
onf-workspace-id: ${{ secrets.ONF_WORKSPACE_ID }} | |
onf-network-key: ${{ secrets[matrix.network_key] }} | |
onf-sub-command: image | |
onf-action: add | |
image-version: ${{ needs.release-docker.outputs.image_tag }} |