Qa01 develop #1458
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: Main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
strategy: | |
matrix: | |
platform: [scalable] | |
runs-on: ${{ matrix.platform }} | |
env: | |
ENV: dev | |
PRIVATE_ECR_URL: 358484141435.dkr.ecr.us-west-2.amazonaws.com | |
PUBLIC_ECR_URL: public.ecr.aws/k6m5b6e2 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
components: rustfmt | |
- 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: Prepare key | |
shell: bash | |
run: | | |
tar -C ~/.ssh -zcf key.tar.gz ./ | |
- 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: | | |
COMMIT_HASH=$(echo ${GITHUB_CONTEXT} | jq '.event.pull_request.head.sha') | |
if [ "${COMMIT_HASH}" == "null" ]; then | |
export COMMIT_HASH="${GITHUB_SHA}" | |
else | |
export COMMIT_HASH=${COMMIT_HASH} | |
fi | |
export BRANCH="${GITHUB_HEAD_REF}" | |
export TOBRANCH="main" | |
export IMAGE_TAG="${TOBRANCH}-${COMMIT_HASH}" | |
export VERGEN_SHA_EXTERN="${IMAGE_TAG}" | |
echo "Image tag: ${IMAGE_TAG}" | |
make ci_build_release_binary_image | |
- name: Build findorad images | |
env: | |
PRIVATE_ECR_URL: ${{ env.PRIVATE_ECR_URL }} | |
PUBLIC_ECR_URL: ${{ env.PUBLIC_ECR_URL }} | |
ENV: ${{ env.ENV }} | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
shell: bash | |
run: | | |
COMMIT_HASH=$(echo ${GITHUB_CONTEXT} | jq '.event.pull_request.head.sha') | |
if [ "${COMMIT_HASH}" == "null" ]; then | |
export COMMIT_HASH="${GITHUB_SHA}" | |
else | |
export COMMIT_HASH=${COMMIT_HASH} | |
fi | |
export BRANCH="${GITHUB_HEAD_REF}" | |
export TOBRANCH="main" | |
export IMAGE_TAG="${TOBRANCH}-${COMMIT_HASH}" | |
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: ${{ env.ENV }} | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
shell: bash | |
run: | | |
COMMIT_HASH=$(echo ${GITHUB_CONTEXT} | jq '.event.pull_request.head.sha') | |
if [ "${COMMIT_HASH}" == "null" ]; then | |
export COMMIT_HASH="${GITHUB_SHA}" | |
else | |
export COMMIT_HASH=${COMMIT_HASH} | |
fi | |
export BRANCH="${GITHUB_HEAD_REF}" | |
export TOBRANCH="main" | |
export IMAGE_TAG="${TOBRANCH}-${COMMIT_HASH}" | |
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: ${{ env.ENV }} | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
shell: bash | |
run: | | |
COMMIT_HASH=$(echo ${GITHUB_CONTEXT} | jq '.event.pull_request.head.sha') | |
if [ "${COMMIT_HASH}" == "null" ]; then | |
export COMMIT_HASH="${GITHUB_SHA}" | |
else | |
export COMMIT_HASH=${COMMIT_HASH} | |
fi | |
export BRANCH="${GITHUB_HEAD_REF}" | |
export TOBRANCH="main" | |
export IMAGE_TAG="${TOBRANCH}-${COMMIT_HASH}" | |
echo "Image tag: ${IMAGE_TAG}" | |
make clean_image | |
- name: Clean binary images | |
env: | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
shell: bash | |
run: | | |
COMMIT_HASH=$(echo ${GITHUB_CONTEXT} | jq '.event.pull_request.head.sha') | |
if [ "${COMMIT_HASH}" == "null" ]; then | |
export COMMIT_HASH="${GITHUB_SHA}" | |
else | |
export COMMIT_HASH=${COMMIT_HASH} | |
fi | |
export BRANCH="${GITHUB_HEAD_REF}" | |
export TOBRANCH="main" | |
export IMAGE_TAG="${TOBRANCH}-${COMMIT_HASH}" | |
echo "Image tag: ${IMAGE_TAG}" | |
make clean_binary_dockerhub | |
- name: Clean garbage | |
shell: bash | |
run: | | |
rm -rf /tmp/*>/dev/null 2>&1 || true |