-
Notifications
You must be signed in to change notification settings - Fork 50
97 lines (88 loc) · 3.52 KB
/
_build-chain-bootstrapper.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
# This workflow builds chain-bootstrapper binary, dedicated fer generating chainspecs for
# test and dev chains
name: Build chain-bootstrapper
on:
workflow_call:
inputs:
ref:
description: 'git ref: hash, branch, tag to build chain-bootstrapper binary from'
type: string
required: true
production:
description: 'set to true to use production profile'
type: boolean
required: true
outputs:
artifact-name-binary:
description: 'Name of artifact chain-bootstrapper binary'
value: ${{ jobs.main.outputs.artifact-name-binary }}
artifact-name-image:
description: 'Name of artifact chain-bootstrapper image'
value: ${{ jobs.main.outputs.artifact-name-image }}
jobs:
main:
name: Build chain-bootstrapper (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 && 'release' || '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
with:
targets: wasm32-unknown-unknown
- name: Build without production profile
if: ${{ inputs.production != true }}
run: |
cargo build --release -p chain-bootstrapper \
--features "short_session enable_treasury_proposals"
- name: Build with production profile
if: ${{ inputs.production == true }}
run: |
cargo build --profile production -p chain-bootstrapper
- name: Get binary artifact name
id: get-artifact-name-binary
run: |
echo "name=chain-bootstrapper-${{ 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 }}/chain-bootstrapper
if-no-files-found: error
retention-days: 7
- name: Build docker
id: build-image
run: |
chmod +x target/${{ env.CARGO_FOLDER }}/chain-bootstrapper
if [[ ${{ inputs.production }} == true ]]; then
mkdir -p target/release
mv target/production/chain-bootstrapper target/release/
fi
docker build --tag chain-bootstrapper:latest -f ./bin/chain-bootstrapper/Dockerfile .
docker save -o chain-bootstrapper.tar chain-bootstrapper:latest
- name: Get image artifact name
id: get-artifact-name-image
run: |
echo "name=chain-bootstrapper-image-${{ env.ARTIFACT_NAME_SUFFIX }}" >> $GITHUB_OUTPUT
- name: Upload docker image to GH Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ steps.get-artifact-name-image.outputs.name }}
path: chain-bootstrapper.tar
if-no-files-found: error
retention-days: 7