Remove unused & invalid chainspec/dryRun*.json files #87
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: Build Release Artifacts | |
on: | |
push: | |
tags: | |
- "*" | |
permissions: read-all | |
jobs: | |
sanity-check: | |
runs-on: ubuntu-24.04 | |
outputs: | |
TAG_NAME: ${{ steps.identify-tag.outputs.TAG_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Figure out tag name | |
id: identify-tag | |
shell: bash | |
run: | | |
TAG_NAME=$(git describe --tag) | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_OUTPUT" | |
- name: Sanity check tag name suffix | |
run: | | |
echo "${{ env.TAG_NAME }}" | grep -E "mainnet|testnet|devnet" | |
.github/check-tag-suffix-vs-origin-branch.sh | |
- name: Check tag name vs. Cargo.toml version | |
run: | | |
./.github/check-version-vs-git-tag.sh | |
setup: | |
runs-on: ubuntu-24.04 | |
needs: sanity-check | |
outputs: | |
build_options: ${{ steps.set-build-options.outputs.build_options}} | |
steps: | |
- name: Set build options | |
id: set-build-options | |
shell: bash | |
run: | | |
echo "build_options=${{ contains( needs.sanity-check.outputs.TAG_NAME, 'devnet') && '--features devnet --features fast-runtime' || '' }}" >> "$GITHUB_OUTPUT" | |
- name: View the build options | |
shell: bash | |
run: | | |
echo "build_options = ${{ steps.set-build-options.outputs.build_options}}" | |
build-native-runtime: | |
needs: | |
- sanity-check | |
- setup | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ubuntu-24.04, windows-2022, macos-13] | |
runs-on: ${{ matrix.operating-system }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Install protobuf | |
uses: arduino/setup-protoc@v3 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure rustc version | |
shell: bash | |
run: | | |
RUSTC_VERSION=$(grep channel rust-toolchain.toml | tail -n1 | tr -d " " | cut -f2 -d'"') | |
echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" | |
- name: Install Rust toolchain | |
uses: gluwa/toolchain@dev | |
with: | |
toolchain: ${{ env.RUSTC_VERSION }} | |
target: wasm32-unknown-unknown | |
profile: minimal | |
override: true | |
- name: Install MacOS aarch64 target | |
if: matrix.operating-system == 'macos-13' | |
uses: gluwa/toolchain@dev | |
with: | |
toolchain: ${{ env.RUSTC_VERSION }} | |
target: aarch64-apple-darwin | |
profile: minimal | |
override: true | |
- uses: Swatinem/rust-cache@v2 | |
- name: Figure out platform | |
shell: bash | |
run: | | |
PLATFORM=$(rustup target list --installed | grep "$(uname -m)") | |
echo "PLATFORM=$PLATFORM" >> "$GITHUB_ENV" | |
- name: DEBUG | |
shell: bash | |
run: | | |
echo "Tag & Platform is '${{ needs.sanity-check.outputs.TAG_NAME }}-${{ env.PLATFORM }}'" | |
- name: Build | |
continue-on-error: true | |
uses: gluwa/cargo@dev | |
with: | |
command: build | |
args: --release ${{ needs.setup.outputs.build_options}} | |
- name: Build MacOS aarch64 target | |
if: matrix.operating-system == 'macos-13' | |
continue-on-error: true | |
uses: gluwa/cargo@dev | |
with: | |
command: build | |
args: --release --target aarch64-apple-darwin | |
- name: Compress | |
continue-on-error: true | |
uses: thedoctor0/[email protected] | |
with: | |
type: "zip" | |
directory: "target/release/" | |
path: "creditcoin3-node*" | |
filename: "../../creditcoin-${{ needs.sanity-check.outputs.TAG_NAME }}-${{ env.PLATFORM }}.zip" | |
exclusions: "creditcoin3-node.d" | |
- name: Compress MacOS aarch64 target | |
if: matrix.operating-system == 'macos-13' | |
continue-on-error: true | |
uses: thedoctor0/[email protected] | |
with: | |
type: "zip" | |
directory: "target/aarch64-apple-darwin/release/" | |
path: "creditcoin3-node*" | |
filename: "../../../creditcoin-${{ needs.sanity-check.outputs.TAG_NAME }}-aarch64-apple-darwin.zip" | |
exclusions: "creditcoin3-node.d" | |
- name: Upload binary | |
if: matrix.operating-system != 'windows-2022' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binary-for-${{ matrix.operating-system }} | |
path: "creditcoin-${{ needs.sanity-check.outputs.TAG_NAME }}-*.zip" | |
if-no-files-found: warn | |
build-wasm-runtime: | |
needs: | |
- sanity-check | |
- setup | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Configure rustc version | |
run: | | |
RUSTC_VERSION=$(grep channel rust-toolchain.toml | tail -n1 | tr -d " " | cut -f2 -d'"') | |
echo "RUSTC_VERSION=$RUSTC_VERSION" >> "$GITHUB_ENV" | |
- name: Build WASM runtime | |
id: srtool_build | |
uses: chevdor/[email protected] | |
env: | |
BUILD_OPTS: "--release ${{ needs.setup.outputs.build_options }}" | |
with: | |
chain: "creditcoin" | |
runtime_dir: runtime | |
package: creditcoin3-runtime | |
tag: ${{ env.RUSTC_VERSION }} | |
workdir: ${{ github.workspace }} | |
- name: DEBUG | |
run: | | |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > creditcoin-srtool-digest.json | |
cat creditcoin-srtool-digest.json | |
echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}" | |
- name: Rename file | |
run: | | |
mv ${{ steps.srtool_build.outputs.wasm }} creditcoin-${{ needs.sanity-check.outputs.TAG_NAME }}-runtime.wasm | |
- name: Upload binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binary-for-wasm | |
path: "*.wasm" | |
if-no-files-found: error | |
docker-build: | |
needs: | |
- sanity-check | |
- setup | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Figure out tag name | |
shell: bash | |
run: | | |
TAG_NAME=$(git describe --tag) | |
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" | |
- name: Build docker image | |
run: | | |
docker build -t gluwa/creditcoin3:${{needs.sanity-check.outputs.TAG_NAME }} --build-arg="BUILD_ARGS=${{ needs.setup.outputs.build_options }}" . | |
echo "${{ secrets.DOCKER_PUSH_PASSWORD }}" | docker login -u="${{ secrets.DOCKER_PUSH_USERNAME }}" --password-stdin | |
docker push gluwa/creditcoin3:${{ needs.sanity-check.outputs.TAG_NAME }} | |
# only -mainnet images are tagged as :latest | |
# shellcheck disable=SC2046,SC2143 | |
if [ $(echo "${{ needs.sanity-check.outputs.TAG_NAME }}" | grep "mainnet") ]; then | |
docker tag gluwa/creditcoin3:${{ needs.sanity-check.outputs.TAG_NAME }} gluwa/creditcoin3:latest | |
docker push gluwa/creditcoin3:latest | |
fi | |
docker logout | |
create-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-24.04 | |
needs: | |
- sanity-check | |
- build-native-runtime | |
- build-wasm-runtime | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifact | |
pattern: binary-for-* | |
merge-multiple: true | |
- name: DEBUG | |
shell: bash | |
run: | | |
ls -lR | |
- name: Make the release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: "artifact/creditcoin-*${{ needs.sanity-check.outputs.TAG_NAME }}*" | |
fail_on_unmatched_files: true | |
name: ${{ needs.sanity-check.outputs.TAG_NAME }} |