Skip to content

Refactoring boards #520

Refactoring boards

Refactoring boards #520

name: Run tests for new-ara-api
on:
workflow_dispatch:
push:
branches:
- master
- develop
pull_request:
release:
types: [created]
env:
ECR: 666583083672.dkr.ecr.ap-northeast-2.amazonaws.com
PROJECT_NAME: newara
SECRET_KEY: ${{ secrets.SECRET_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SSO_CLIENT_ID: ${{ secrets.SSO_CLIENT_ID }}
SSO_SECRET_KEY: ${{ secrets.SSO_SECRET_KEY }}
PORTAL_2FA_KEY: ${{ secrets.PORTAL_2FA_KEY }}
FIREBASE_SERVICE_ACCOUNT_KEY_DEV: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY_DEV }}
FIREBASE_SERVICE_ACCOUNT_KEY_PROD: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY_PROD }}
AWS_REGION: ap-northeast-2
jobs:
deploy:
name: Run Tests
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{env.AWS_REGION}}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Install
run: |
chmod +x .github/workflows/generate-docker-tag.sh
touch firebaseServiceAccountKey.json
. .github/workflows/generate-docker-tag.sh
echo "PUSH=$PUSH" >> $GITHUB_ENV
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
echo "DJANGO_ENV=$DJANGO_ENV" >> $GITHUB_ENV
docker pull $ECR/$PROJECT_NAME:$DJANGO_ENV || true
- name: Build
run: |
docker build --build-arg AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --build-arg AWS_SECRET_ACCESS_KEY=$(echo $AWS_SECRET_ACCESS_KEY) --cache-from $ECR/$PROJECT_NAME:$DJANGO_ENV -t $PROJECT_NAME .
- name: Run test
run: |
docker-compose -f docker-compose.test.yml run api test
docker-compose -f docker-compose.test.yml down
- if: env.PUSH == 'true'
name: Push docker image
run: |
echo "Start docker image push"
docker tag $PROJECT_NAME $ECR/$PROJECT_NAME:$DOCKER_TAG && docker push $ECR/$PROJECT_NAME:$DOCKER_TAG
echo "Finish docker image push"