Merge pull request #52 from WyriHaximus-labs/tls-connection-support #51
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: | |
| - 'master' | |
| - 'refs/heads/[0-9]+.[0-9]+.[0-9]+' | |
| pull_request: | |
| jobs: | |
| supported-versions-matrix: | |
| name: Supported Versions Matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.supported-versions-matrix.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: supported-versions-matrix | |
| uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 | |
| tests: | |
| name: Testing on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference against Postgres ${{ matrix.postgres }} with TLS ${{ matrix.tls }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} | |
| postgres: [16, 17] | |
| composer: [lowest, locked, highest] | |
| tls: ["disable", "require", "verify-ca"] | |
| needs: | |
| - supported-versions-matrix | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ikalnytskyi/action-setup-postgres@v7 | |
| with: | |
| postgres-version: ${{ matrix.postgres }} | |
| ssl: ${{ matrix.tls == 'disable' && false || true }} | |
| id: postgres | |
| - run: | | |
| psql -c "CREATE USER pgasync" | |
| psql -c "ALTER ROLE pgasync PASSWORD 'pgasync'" | |
| psql -c "CREATE USER pgasyncpw" | |
| psql -c "ALTER ROLE pgasyncpw PASSWORD 'example_password'" | |
| psql -c "CREATE USER scram_user" | |
| psql -c "SET password_encryption='scram-sha-256';ALTER ROLE scram_user PASSWORD 'scram_password'" | |
| psql -c "CREATE DATABASE pgasync_test OWNER pgasync" | |
| # cat tests/test_db.sql | xargs -I % psql -c "%" | |
| env: | |
| PGSERVICE: "${{ steps.postgres.outputs.service-name }}" | |
| - run: | | |
| PGPASSWORD=pgasync psql -h localhost -U pgasync -f tests/test_db.sql pgasync_test | |
| - uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| coverage: xdebug | |
| - uses: ramsey/composer-install@v2 | |
| with: | |
| dependency-versions: ${{ matrix.composer }} | |
| # - run: vendor/bin/phpunit --testdox | |
| - run: echo "dsn=postgresql://pgasync:pgasync@localhost/pgasync_test?tlsmode=${{ matrix.tls }}&tlsservercert=${{ steps.postgres.outputs.certificate-path }}" >> $GITHUB_OUTPUT | |
| id: dsn | |
| - run: vendor/bin/phpunit | |
| env: | |
| TEST_POSTGRES_DSN: ${{ steps.dsn.outputs.dsn }} |