chore: update dependencies and upgrade to Debian trixie (#410) #1104
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/docker-starter" | |
| jobs: | |
| check-dockerfiles: | |
| name: Check Dockerfile | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Check php/Dockerfile | |
| uses: hadolint/hadolint-action@v3.3.0 | |
| with: | |
| dockerfile: infrastructure/docker/services/php/Dockerfile | |
| ci: | |
| name: Test with PHP ${{ matrix.php-version }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.3", "8.4", "8.5"] | |
| runs-on: ubuntu-latest | |
| env: | |
| DS_PHP_VERSION: ${{ matrix.php-version }} | |
| 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 $ --password-stdin | |
| - name: setup-castor | |
| uses: castor-php/setup-castor@v1.0.0 | |
| - uses: actions/checkout@v6 | |
| - name: "Build and start the infrastructure" | |
| run: "castor start" | |
| - name: "Check Security issues" | |
| run: "castor qa:security-audit" | |
| - name: "Check PHP coding standards" | |
| run: "castor qa:cs --dry-run" | |
| - name: "Check Twig coding standards" | |
| run: "castor qa:twig-cs --dry-run" | |
| - name: "Run PHPStan" | |
| run: "castor qa:phpstan" | |
| - name: "Run PHPUnit" | |
| run: "castor qa:phpunit" | |
| - name: "Test HTTP server" | |
| run: | | |
| set -e | |
| set -o pipefail | |
| curl --fail --insecure --silent -H "Host: app.test" https://127.0.0.1 | grep "Hello world" | |
| curl --fail --insecure --silent -H "Host: app.test" https://127.0.0.1 | grep "${{ matrix.php-version }}" | |
| - name: "Test builder" | |
| run: | | |
| set -e | |
| set -o pipefail | |
| cat > .castor/test.php <<'EOPHP' | |
| <?php | |
| use Castor\Attribute\AsTask; | |
| use function docker\docker_compose_run; | |
| #[AsTask()] | |
| function test() | |
| { | |
| docker_compose_run('echo "Hello World"'); | |
| } | |
| #[AsTask()] | |
| function app_env() | |
| { | |
| docker_compose_run('php public/index.php'); | |
| } | |
| EOPHP | |
| castor test | grep "Hello World" | |
| CASTOR_CONTEXT=default castor app-env | grep 'Environment: not set'" | |
| CASTOR_CONTEXT=test castor app-env | grep 'Environment: test'" | |
| - name: "Test communication with DB" | |
| run: | | |
| set -e | |
| set -o pipefail | |
| cat > application/public/index.php <<'EOPHP' | |
| <?php | |
| $pdo = new PDO('pgsql:host=postgres;dbname=app', 'app', 'app'); | |
| $pdo->exec('CREATE TABLE test (id integer NOT NULL)'); | |
| $pdo->exec('INSERT INTO test VALUES (1)'); | |
| echo $pdo->query('SELECT * from test')->fetchAll() ? 'database OK' : 'database KO'; | |
| EOPHP | |
| # FPM seems super slow to detect the change, we need to wait a bit | |
| sleep 3 | |
| curl --fail --insecure --silent -H "Host: app.test" https://127.0.0.1 | grep "database OK" |