build: enhance prep workflow, update the guide #77
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: Unified CI/CD | |
on: | |
pull_request: | |
branches: [main] | |
push: | |
branches: [main] | |
env: | |
IROHA_GIT: https://github.com/0x009922/iroha.git | |
IROHA_REV: 5302-expose-signature-payload | |
jobs: | |
prep-crypto-wasm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
id: prep-cache | |
with: | |
path: | | |
prep/crypto-wasm | |
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*', 'etc/task-prep-crypto-wasm.ts') }} | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
if: steps.prep-cache.outputs.cache-hit != 'true' | |
with: | |
cache: 'false' | |
toolchain: 'nightly-2024-09-09,stable' | |
target: 'wasm32-unknown-unknown' | |
components: rust-src | |
- uses: jetli/[email protected] | |
if: steps.prep-cache.outputs.cache-hit != 'true' | |
with: | |
version: 'v0.13.1' | |
- uses: denoland/setup-deno@v2 | |
if: steps.prep-cache.outputs.cache-hit != 'true' | |
with: | |
deno-version: v2.x | |
- name: Build packages | |
if: steps.prep-cache.outputs.cache-hit != 'true' | |
run: deno task prep:crypto-wasm | |
prep-iroha: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
id: prep-cache | |
with: | |
path: | | |
prep/iroha | |
key: ${{ runner.os }}-${{ env.IROHA_GIT }}-${{ env.IROHA_REV }} | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
if: steps.prep-cache.outputs.cache-hit != 'true' | |
with: | |
toolchain: 'nightly-2024-09-09' | |
target: 'wasm32-unknown-unknown' | |
components: rust-src | |
cache: 'false' | |
- uses: denoland/setup-deno@v2 | |
if: steps.prep-cache.outputs.cache-hit != 'true' | |
with: | |
deno-version: v2.x | |
- name: Prepare Iroha artifacts | |
if: steps.prep-cache.outputs.cache-hit != 'true' | |
run: | | |
deno task prep:iroha --git $IROHA_GIT --git-rev $IROHA_REV | |
deno task prep:iroha:build | |
check-only: | |
if: github.event_name == 'pull_request' | |
needs: [prep-iroha, prep-crypto-wasm] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
key: ${{ runner.os }}-${{ env.IROHA_GIT }}-${{ env.IROHA_REV }} | |
path: | | |
prep/iroha | |
- uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*', 'etc/task-prep-crypto-wasm.ts') }} | |
path: | | |
prep/crypto-wasm | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.2.x | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Enable pnpm via Corepack | |
run: | | |
echo "Before: corepack version => $(corepack --version || echo 'not installed')" | |
npm install -g corepack@latest | |
echo "After : corepack version => $(corepack --version)" | |
corepack enable pnpm | |
- run: deno task ok | |
check-and-publish: | |
if: github.event_name == 'push' | |
needs: [prep-iroha, prep-crypto-wasm] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
key: ${{ runner.os }}-${{ env.IROHA_GIT }}-${{ env.IROHA_REV }} | |
path: | | |
prep/iroha | |
- uses: actions/cache/restore@v4 | |
with: | |
fail-on-cache-miss: true | |
key: ${{ runner.os }}-${{ hashFiles('crypto-wasm/*', 'etc/task-prep-crypto-wasm.ts') }} | |
path: | | |
prep/crypto-wasm | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v2.2.x | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
- name: Enable pnpm via Corepack | |
run: | | |
echo "Before: corepack version => $(corepack --version || echo 'not installed')" | |
npm install -g corepack@latest | |
echo "After : corepack version => $(corepack --version)" | |
corepack enable pnpm | |
- run: deno task publish |