feat(logs): Concluído implementação do sistema de logs. #20
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 Pipeline | |
| on: [push, pull_request] | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| JWT_SECRET_KEY: ${{ secrets.JWT_SECRET_KEY }} | |
| JWT_EXPIRATION_TIME: ${{ secrets.JWT_EXPIRATION_TIME }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Instalação Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Instalação Poetry | |
| run: pipx install poetry | |
| - name: Instalação das dependências | |
| run: poetry install | |
| - name: Testes | |
| run: poetry run pytest -s -v | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: tests | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Preparar pasta de deploy | |
| run: | | |
| mkdir deploy | |
| cp backend/poetry.lock deploy/ | |
| cp backend/pyproject.toml deploy/ | |
| cp -r backend/src deploy/ | |
| ls -la deploy/ | |
| - name: Instalar CLI Squarecloud | |
| run: | | |
| wget https://github.com/squarecloudofc/cli/releases/download/v2.4.13/squarecloud_linux_amd64.tar.gz -O /tmp/squarecloud.tar.gz | |
| tar -xzf /tmp/squarecloud.tar.gz -C /tmp/ | |
| chmod +x /tmp/squarecloud | |
| sudo mv /tmp/squarecloud /usr/local/bin/squarecloud | |
| - name: Fazer login na CLI | |
| run: squarecloud auth login --token="${{ secrets.SQUARE_TOKEN }}" | |
| - name: Deploy | |
| run: | | |
| cd deploy | |
| squarecloud commit ${{ secrets.SQUARE_APPLICATION_ID }} | |
| - name: Restart | |
| run: squarecloud app restart ${{ secrets.SQUARE_APPLICATION_ID }} |