|
| 1 | +name: Test |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ '*' ] |
| 5 | + tags: [ '*' ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + schedule: |
| 9 | + # Run automatically at 8AM PST Monday-Friday |
| 10 | + - cron: '0 15 * * 1-5' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: Test |
| 16 | + runs-on: ubuntu-latest |
| 17 | + timeout-minutes: 20 |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + php: [ 5.6, 7.0, 7.1, 7.2, 7.3, 7.4 ] |
| 21 | + dependencies: |
| 22 | + - "lowest" |
| 23 | + - "highest" |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout php-http-client |
| 27 | + uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Setup PHP Action |
| 30 | + uses: shivammathur/setup-php@2.15.0 |
| 31 | + with: |
| 32 | + php-version: ${{ matrix.php }} |
| 33 | + id: php |
| 34 | + |
| 35 | + - name: Composer webhook config |
| 36 | + run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: composer install |
| 40 | + |
| 41 | + - name: Update Dependencies |
| 42 | + if: ${{ matrix.dependencies == 'lowest' }} |
| 43 | + run: composer update --prefer-lowest --prefer-stable -n |
| 44 | + |
| 45 | + - name: Run Tests |
| 46 | + run: make test |
| 47 | + |
| 48 | + notify-on-failure: |
| 49 | + name: Slack notify on failure |
| 50 | + if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} |
| 51 | + needs: [test] |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - uses: rtCamp/action-slack-notify@v2 |
| 55 | + env: |
| 56 | + SLACK_COLOR: failure |
| 57 | + SLACK_ICON_EMOJI: ':github:' |
| 58 | + SLACK_MESSAGE: ${{ format('Build {2} in {1} failed{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} |
| 59 | + SLACK_TITLE: Build Failure |
| 60 | + SLACK_USERNAME: GitHub Actions |
| 61 | + SLACK_MSG_AUTHOR: twilio-dx |
| 62 | + SLACK_FOOTER: Posted automatically using GitHub Actions |
| 63 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 64 | + MSG_MINIMAL: true |
0 commit comments