|
| 1 | +name: Unit Tests Postgres |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + phpunit: |
| 11 | + name: PHPUnit |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + strategy: |
| 15 | + fail-fast: false |
| 16 | + matrix: |
| 17 | + include: |
| 18 | + - php-version: "8.0" |
| 19 | + db-image: 'postgres:14' |
| 20 | + reflector: "pdo-pgsql" |
| 21 | + mode: "recording" |
| 22 | + |
| 23 | + env: |
| 24 | + DBA_REFLECTOR: ${{ matrix.reflector }} |
| 25 | + DBA_MODE: ${{ matrix.mode }} |
| 26 | + DBA_USER: postgres |
| 27 | + DBA_DATABASE: postgres |
| 28 | + DBA_PASSWORD: postgres |
| 29 | + |
| 30 | + # https://docs.github.com/en/free-pro-team@latest/actions/guides/about-service-containers |
| 31 | + services: |
| 32 | + postgres: |
| 33 | + image: ${{ matrix.db-image }} |
| 34 | + env: |
| 35 | + POSTGRES_PASSWORD: postgres |
| 36 | + options: --health-cmd=pg_isready --health-interval=10s --health-timeout=5s --health-retries=3 |
| 37 | + ports: |
| 38 | + - 5432:5432 |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + with: |
| 43 | + repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} |
| 44 | + ref: ${{ github.event.client_payload.pull_request.head.ref }} |
| 45 | + |
| 46 | + - name: Setup PHP with PDO |
| 47 | + uses: shivammathur/setup-php@v2 |
| 48 | + with: |
| 49 | + php-version: "${{ matrix.php-version }}" |
| 50 | + coverage: none |
| 51 | + |
| 52 | + - uses: "ramsey/composer-install@v2" |
| 53 | + with: |
| 54 | + composer-options: "--prefer-dist --no-progress" |
| 55 | + |
| 56 | + - name: Setup Problem Matchers for PHPUnit |
| 57 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 58 | + |
| 59 | + - name: Install PostgreSQL client |
| 60 | + run: | |
| 61 | + sudo apt-get update |
| 62 | + sudo apt-get install --yes postgresql-client |
| 63 | +
|
| 64 | + - name: Setup PSQL |
| 65 | + run: psql -h localhost -U postgres < tests/pgsql-schema.sql |
| 66 | + env: |
| 67 | + PGPASSWORD: postgres |
| 68 | + |
| 69 | + - run: composer phpunit |
| 70 | + |
| 71 | + replay: |
| 72 | + name: PHPUnit (reflection replay) |
| 73 | + runs-on: ubuntu-latest |
| 74 | + |
| 75 | + strategy: |
| 76 | + fail-fast: false |
| 77 | + matrix: |
| 78 | + include: |
| 79 | + - php-version: "8.1" |
| 80 | + reflector: "pdo-pgsql" |
| 81 | + mode: "replay" |
| 82 | + dsn: "pgsql" |
| 83 | + |
| 84 | + env: |
| 85 | + DBA_REFLECTOR: ${{ matrix.reflector }} |
| 86 | + DBA_MODE: ${{ matrix.mode }} |
| 87 | + DBA_DSN: ${{ matrix.dsn }} |
| 88 | + DBA_USER: postgres |
| 89 | + DBA_DATABASE: postgres |
| 90 | + DBA_PASSWORD: postgres |
| 91 | + |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v2 |
| 94 | + with: |
| 95 | + repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }} |
| 96 | + ref: ${{ github.event.client_payload.pull_request.head.ref }} |
| 97 | + |
| 98 | + - name: Setup PHP |
| 99 | + uses: shivammathur/setup-php@v2 |
| 100 | + with: |
| 101 | + php-version: "${{ matrix.php-version }}" |
| 102 | + coverage: none |
| 103 | + |
| 104 | + - uses: "ramsey/composer-install@v2" |
| 105 | + with: |
| 106 | + composer-options: "--prefer-dist --no-progress" |
| 107 | + |
| 108 | + - name: Setup Problem Matchers for PHPUnit |
| 109 | + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 110 | + |
| 111 | + - run: composer phpunit |
0 commit comments