|
| 1 | +name: Review changes on Dev (Commits/PRs) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["dev"] |
| 6 | + pull_request: |
| 7 | + types: |
| 8 | + - opened |
| 9 | + |
| 10 | +jobs: |
| 11 | + code-check: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + |
| 14 | + strategy: |
| 15 | + fail-fast: true |
| 16 | + matrix: |
| 17 | + php: [7.4, 8.1, 8.2] |
| 18 | + |
| 19 | + env: |
| 20 | + XDEBUG_MODE: coverage |
| 21 | + PUBLIC_KEY: ${{ secrets.PUBLIC_KEY }} |
| 22 | + SECRET_KEY: ${{ secrets.SECRET_KEY }} |
| 23 | + ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }} |
| 24 | + ENV: ${{ secrets.ENV }} |
| 25 | + |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v3 |
| 28 | + |
| 29 | + - name: Setup PHP |
| 30 | + uses: shivammathur/setup-php@v2 |
| 31 | + with: |
| 32 | + php-version: ${{ matrix.php }} |
| 33 | + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite |
| 34 | + coverage: xdebug |
| 35 | + |
| 36 | + - name: Validate composer.json and composer.lock |
| 37 | + run: composer validate --strict |
| 38 | + |
| 39 | + - name: Cache Composer packages |
| 40 | + id: composer-cache |
| 41 | + uses: actions/cache@v3 |
| 42 | + with: |
| 43 | + path: vendor |
| 44 | + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-php- |
| 47 | +
|
| 48 | + - name: Install dependencies |
| 49 | + run: composer install --prefer-dist --no-progress |
| 50 | + |
| 51 | + - name: 'Create env file' |
| 52 | + run: | |
| 53 | + touch .env |
| 54 | + echo PUBLIC_KEY=${PUBLIC_KEY} >> .env |
| 55 | + echo SECRET_KEY=${SECRET_KEY} >> .env |
| 56 | + echo ENCRYPTION_KEY=${ENCRYPTION_KEY} >> .env |
| 57 | + echo ENV=${ENV} >> .env |
| 58 | + ls -a ${{ github.workspace }} |
| 59 | +
|
| 60 | + - name: run unit tests and coverage scan |
| 61 | + run: ./vendor/bin/pest --coverage --min=20 --coverage-clover ./coverage.xml |
| 62 | + |
| 63 | + - name: Upload to Codecov |
| 64 | + uses: codecov/codecov-action@v2 |
| 65 | + with: |
| 66 | + token: ${{ secrets.CODE_COV_TOKEN }} |
| 67 | + files: ./coverage.xml |
| 68 | + verbose: true |
| 69 | + |
| 70 | + - name: push build status to Slack |
| 71 | + uses: 8398a7/action-slack@v3 |
| 72 | + with: |
| 73 | + status: ${{ job.status }} |
| 74 | + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest |
| 75 | + env: |
| 76 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 77 | + MATRIX_CONTEXT: ${{ toJson(matrix) }} |
| 78 | + if: always() |
0 commit comments