|
| 1 | +name: Test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main", "develop" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main", "develop" ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + phpunit: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + php-version: ["8.5"] |
| 20 | + |
| 21 | + steps: |
| 22 | + # Workspace development workflow: |
| 23 | + # this job reconstructs the local workspace layout expected by sibling path |
| 24 | + # repositories, so related packages are checked out side by side during development. |
| 25 | + # |
| 26 | + # Release workflow: |
| 27 | + # tagged release validation must also succeed from an isolated checkout with |
| 28 | + # `composer validate`, `composer test`, and `composer analyse`. |
| 29 | + - name: Checkout value-kit |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + path: value-kit |
| 33 | + |
| 34 | + - name: Setup PHP |
| 35 | + uses: shivammathur/setup-php@v2 |
| 36 | + with: |
| 37 | + php-version: ${{ matrix.php-version }} |
| 38 | + extensions: bcmath, mbstring |
| 39 | + tools: composer:v2, phpunit |
| 40 | + coverage: none |
| 41 | + |
| 42 | + - name: Validate composer.json |
| 43 | + working-directory: value-kit |
| 44 | + run: composer validate --strict |
| 45 | + |
| 46 | + - name: Get Composer Cache Directory |
| 47 | + id: composer-cache |
| 48 | + working-directory: value-kit |
| 49 | + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT |
| 50 | + |
| 51 | + - name: Cache dependencies |
| 52 | + uses: actions/cache@v4 |
| 53 | + with: |
| 54 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 55 | + key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('value-kit/composer.json') }} |
| 56 | + restore-keys: ${{ runner.os }}-composer- |
| 57 | + |
| 58 | + - name: Install dependencies |
| 59 | + working-directory: value-kit |
| 60 | + run: | |
| 61 | + bash ./tools/ensure-vendor.sh |
| 62 | + if [ ! -f vendor/autoload.php ]; then |
| 63 | + composer update -W --prefer-dist --no-progress |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: Run test suite |
| 67 | + working-directory: value-kit |
| 68 | + run: composer test |
| 69 | + |
| 70 | + - name: Run static analysis |
| 71 | + working-directory: value-kit |
| 72 | + run: composer analyse |
0 commit comments