|
| 1 | +# This workflow uses actions that are not certified by GitHub. |
| 2 | +# They are provided by a third-party and are governed by |
| 3 | +# separate terms of service, privacy policy, and support |
| 4 | +# documentation. |
| 5 | + |
| 6 | +name: PR |
| 7 | + |
| 8 | +on: |
| 9 | + pull_request: |
| 10 | + branches: [ main ] |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + operating-system: [ubuntu-latest] |
| 21 | + php-version: ['7.4', '8.0', '8.1'] |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + with: |
| 26 | + submodules: true |
| 27 | + fetch-depth: 0 |
| 28 | + |
| 29 | + - name: Setup PHP |
| 30 | + uses: shivammathur/setup-php@v2 |
| 31 | + with: |
| 32 | + php-version: ${{ matrix.php-version }} |
| 33 | + coverage: xdebug |
| 34 | + extensions: ast |
| 35 | + |
| 36 | + - name: Validate composer.json and composer.lock |
| 37 | + run: composer validate |
| 38 | + |
| 39 | + - name: Cache Composer packages |
| 40 | + id: root-composer-cache |
| 41 | + uses: actions/cache@v3 |
| 42 | + with: |
| 43 | + path: vendor |
| 44 | + key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('composer.json') }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-${{ matrix.php-version }}-php- |
| 47 | +
|
| 48 | + - name: Install dependencies |
| 49 | + if: steps.root-composer-cache.outputs.cache-hit != 'true' |
| 50 | + run: composer install --prefer-dist --no-progress --no-suggest |
| 51 | + |
| 52 | + - name: Check Style |
| 53 | + run: vendor/bin/phpcs |
| 54 | + |
| 55 | + - name: Run Psalm |
| 56 | + run: vendor/bin/psalm --output-format=github --php-version=${{ matrix.php-version }} |
| 57 | + |
| 58 | + - name: Run Phpstan |
| 59 | + run: vendor/bin/phpstan analyse --error-format=github |
| 60 | + |
| 61 | + - name: Run PHPUnit (unit tests) |
| 62 | + run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --testsuite unit |
| 63 | + |
| 64 | + - name: Validate composer.json and composer.lock |
| 65 | + working-directory: integration |
| 66 | + run: composer validate |
| 67 | + |
| 68 | + - name: Prepare test-harness |
| 69 | + working-directory: integration |
| 70 | + run: | |
| 71 | + git submodule update --init --recursive |
| 72 | + cp ./test-harness/features/*.feature ./features/ |
| 73 | +
|
| 74 | + - name: Cache Composer packages |
| 75 | + id: behat-composer-cache |
| 76 | + uses: actions/cache@v3 |
| 77 | + with: |
| 78 | + path: integration/vendor |
| 79 | + key: ${{ runner.os }}-${{ matrix.php-version }}-php-${{ hashFiles('integration/composer.json') }} |
| 80 | + restore-keys: | |
| 81 | + ${{ runner.os }}-${{ matrix.php-version }}-php- |
| 82 | +
|
| 83 | + - name: Install dependencies |
| 84 | + working-directory: integration |
| 85 | + if: steps.behat-composer-cache.outputs.cache-hit != 'true' |
| 86 | + run: composer install --prefer-dist --no-progress --no-suggest |
| 87 | + |
| 88 | + - name: Start test-harness container |
| 89 | + run: docker run --rm -d -p 8013:8013 ghcr.io/open-feature/flagd-testbed:latest |
| 90 | + |
| 91 | + - name: Run Behat (integration tests) |
| 92 | + working-directory: integration |
| 93 | + run: vendor/bin/behat |
0 commit comments