config: adiciona etapa de testes de validação do websocket #6
This file contains hidden or 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 e testes | |
| on: | |
| push: | |
| branches: ['main'] | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout do código | |
| uses: actions/checkout@v4 | |
| - name: configurar Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22.21.1' | |
| - name: testes de validação do websocket | |
| working-directory: ./websocket | |
| run: npm test | |
| deploy: | |
| needs: build-and-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Executar comandos na VPS via SSH | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.REMOTE_HOST }} | |
| username: ${{ secrets.REMOTE_USER }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| script: | | |
| cd ~/chat_tempo_real_distribuido | |
| git pull origin main | |
| echo "ainda testando ci/cd, terceira vez funcionou" >> teste-ci_cd.txt | |
| ## docker compose up -d --build |