fix: apply static analysis feedback #154
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
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| COMPOSE_RUNNER: "docker compose" | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| steps: | |
| - name: Cache Docker images. | |
| uses: ScribeMD/docker-cache@0.5.0 | |
| with: | |
| key: docker-${{ runner.os }}-${{ hashFiles('compose.yaml') }} | |
| - name: Checkout current code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git permissions | |
| run: git config --global --add safe.directory /__w/serendipity/serendipity | |
| - name: Put everything up | |
| run: docker compose --profile postgres up -d | |
| - name: Setup the application environment | |
| run: docker compose exec app composer install | |
| - name: Wait until 1 minute for postgres be ready to GO | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_seconds: 60 | |
| retry_wait_seconds: 5 | |
| max_attempts: 12 | |
| warning_on_retry: false | |
| command: docker compose exec postgres pg_isready | |
| - name: Configure database environment | |
| run: docker compose exec app php bin/hyperf.php migrate --database=postgres | |
| - name: Run tests and generate coverage | |
| run: docker compose exec app composer test | |
| - name: Run SonarCloud analysis | |
| run: docker compose exec app sonar-scanner -Dsonar.host.url=https://sonarcloud.io -X |