-
Notifications
You must be signed in to change notification settings - Fork 30
227 lines (218 loc) · 6.89 KB
/
Release.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
name: Release
on:
push:
tags:
- '*-release'
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
platform: [scalable]
runs-on: ${{ matrix.platform }}
env:
ENV: release
PRIVATE_ECR_URL: 358484141435.dkr.ecr.us-west-2.amazonaws.com
PUBLIC_ECR_URL: public.ecr.aws/k6m5b6e2
DOCKERHUB_URL: fractalfoundation
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: rustfmt
# - name: check fmt
# shell: bash
# run: |
# cargo fmt -- --check
# - name: test_status
# env:
# DBG: true
# shell: bash
# run: |
# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# make test_status
## It need to install protobuf-compiler for build environment.
## Enable this when build by container.
# - name: Install protobuf-compiler
# shell: bash
# run: |
# apt install protobuf-compiler
# - name: install rustwasm
# shell: bash
# run: |
# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# - name: add go
# shell: bash
# run: |
# mkdir $(pwd)/opt && cd $(pwd)/opt && wget https://golang.google.cn/dl/go1.15.7.linux-amd64.tar.gz && tar -xpf go1.15.7.linux-amd64.tar.gz && echo "$(pwd)/go/bin" >> $GITHUB_PATH
# # run tests
# - name: lint
# shell: bash
# run: |
# make lint
# - name: test
# shell: bash
# run: |
# make test
# - name: evm test
# shell: bash
# run: |
# make evmtest
- name: Prepare key
shell: bash
run: |
tar -C ~/.ssh -zcf key.tar.gz ./
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Clean garbage containers and images
shell: bash
run: |
docker rm $(docker ps -a | grep -v "^CONTAINER" | awk '{print $1}') || true
docker rmi -f $(docker images -f "dangling=true" -q) || true
- name: Build rust base image
shell: bash
run: |
make ci_build_binary_rust_base
- name: Build binary image
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
export VERGEN_SHA_EXTERN="${IMAGE_TAG}"
echo "Image tag: ${IMAGE_TAG}"
make ci_build_release_binary_image
# ========= build the cleveldb and push to public ECR ===
# - name: build cleveldb-version release
# shell: bash
# run: |
# echo "REF: ${GITHUB_REF}"
# TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
# TAGV="${TAGS#refs/tags/}"
# export IMAGE_TAG="${TAGV:-main}"
# export VERGEN_SHA_EXTERN="${IMAGE_TAG}"
# echo "VERGEN_SHA_EXTERN: ${VERGEN_SHA_EXTERN}"
# make build_release
- name: Build images
env:
PRIVATE_ECR_URL: ${{ env.PRIVATE_ECR_URL }}
PUBLIC_ECR_URL: ${{ env.PUBLIC_ECR_URL }}
ENV: release
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
echo "Image tag: ${IMAGE_TAG}"
make ci_build_image
- name: Push images
env:
PRIVATE_ECR_URL: ${{ env.PRIVATE_ECR_URL }}
PUBLIC_ECR_URL: ${{ env.PUBLIC_ECR_URL }}
ENV: release
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
echo "Image tag: ${IMAGE_TAG}"
make ci_push_image
- name: Clean images
env:
PRIVATE_ECR_URL: ${{ env.PRIVATE_ECR_URL }}
PUBLIC_ECR_URL: ${{ env.PUBLIC_ECR_URL }}
ENV: release
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
echo "Image tag: ${IMAGE_TAG}"
make clean_image
# ========= END build the cleveldb and push to public ECR ===
# ========= build the goleveldb and push to dockerhub ===
# - name: build goleveldb-version release
# shell: bash
# run: |
# echo "REF: ${GITHUB_REF}"
# TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
# TAGV="${TAGS#refs/tags/}"
# export IMAGE_TAG="${TAGV:-main}"
# export VERGEN_SHA_EXTERN="${IMAGE_TAG}"
# echo "VERGEN_SHA_EXTERN: ${VERGEN_SHA_EXTERN}"
# make build_release_goleveldb
- name: Login Dockerhub
env:
DOCKERHUB_URL: ${{env.DOCKERHUB_URL}}
DOCKERHUB_TOKEN: ${{secrets.DOCKERHUB_FRACTAL_TOKEN}}
shell: bash
run: |
docker login -u ${DOCKERHUB_URL} -p ${DOCKERHUB_TOKEN}
- name: Build images dockerhub
env:
DOCKERHUB_URL: ${{env.DOCKERHUB_URL}}
ENV: ${{ env.ENV }}
GITHUB_CONTEXT: ${{ toJSON(github) }}
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
echo "Image tag: ${IMAGE_TAG}"
make ci_build_image_dockerhub
- name: Push images to dockerhub
env:
DOCKERHUB_URL: ${{env.DOCKERHUB_URL}}
ENV: release
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
echo "Image tag: ${IMAGE_TAG}"
make ci_push_image_dockerhub
- name: Clean images
env:
DOCKERHUB_URL: ${{env.DOCKERHUB_URL}}
ENV: release
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
echo "Image tag: ${IMAGE_TAG}"
make clean_image_dockerhub
# # =========END build the goleveldb and push to dockerhub ===
- name: Clean binary images
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
shell: bash
run: |
echo "REF: ${GITHUB_REF}"
TAGS=$(grep "refs/tags" <<< ${GITHUB_REF}) || true
TAGV="${TAGS#refs/tags/}"
export IMAGE_TAG="${TAGV:-main}"
echo "Image tag: ${IMAGE_TAG}"
make clean_binary_dockerhub
- name: Clean garbage
shell: bash
run: |
rm -rf /tmp/*>/dev/null 2>&1 || true