|
| 1 | +name: CI |
| 2 | + |
| 3 | +# Run the full test suite (unit + mutation) on every PR targeting main and |
| 4 | +# whenever those changes land on main (e.g. a PR merge). |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + push: |
| 8 | + branches: [main] |
| 9 | + |
| 10 | +# Cancel superseded runs on the same ref (e.g. new pushes to an open PR). |
| 11 | +concurrency: |
| 12 | + group: ci-${{ github.workflow }}-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + |
| 18 | +jobs: |
| 19 | + tests: |
| 20 | + name: Unit + Mutation (PHP ${{ matrix.php }}) |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + php: ['8.4'] |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + |
| 31 | + - name: Setup PHP |
| 32 | + uses: shivammathur/setup-php@v2 |
| 33 | + with: |
| 34 | + php-version: ${{ matrix.php }} |
| 35 | + coverage: pcov # Infection's coverage driver (PCOV; Xdebug off) |
| 36 | + tools: composer:v2 |
| 37 | + ini-values: memory_limit=-1 |
| 38 | + |
| 39 | + - name: Cache Composer packages |
| 40 | + uses: actions/cache@v4 |
| 41 | + with: |
| 42 | + path: ~/.cache/composer/files |
| 43 | + key: composer-${{ runner.os }}-php${{ matrix.php }}-${{ hashFiles('composer.json') }} |
| 44 | + restore-keys: composer-${{ runner.os }}-php${{ matrix.php }}- |
| 45 | + |
| 46 | + # `make test` / `make test/mutation` each run `composer install` first, so the |
| 47 | + # Makefile stays the single source of truth for how the suite runs locally and in CI. |
| 48 | + - name: Unit tests (PHPUnit) |
| 49 | + run: make test |
| 50 | + |
| 51 | + - name: Mutation tests (Infection, min-msi=100) |
| 52 | + run: make test/mutation |
| 53 | + |
| 54 | + demo: |
| 55 | + name: Demo app (PHP ${{ matrix.php }}) |
| 56 | + runs-on: ubuntu-latest |
| 57 | + strategy: |
| 58 | + fail-fast: false |
| 59 | + matrix: |
| 60 | + php: ['8.4'] |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Checkout |
| 64 | + uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Setup PHP |
| 67 | + uses: shivammathur/setup-php@v2 |
| 68 | + with: |
| 69 | + php-version: ${{ matrix.php }} |
| 70 | + coverage: none |
| 71 | + tools: composer:v2 |
| 72 | + ini-values: memory_limit=-1 |
| 73 | + |
| 74 | + - name: Cache Composer packages |
| 75 | + uses: actions/cache@v4 |
| 76 | + with: |
| 77 | + path: ~/.cache/composer/files |
| 78 | + key: composer-demo-${{ runner.os }}-php${{ matrix.php }}-${{ hashFiles('demo/composer.json') }} |
| 79 | + restore-keys: composer-demo-${{ runner.os }}-php${{ matrix.php }}- |
| 80 | + |
| 81 | + # The demo consumes the bundle from the checkout via a Composer path repository. |
| 82 | + - name: Install demo dependencies |
| 83 | + working-directory: demo |
| 84 | + run: composer install --prefer-dist --no-interaction --no-progress |
| 85 | + |
| 86 | + # app:find exercises the opt-in DI path: an .xphp command autowiring a |
| 87 | + # CachedFinder<User> specialization (compiled at container build). |
| 88 | + - name: Run app:find (generic service via DI) |
| 89 | + working-directory: demo |
| 90 | + run: | |
| 91 | + php bin/console app:find | tee find.out |
| 92 | + grep -q "Ada" find.out |
| 93 | + grep -q "Autowired" find.out |
| 94 | + grep -q "cache-aside" find.out |
| 95 | +
|
| 96 | + # app:demo exercises the value-type path: a generic Box<Plastic> monomorphized |
| 97 | + # and called from compiled code. |
| 98 | + - name: Run app:demo (value-type generic) |
| 99 | + working-directory: demo |
| 100 | + run: | |
| 101 | + php bin/console app:demo | tee demo.out |
| 102 | + grep -q "blue" demo.out |
| 103 | + grep -q "monomorphized" demo.out |
0 commit comments