Layer Dockerfile to allow test build with extra dependencies #47
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: CI / CD | |
on: | |
push: | |
paths: | |
- 'api/**' | |
- '.github/workflows/cicd.yml' | |
workflow_dispatch: | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and run tests | |
run: docker-compose up --build test | |
- name: Clean up | |
run: docker-compose down | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
if: github.ref == 'refs/heads/develop' | |
steps: | |
- name: Deploy to EC2 | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
cd amazonia360/amazonia-360 | |
git pull | |
docker-compose down | |
docker-compose up -d api --build | |
health-check: | |
runs-on: ubuntu-latest | |
needs: deploy | |
if: github.ref == 'refs/heads/develop' | |
steps: | |
- name: URL Health Check | |
uses: Jtalk/url-health-check-action@v4 | |
with: | |
url: ${{ secrets.HEALTHCHECK }} | |
retries: 5 | |
wait: 10 | |