|
| 1 | +--- |
| 2 | + |
| 3 | +on: # yamllint disable-line rule:truthy |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + push: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +name: 🧪 Testing (PostgreSQL) |
| 12 | + |
| 13 | +env: |
| 14 | + DB_HOST: 127.0.0.1 |
| 15 | + DB_PORT: 15432 |
| 16 | + DB_USERNAME: cycle |
| 17 | + DB_PASSWORD: SSpaSS__1_123 |
| 18 | + DB_CONNECTION: mysql |
| 19 | + DB_DATABASE: default |
| 20 | + |
| 21 | +jobs: |
| 22 | + test-mysql: |
| 23 | + timeout-minutes: 4 |
| 24 | + runs-on: ${{ matrix.os }} |
| 25 | + concurrency: |
| 26 | + cancel-in-progress: true |
| 27 | + group: test-mysql-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ matrix.php-version }}-${{ matrix.dependencies }} |
| 28 | + strategy: |
| 29 | + fail-fast: true |
| 30 | + matrix: |
| 31 | + os: |
| 32 | + - 'ubuntu-latest' |
| 33 | + php-version: |
| 34 | + - '8.2' |
| 35 | + dependencies: |
| 36 | + - locked |
| 37 | + pgsql-version: |
| 38 | + - '13-alpine' |
| 39 | + |
| 40 | + services: |
| 41 | + mysql: |
| 42 | + image: postgres:${{ matrix.pgsql-version }} |
| 43 | + env: |
| 44 | + POSTGRES_DB: 'default' |
| 45 | + POSTGRES_USER: 'cycle' |
| 46 | + POSTGRES_PASSWORD: 'SSpaSS__1_123' |
| 47 | + options: >- |
| 48 | + --health-cmd pg_isready |
| 49 | + --health-interval 10s |
| 50 | + --health-timeout 5s |
| 51 | + --health-retries 5 |
| 52 | + ports: |
| 53 | + - 15432:5432 |
| 54 | + |
| 55 | + steps: |
| 56 | + - name: 📦 Check out the codebase |
| 57 | + |
| 58 | + |
| 59 | + - name: 🛠️ Setup PHP |
| 60 | + uses: shivammathur/[email protected] |
| 61 | + with: |
| 62 | + php-version: ${{ matrix.php-version }} |
| 63 | + extensions: none, ctype, dom, json, mbstring, simplexml, tokenizer, xml, xmlwriter, pdo, curl, fileinfo, pdo_mysql, pdo_pgsql |
| 64 | + ini-values: error_reporting=E_ALL |
| 65 | + coverage: none |
| 66 | + |
| 67 | + - name: 🛠️ Setup problem matchers |
| 68 | + run: | |
| 69 | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" |
| 70 | + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" |
| 71 | +
|
| 72 | + - name: 🤖 Validate composer.json and composer.lock |
| 73 | + run: composer validate --ansi --strict |
| 74 | + |
| 75 | + - name: 🔍 Get composer cache directory |
| 76 | + uses: wayofdev/gh-actions/actions/composer/[email protected] |
| 77 | + |
| 78 | + - name: ♻️ Restore cached dependencies installed with composer |
| 79 | + |
| 80 | + with: |
| 81 | + path: ${{ env.COMPOSER_CACHE_DIR }} |
| 82 | + key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }} |
| 83 | + restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- |
| 84 | + |
| 85 | + - name: 🗑️ Remove PHP platform configuration |
| 86 | + if: "matrix.dependencies != 'locked'" |
| 87 | + run: composer config platform.php --ansi --unset |
| 88 | + |
| 89 | + - name: 📥 Install "${{ matrix.dependencies }}" dependencies |
| 90 | + uses: wayofdev/gh-actions/actions/composer/[email protected] |
| 91 | + with: |
| 92 | + dependencies: ${{ matrix.dependencies }} |
| 93 | + |
| 94 | + - name: 🧪 Run phpunit tests with Pest |
| 95 | + run: composer test |
0 commit comments