-
Notifications
You must be signed in to change notification settings - Fork 70
129 lines (118 loc) · 3.48 KB
/
build.yaml
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: "Build protocol"
defaults:
run:
shell: "sh"
on:
workflow_dispatch:
inputs:
network-group:
description: "Network's group"
type: "choice"
options:
- "dev"
- "main"
- "test"
required: true
network:
description: "Network's name"
type: "string"
required: true
protocol:
description: "Protocol"
type: "string"
required: true
release:
description: "Smart contracts release"
type: "string"
required: true
env:
profile: |-
${{ ((inputs.network-group == 'dev' || inputs.network-group == 'test') && 'test-net') || (inputs.network-group == 'main' && 'production-net') || 'N/A' }}
run-name: |-
${{ inputs.network-group }} / ${{ inputs.network }} / ${{ inputs.protocol }} / ${{ inputs.release }}
jobs:
report-arguments:
name: "Report workflow arguments"
runs-on: "ubuntu-latest"
env:
network_group: |-
${{ inputs.network-group }}
network: |-
${{ inputs.network }}
protocol: |-
${{ inputs.protocol }}
release: |-
${{ inputs.release }}
steps:
- run: |-
set -eu
"echo" \
"\
Argument | Value
------------------|------
Network Group | ${network_group:?}
Network Name | ${network:?}
Protocol Name | ${protocol:?}
Contracts Release | ${release:?}
Build Profile | ${profile:?}" \
>>"${GITHUB_STEP_SUMMARY:?}"
build-protocol:
name: "Build protocol"
needs:
- "report-arguments"
runs-on: "ubuntu-latest"
env:
topology_json: |-
${{ inputs.network-group }}net/${{ inputs.network }}/topology.json
protocol_json: |-
${{ inputs.network-group }}net/${{ inputs.network }}/protocols/${{ inputs.protocol }}.json
steps:
- uses: "actions/checkout@v4"
with:
sparse-checkout: |-
${{ env.topology_json }}
${{ env.protocol_json }}
- run: |-
set -eu
"mkdir" "./build-configuration/"
"cp" \
"${topology_json:?}" \
"./build-configuration/topology.json"
"cp" \
"${protocol_json:?}" \
"./build-configuration/protocol.json"
- env:
url: |-
https://github.com/${{ github.repository_owner }}/nolus-money-market/releases/download/${{ inputs.release }}/protocol-builder.tar.gz
run: |-
set -eu
"wget" \
--output-document="protocol-builder.tar.gz" \
"${url:?}"
- run: |-
"gunzip" "protocol-builder.tar.gz"
- run: |-
"docker" \
"image" \
"load" \
--input "protocol-builder.tar"
- run: |-
"mkdir" "./artifacts/"
- run: |-
set -eu
"docker" \
"container" \
"run" \
--env "CHECK_DEPENDENCIES_UPDATED=false" \
--tty \
--volume "./artifacts/:/artifacts/:rw" \
--volume "./build-configuration/:/build-configuration/:ro" \
"protocol-builder" \
"${profile:?}"
- uses: "actions/upload-artifact@v4"
with:
if-no-files-found: "error"
name: |-
${{ inputs.network-group }}--${{ inputs.network }}--${{ inputs.protocol }}--${{ inputs.release }}
path: |-
./artifacts/*