From 41b3e26aeaa9ef905cb6111cc4f47ef975ca4f09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 15 Mar 2024 13:37:04 +0100 Subject: [PATCH 1/2] ci: update checkout action version --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5d096f0..bda6761 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check php/Dockerfile uses: hadolint/hadolint-action@v3.1.0 @@ -37,7 +37,7 @@ jobs: CI: 1 steps: - - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Setup From 036a2c3ab5fef7452c1ca000b0b9c277e53addc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Fri, 15 Mar 2024 13:37:22 +0100 Subject: [PATCH 2/2] ci: format yaml --- .github/workflows/ci.yml | 152 +++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 80 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bda6761..b3bb9b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,12 @@ name: Continuous Integration -'on': +"on": push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] schedule: - - cron: '0 0 * * MON' + - cron: "0 0 * * MON" permissions: contents: read @@ -16,95 +16,87 @@ jobs: name: Check Dockerfile runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 - - name: Check php/Dockerfile - uses: hadolint/hadolint-action@v3.1.0 - with: - dockerfile: infrastructure/docker/services/php/Dockerfile + - name: Check php/Dockerfile + uses: hadolint/hadolint-action@v3.1.0 + with: + dockerfile: infrastructure/docker/services/php/Dockerfile ci: name: Test with PHP ${{ matrix.php-version }} strategy: fail-fast: false matrix: - php-version: ['8.1', '8.2', '8.3'] + php-version: ["8.1", "8.2", "8.3"] runs-on: ubuntu-latest env: DS_PHP_VERSION: ${{ matrix.php-version }} BUILDKIT_PROGRESS: plain CI: 1 steps: - - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 # Setup - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: 8.2 - tools: castor - - - - name: 'Build and start the infrastructure' - run: 'castor start && sleep 5' - - - - name: 'Check PHP coding standards' - run: 'castor qa:cs' - - - - name: 'Run PHPStan' - run: 'castor qa:phpstan' - - - - 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' - application/public/index.php <<'EOPHP' - 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" + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + tools: castor + + - name: "Build and start the infrastructure" + run: "castor start && sleep 5" + + - name: "Check PHP coding standards" + run: "castor qa:cs" + + - name: "Run PHPStan" + run: "castor qa:phpstan" + + - 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' + application/public/index.php <<'EOPHP' + 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"