clear api (#1012) #177
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: 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: findoranetwork | |
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_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 |