Merge improvements #78
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: Test | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: [main] | |
types: [opened, synchronize] | |
env: | |
SECRET: ${{ secrets.SECRET }} | |
jobs: | |
run_all_tests: | |
timeout-minutes: 10 | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: frontend lint | |
run: cd frontend && npm install && npm run lint | |
- name: backend lint | |
run: cd backend && npm install && npm run lint | |
- name: launch test database | |
run: cd backend && docker-compose -f "docker-compose.yml" up -d | |
- name: backend unit tests | |
run: cd backend && npm test | |
- name: start backend in test mode | |
run: cd backend && npm run start:test & | |
- name: npm install cypress | |
run: cd frontend && npm install cypress --save-dev | |
- name: e2e test | |
uses: cypress-io/[email protected] | |
with: | |
working-directory: ./frontend | |
command: npm run test:e2e | |
start: npm start | |
wait-on: http://localhost:3000 | |
deploy_to_server: | |
if: ${{!contains(join(toJson(github.event.commits.*.message)), '#skip') }} && github.event_name == 'push' && github.ref == 'refs/heads/main' | |
timeout-minutes: 45 | |
runs-on: ubuntu-20.04 | |
needs: run_all_tests | |
steps: | |
- name: executing remote ssh commands using password | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
script_stop: true | |
script: | | |
cd ~/taivuttaja_deploy/taivuttaja | |
git pull | |
docker compose -f docker-compose.yml down --volumes | |
docker compose -f docker-compose.yml up -d | |