Merge pull request #16 from amandastecz/tests/development #26
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 | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Nodejs | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn | |
- name: Create db bank file | |
run: cp ormconfig.example.json ormconfig.json | |
- name: Build | |
run: yarn build | |
- name: Docker compose up | |
run: docker-compose up -d | |
- name: Wait for Services to Start | |
run: sleep 60 | |
- name: Run migrations | |
run: yarn typeorm migration:run | |
- name: Run seed | |
run: yarn seed:admin | |
- name: Run application | |
run: yarn dev & | |
- name: Wait for Services to Start | |
run: sleep 30 | |
- name: Run tests | |
run: yarn test | |
- name: Copy file via ssh key | |
uses: appleboy/scp-action@v0.1.4 | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
port: ${{ secrets.SSH_PORT }} | |
key: ${{ secrets.SSH_KEY }} | |
source: "., !node_modules, !docker-compose.yml, !ormconfig.json" | |
target: "~/rentapi" | |
- name: Update API | |
uses: appleboy/ssh-action@v1.0.0 | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
port: ${{ secrets.SSH_PORT }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
cd ~/rentapi | |
yarn | |
./node_modules/.bin/typeorm migration:run | |
pm2 restart rentx_api | |