Merge pull request #8 from Automattic/6-add-ci-to-project #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| php: | |
| name: PHP ${{ matrix.php }} lint and tests | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php: | |
| - '7.4' | |
| - '8.0' | |
| - '8.1' | |
| - '8.2' | |
| - '8.3' | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: json, zip | |
| coverage: none | |
| - name: Show PHP version | |
| run: php -v | |
| - name: Lint PHP files | |
| run: | | |
| find . \ | |
| -path './.git' -prune -o \ | |
| -path './sample' -prune -o \ | |
| -path './prompt-images' -prune -o \ | |
| -path './pipelines' -prune -o \ | |
| -path './vendor' -prune -o \ | |
| -path './node_modules' -prune -o \ | |
| -name '*.php' -print0 | xargs -0 -n1 php -l | |
| - name: Run pure helper tests | |
| run: php tests/pure-helper-tests.php |