Merge pull request #103 from jolicode/ci/dependabot-security-groups #216
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: Continuous Integration | |
| "on": | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| schedule: | |
| - cron: "0 0 * * MON" | |
| permissions: | |
| contents: read | |
| packages: read | |
| env: | |
| # Fix for symfony/color detection. We know GitHub Actions can handle it | |
| ANSICON: 1 | |
| CASTOR_CONTEXT: ci | |
| DS_REGISTRY: "ghcr.io/jolicode/qotd" | |
| jobs: | |
| ci: | |
| name: Continuous Integration | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to registry | |
| shell: bash | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin | |
| - uses: actions/checkout@v7 | |
| - name: setup-castor | |
| uses: castor-php/setup-castor@v1.1.0 | |
| - name: "Build and start the infrastructure" | |
| run: "castor start" | |
| - name: "Check PHP coding standards" | |
| run: "castor qa:cs --dry-run" | |
| - name: "Run PHPStan" | |
| run: "castor qa:phpstan" | |
| - name: "Load fixtures" | |
| run: "castor fixtures --env=test" | |
| - name: "Run PHPUnit" | |
| run: "castor qa:phpunit" | |
| - name: "Test HTTP server" | |
| run: | | |
| set -e | |
| set -o pipefail | |
| # Not authenticated, we expect a redirection to the Google connect route | |
| status="$(curl --insecure --silent --output /dev/null --write-out "%{http_code}" -H "Host: local.qotd.internal.jolicode.com" https://127.0.0.1)" | |
| echo "HTTP status: ${status}" | |
| grep "302" <<<"${status}" | |
| location="$(curl --insecure --silent --output /dev/null --write-out "%{redirect_url}" -H "Host: local.qotd.internal.jolicode.com" https://127.0.0.1)" | |
| echo "Redirect location: ${location}" | |
| grep "/connect/google" <<<"${location}" |