|
| 1 | +name: Integrations |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths-ignore: |
| 8 | + - '.github/actions/release-please/**' |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: read |
| 15 | + |
| 16 | +jobs: |
| 17 | + should-run: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + outputs: |
| 20 | + run: ${{ steps.check.outputs.run }} |
| 21 | + steps: |
| 22 | + - name: Skip for release-please |
| 23 | + id: check |
| 24 | + run: | |
| 25 | + if [ "${{ github.event.pull_request.user.id }}" = "41898282" ]; then |
| 26 | + echo "run=false" >> $GITHUB_OUTPUT |
| 27 | + echo "::notice::Skipping integration tests - this a release-please bot's interaction" |
| 28 | + else |
| 29 | + echo "run=true" >> $GITHUB_OUTPUT |
| 30 | + echo "::notice::integration tests will execute - the actor is not the release-please bot" |
| 31 | + fi |
| 32 | +
|
| 33 | + integration-tests: |
| 34 | + needs: should-run |
| 35 | + if: needs.should-run.outputs.run == 'true' |
| 36 | + runs-on: ubuntu-latest |
| 37 | + name: "PostgreSQL ${{ matrix.postgres }} + PHP ${{ matrix.php }}" |
| 38 | + |
| 39 | + strategy: |
| 40 | + fail-fast: false |
| 41 | + matrix: |
| 42 | + php: ['8.1', '8.2', '8.3', '8.4'] |
| 43 | + postgres: ['16', '17'] |
| 44 | + |
| 45 | + services: |
| 46 | + postgres: |
| 47 | + image: postgres:${{ matrix.postgres }} |
| 48 | + env: |
| 49 | + POSTGRES_PASSWORD: postgres |
| 50 | + POSTGRES_USER: postgres |
| 51 | + POSTGRES_DB: postgres_doctrine_test |
| 52 | + ports: |
| 53 | + - 5432:5432 |
| 54 | + options: >- |
| 55 | + --health-cmd pg_isready |
| 56 | + --health-interval 10s |
| 57 | + --health-timeout 5s |
| 58 | + --health-retries 5 |
| 59 | + --mount type=tmpfs,destination=/var/lib/postgresql/data |
| 60 | + -e POSTGRES_INITDB_ARGS="--data-checksums" |
| 61 | +
|
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + |
| 65 | + - name: Set up PHP |
| 66 | + uses: shivammathur/setup-php@v2 |
| 67 | + with: |
| 68 | + php-version: ${{ matrix.php }} |
| 69 | + coverage: xdebug |
| 70 | + extensions: ctype, json, mbstring, pdo_pgsql |
| 71 | + tools: composer |
| 72 | + |
| 73 | + - name: Validate composer.json and composer.lock |
| 74 | + run: composer validate --strict |
| 75 | + |
| 76 | + - name: Cache Composer packages |
| 77 | + id: composer-cache |
| 78 | + uses: actions/cache@v4 |
| 79 | + with: |
| 80 | + path: vendor |
| 81 | + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} |
| 82 | + restore-keys: | |
| 83 | + ${{ runner.os }}-php- |
| 84 | +
|
| 85 | + - name: Install dependencies |
| 86 | + run: composer install --prefer-dist --no-interaction --no-progress |
| 87 | + |
| 88 | + - name: Install PostgreSQL client tools |
| 89 | + run: | |
| 90 | + sudo apt-get update |
| 91 | + sudo apt-get install -y postgresql-client |
| 92 | +
|
| 93 | + - name: Verify PostgreSQL connection and setup |
| 94 | + run: | |
| 95 | + echo "Checking PostgreSQL version:" |
| 96 | + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT version();" |
| 97 | +
|
| 98 | + echo "\nChecking PostgreSQL configuration:" |
| 99 | + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW server_version;" |
| 100 | + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW max_connections;" |
| 101 | + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SHOW shared_buffers;" |
| 102 | +
|
| 103 | + echo "\nCreating test schema:" |
| 104 | + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "CREATE SCHEMA IF NOT EXISTS test;" |
| 105 | +
|
| 106 | + echo "\nListing available PostgreSQL extensions:" |
| 107 | + PGPASSWORD=postgres psql -h localhost -U postgres -d postgres_doctrine_test -c "SELECT * FROM pg_available_extensions;" |
| 108 | +
|
| 109 | + - name: Run integration test suite |
| 110 | + run: composer run-integration-tests |
| 111 | + env: |
| 112 | + POSTGRES_HOST: localhost |
| 113 | + POSTGRES_PORT: 5432 |
| 114 | + POSTGRES_DB: postgres_doctrine_test |
| 115 | + POSTGRES_USER: postgres |
| 116 | + POSTGRES_PASSWORD: postgres |
0 commit comments