Skip to content

Commit

Permalink
A0-4268: chain-bootstrapper CI (#1720)
Browse files Browse the repository at this point in the history
# Description

This PR contains changes required for feature nets to work from `main`
again. It also adds proper CI support for `chain-bootstrapper`.
Workflows that build `aleph-node` were merged into one to avoid code
duplication. The `key` subcommand was added to `chain-bootstrapper`—it
does not increase compilation time and is used by the FE engine to
bootstrap the chain. Also, there's better coupling between workflows as
they output GH Artifact names that other workflows consume.

## Type of change

Please delete options that are not relevant.

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)

## Testing

Update net tests are omitted since they needs to be fixed on `main`
anyway.

1. [FE create from
`main`](https://github.com/Cardinal-Cryptography/aleph-node/actions/runs/9090690639/job/24983952063)
- OK
2. [FE created from
Mainnet](https://github.com/Cardinal-Cryptography/aleph-node/actions/runs/9091207050/job/24985384641)
- OK
3. [On push to main workflow
test](https://github.com/Cardinal-Cryptography/aleph-node/actions/runs/9091734325)
- OK
4. [Nightly pipeline normal session e2e
tests](https://github.com/Cardinal-Cryptography/aleph-node/actions/runs/9092279244)
- OK
5. [Nightly pipeline e2e tests on
featurenet](https://github.com/Cardinal-Cryptography/aleph-node/actions/runs/9092281415)
- OK

## Actions before merge PR
Replace all `A0-4268` and `v6` to `v7`

## Companion PRs
Cardinal-Cryptography/featurenet-template#30
Cardinal-Cryptography/github-actions#49
  • Loading branch information
Marcin-Radecki authored May 20, 2024
1 parent 6bd8d35 commit fbdf102
Show file tree
Hide file tree
Showing 46 changed files with 556 additions and 360 deletions.
14 changes: 7 additions & 7 deletions .github/actions/run-e2e-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ inputs:
description: 'Whether to deploy the adder sample contract to the node.'
required: false
default: 'false'
image-path:
description: 'Custom path to docker image for aleph-node'
aleph-node-image-artifact-name:
description: 'Name of aleph-node image stored in GH Artifacts'
required: false
default: aleph-test-docker
node-image:
description: 'Custom name of aleph-node image'
default: aleph-node-image-test
aleph-node-image-tag:
description: 'Name of aleph-node docker image tag'
required: false
default: aleph-node:latest
compose-file:
Expand Down Expand Up @@ -61,7 +61,7 @@ runs:
- name: Download node docker image
uses: actions/download-artifact@v4
with:
name: ${{ inputs.image-path }}
name: ${{ inputs.aleph-node-image-artifact-name }}

- name: Load node docker image
shell: bash
Expand All @@ -79,7 +79,7 @@ runs:
- name: Run consensus party
shell: bash
run: |
NODE_IMAGE='${{ inputs.node-image }}' \
NODE_IMAGE='${{ inputs.aleph-node-image-tag }}' \
DOCKER_COMPOSE='${{ inputs.compose-file }}' \
./.github/scripts/run_consensus.sh -n '${{ inputs.node-count }}'
Expand Down
37 changes: 17 additions & 20 deletions .github/actions/store-node-and-runtime/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ name: Store node and runtime
description: This workflow stores test or release version of aleph-node and aleph-runtime in S3, in
a given bucket
inputs:
aleph-node-artifact-name:
required: true
description: 'Name of artifact aleph-node binary'
aleph-runtime-artifact-name:
required: true
description: 'Name of artifact aleph-runtime'
profile:
required: true
description: test or production
description: 'test or production'
aws-access-key-id:
required: true
description: 'AWS Access Key ID to be used when storing artifacts'
Expand All @@ -27,33 +33,24 @@ runs:
exit 1
fi
- name: Get local envs
id: get-local-envs
shell: bash
env:
CARGO_PROFILE_DIRECTORY: ${{ inputs.profile == 'test' && 'release' || 'production' }}
run: |
cargo_profile_local=${{ env.CARGO_PROFILE_DIRECTORY }}
echo "cargo_profile=$cargo_profile_local" >> $GITHUB_OUTPUT
- name: Checkout aleph-node source code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Call action get-ref-properties
id: get-ref-properties
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v1
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v7

- name: Download binary from GH artifacts
uses: actions/download-artifact@v4
with:
name: aleph-${{ inputs.profile }}-node
path: target/${{ steps.get-local-envs.outputs.cargo_profile }}
name: ${{ inputs.aleph-node-artifact-name }}
path: target

- name: Download runtime from GH artifacts
uses: actions/download-artifact@v4
with:
name: aleph-${{ inputs.profile }}-runtime
path: target/${{ steps.get-local-envs.outputs.cargo_profile }}/wbuild/aleph-runtime
name: ${{ inputs.aleph-runtime-artifact-name }}
path: target

- name: Configure AWS credentials for S3 AWS
uses: aws-actions/configure-aws-credentials@v4
Expand All @@ -68,10 +65,10 @@ runs:
aws-secret-access-key: ${{ inputs.aws-secret-access-key }}
aws-region: ${{ env.AWS_REGION }}

- name: Copy binary to S3 AWS bucket
uses: Cardinal-Cryptography/github-actions/copy-file-to-s3@v1
- name: Copy aleph-node binary to S3 AWS bucket
uses: Cardinal-Cryptography/github-actions/copy-file-to-s3@v7
with:
source-path: target/${{ steps.get-local-envs.outputs.cargo_profile }}
source-path: target
source-filename: aleph-node
s3-bucket-path:
# yamllint disable-line rule:line-length
Expand All @@ -83,7 +80,7 @@ runs:
- name: Copy runtime to S3 AWS bucket
uses: Cardinal-Cryptography/github-actions/copy-file-to-s3@v1
with:
source-path: target/${{ steps.get-local-envs.outputs.cargo_profile }}/wbuild/aleph-runtime
source-path: target
source-filename: aleph_runtime.compact.compressed.wasm
s3-bucket-path:
# yamllint disable-line rule:line-length
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_build-aleph-e2e-client-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:

- name: Call action get-ref-properties
id: get-ref-properties
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v6
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v7

- name: Install Rust toolchain
uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v6
uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v7
with:
targets: wasm32-unknown-unknown

Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/_build-aleph-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
# This workflow builds aleph-node binary. It outputs name of artifacts uploaded to GH Artifacts.
name: Build aleph-node
on:
workflow_call:
inputs:
ref:
description: 'git ref: hash, branch, tag to build aleph-node binary from'
type: string
required: true
production:
description: 'Set to true to build production binary, otherwise set to false'
type: boolean
required: true
outputs:
artifact-name-binary:
description: 'Name of artifact aleph-node binary'
value: ${{ jobs.main.outputs.artifact-name-binary }}
artifact-name-image:
description: 'Name of artifact aleph-node image'
value: ${{ jobs.main.outputs.artifact-name-image }}
jobs:
main:
name: Build aleph-node (production=${{ inputs.production }})
runs-on: [self-hosted, Linux, X64, large]
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
CARGO_FOLDER: ${{ inputs.production == true && 'production' || 'release' }}
ARTIFACT_NAME_SUFFIX: ${{ inputs.production == true && 'production' || 'test' }}
outputs:
artifact-name-binary: ${{ steps.get-artifact-name-binary.outputs.name }}
artifact-name-image: ${{ steps.get-artifact-name-image.outputs.name }}
steps:
- name: Checkout aleph-node source code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
fetch-depth: 0

- name: Call action get-ref-properties
id: get-ref-properties
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v7

- name: Install Rust toolchain
uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v7

- name: Build test aleph-node
if: ${{ inputs.production != true }}
run: |
cargo build --release -p aleph-node --features only_legacy
- name: Build production aleph-node
if: ${{ inputs.production == true }}
run: cargo build --profile production -p aleph-node

- name: Get binary artifact name
id: get-artifact-name-binary
run: |
echo "name=aleph-node-${{ env.ARTIFACT_NAME_SUFFIX }}" >> $GITHUB_OUTPUT
- name: Upload binary to GH Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.get-artifact-name-binary.outputs.name }}
path: target/${{ env.CARGO_FOLDER }}/aleph-node
if-no-files-found: error
retention-days: 7

- name: Build aleph-node docker image
run: |
chmod +x target/${{ env.CARGO_FOLDER }}/aleph-node
if [[ ${{ inputs.production }} == true ]]; then
mkdir -p target/release
mv target/production/aleph-node target/release/
fi
docker build --tag aleph-node:latest -f ./docker/Dockerfile .
docker save -o aleph-node.tar aleph-node:latest
- name: Get image artifact name
id: get-artifact-name-image
run: |
echo "name=aleph-node-image-${{ env.ARTIFACT_NAME_SUFFIX }}" >> $GITHUB_OUTPUT
- name: Upload docker to GH Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.get-artifact-name-image.outputs.name }}
path: aleph-node.tar
if-no-files-found: error
retention-days: 7
6 changes: 3 additions & 3 deletions .github/workflows/_build-and-push-cliain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v6
uses: Cardinal-Cryptography/github-actions/install-rust-toolchain@v7

- name: ${{ env.CARGO_COMMAND }} cliain binary
run: |
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:

- name: Call action get-ref-properties
id: get-ref-properties
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v6
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v7

- name: Download cliain from GH artifact
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:

- name: Copy binary to S3 AWS bucket
if: ${{ inputs.check-only != true }}
uses: Cardinal-Cryptography/github-actions/copy-file-to-s3@v6
uses: Cardinal-Cryptography/github-actions/copy-file-to-s3@v7
with:
source-path: bin/cliain/target/release
source-filename: cliain
Expand Down
76 changes: 0 additions & 76 deletions .github/workflows/_build-and-push-featurenet-node-image.yml

This file was deleted.

Loading

0 comments on commit fbdf102

Please sign in to comment.