fix: sicap page error #242
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
on: | |
push: | |
branches: | |
- 'master' | |
workflow_dispatch: | |
inputs: | |
runTests: | |
description: 'Run all tests before deploying' | |
required: true | |
default: 'true' | |
name: Deploy to STAGING | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [14.x] | |
services: | |
plataforma-sabia-redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
plataforma-sabia-mysql: | |
image: mysql | |
env: | |
MYSQL_ROOT_PASSWORD: '' | |
MYSQL_ALLOW_EMPTY_PASSWORD: true | |
MYSQL_DATABASE: sabia_testing | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Setup API | |
run: | | |
cd packages/api | |
cp .env.testing .env | |
npm install | |
- name: Run API tests | |
if: ${{ github.event.inputs.runTests == '' || github.event.inputs.runTests == 'true' }} | |
run: | | |
cd packages/api | |
npm run test | |
npm run migration:refresh -- --seed | |
- name: Setup WEB | |
run: | | |
cd packages/web | |
npm install | |
- name: Run WEB tests | |
if: ${{ github.event.inputs.runTests == '' || github.event.inputs.runTests == 'true' }} | |
run: | | |
cd packages/web | |
npm run jest:ci | |
- name: Run Cypress | |
if: ${{ github.event.inputs.runTests == '' || github.event.inputs.runTests == 'true' }} | |
uses: cypress-io/github-action@v1 | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
with: | |
command: npm run test:e2e:run | |
record: true | |
- | |
name: Setup QEMU | |
uses: docker/setup-qemu-action@v1 | |
- | |
name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- | |
name: Build and push ADMIN docker image | |
id: docker_build_admin | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
file: ./packages/admin/docker/Dockerfile | |
tags: plataformasabia/admin:${{ github.sha }} | |
- | |
name: Build and push WEB docker image | |
id: docker_build_web | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
file: ./packages/web/docker/Dockerfile | |
tags: plataformasabia/web:${{ github.sha }} | |
- | |
name: Build and push API docker image | |
id: docker_build_api | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
file: ./packages/api/docker/Dockerfile | |
tags: plataformasabia/api:${{ github.sha }} | |
- | |
name: Deploy to STAGING | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DEPLOY_HOST_VPS_2 }} | |
username: ${{ secrets.DEPLOY_USER_VPS_2 }} | |
key: ${{ secrets.DEPLOY_KEY_VPS_2 }} | |
port: ${{ secrets.DEPLOY_PORT_VPS_2 }} | |
script: ./deploy-image-to-vps.sh ${{ github.sha }} |