Skip to content

Bump humanode-runtime to 112 spec_version (#812) #235

Bump humanode-runtime to 112 spec_version (#812)

Bump humanode-runtime to 112 spec_version (#812) #235

Workflow file for this run

name: build
on:
push:
tags:
- "v*.*.*"
schedule:
- cron: "0 20 * * 0"
workflow_dispatch:
defaults:
run:
shell: bash
env:
CARGO_INCREMENTAL: "0"
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' && github.event_name != 'merge_group' }}
jobs:
draft-release:
name: Create a release draft
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
outputs:
release-id: ${{ steps.create-release.outputs.id }}
upload-url: ${{ steps.create-release.outputs.upload_url }}
html-url: ${{ steps.create-release.outputs.html_url }}
timeout-minutes: 50
permissions:
contents: write
steps:
- name: Create release
id: create-release
uses: ncipollo/release-action@v1
with:
allowUpdates: false
draft: true
generateReleaseNotes: true
plan:
name: Plan the execution
runs-on: ubuntu-22.04
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compute matrix
uses: ./.github/actions/plan
id: set-matrix
with:
plan-name: build
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(steps.set-matrix.outputs.matrix) }}
run: echo "$MATRIX_CONTEXT"
build:
needs:
- plan
- draft-release
if: ${{ always() && needs.plan.result == 'success' && (!startsWith(github.ref, 'refs/tags/') || needs.draft-release.result == 'success') }}
strategy:
matrix: ${{ fromJson(needs.plan.outputs.matrix) }}
fail-fast: false
name: ${{ matrix.plan.platform.name }} / ${{ matrix.plan.mode.name }}
runs-on: ${{ matrix.plan.platform.os }}
env: ${{ matrix.plan.platform.env }}
timeout-minutes: 120
permissions:
contents: write
steps:
- name: Job config
run: printf "%s\n" "$MATRIX_CONTEXT"
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
- name: Checkout
uses: actions/checkout@v4
timeout-minutes: 5
- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.plan.platform.cacheKey }}-${{ matrix.plan.mode.cargoCacheKey }}
if: "!matrix.plan.platform.isOnSelfHostedRunner"
timeout-minutes: 15
- name: Install rust toolchain
run: rustup show
timeout-minutes: 10
- name: Prepare the build environment
uses: ./.github/actions/env
with:
script: ${{ matrix.plan.platform.buildEnvScript }}
- name: Print build environment info
run: |
set -x
cargo --version
cargo clippy --version
env
- name: Run cargo ${{ matrix.plan.mode.cargoCommand }}
uses: actions-rs/cargo@v1
with:
command: ${{ matrix.plan.mode.cargoCommand }}
args: ${{ matrix.plan.mode.cargoArgs }}
- name: Set the upload params
id: set-upload-params
env:
PLATFORM_ARTIFACT_MARKER: ${{ matrix.plan.platform.artifactMarker }}
run: |
EXECUTABLE_PATH="target/release/humanode-peer"
ARTIFACT_NAME="humanode-peer-$(rustc -vV | sed -n 's|host: ||p')"
if [[ "$PLATFORM_ARTIFACT_MARKER" != "" ]]; then
ARTIFACT_NAME="${ARTIFACT_NAME}-${PLATFORM_ARTIFACT_MARKER}"
fi
if [[ "${PATHEXT:-""}" != "" ]]; then
EXECUTABLE_PATH="${EXECUTABLE_PATH}.exe"
fi
printf 'executable-path=%s\n' "$EXECUTABLE_PATH" >> "$GITHUB_OUTPUT"
printf 'artifact-name=%s\n' "$ARTIFACT_NAME" >> "$GITHUB_OUTPUT"
printf 'Packaged `%s` into `%s`.\n' \
"$EXECUTABLE_PATH" \
"$ARTIFACT_NAME" \
>> "$GITHUB_STEP_SUMMARY"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.set-upload-params.outputs.artifact-name }}
path: ${{ steps.set-upload-params.outputs.executable-path }}
if-no-files-found: error
retention-days: 5
- name: Archive the binary for release
if: startsWith(github.ref, 'refs/tags/')
env:
EXECUTABLE_NAME: ${{ steps.set-upload-params.outputs.executable-path }}
run: utils/make-release-archive "$EXECUTABLE_NAME" archive.tar.gz
- name: Upload release archive
uses: shogo82148/actions-upload-release-asset@v1
if: startsWith(github.ref, 'refs/tags/')
with:
upload_url: ${{ needs.draft-release.outputs.upload-url }}
asset_name: ${{ steps.set-upload-params.outputs.artifact-name }}.tar.gz
asset_path: archive.tar.gz
publish-release:
needs:
- draft-release
- build
name: Publish release
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
timeout-minutes: 50
permissions:
contents: write
steps:
- name: Publish release
uses: actions/github-script@v6
env:
RELEASE_ID: ${{ needs.draft-release.outputs.release-id }}
with:
script: |
github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: process.env.RELEASE_ID,
draft: false
});