Skip to content

feat(ci): update config to use workflow from feryardiant/actions #171

feat(ci): update config to use workflow from feryardiant/actions

feat(ci): update config to use workflow from feryardiant/actions #171

Workflow file for this run

name: Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
jobs:
configs:
name: Configure
uses: projek-xyz/actions/.github/workflows/configure.yml@main
secrets: inherit
permissions:
contents: read
pull-requests: write
tests:
name: Test on PHP ${{ matrix.php }}
runs-on: ubuntu-latest
needs: configs
outputs:
has-reports: ${{ steps.reports.outputs.has-reports }}
strategy:
fail-fast: false
matrix:
php: ['8.1', '8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ needs.configs.outputs.composer-cache }}
key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-composer-
- name: Install dependencies
run: composer update --prefer-dist --no-interaction --no-progress
- name: Run tests
env:
BUILD_MATRIX: PHP ${{ matrix.php }}
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
run: |
composer testbench dusk:browserstack-local
composer test -- --coverage
- name: Generate reports for CodeClimate
if: github.actor != 'dependabot[bot]' && needs.configs.outputs.should-reports == '1'
id: reports
env:
COVERAGE_FILE: tests/reports/clover.xml
CODECLIMATE_REPORT: tests/reports/codeclimate.${{ matrix.php }}.json
CC_TEST_REPORTER_URL: ${{ vars.CC_TEST_REPORTER_URL }}
run: |
curl -LSs $CC_TEST_REPORTER_URL > ./cc-test-reporter && chmod +x ./cc-test-reporter
./cc-test-reporter format-coverage -t clover -o $CODECLIMATE_REPORT $COVERAGE_FILE
echo "has-reports=1" >> $GITHUB_OUTPUT
- name: Upload tests reports
uses: actions/upload-artifact@v4
if: steps.reports.outputs.has-reports == '1'
with:
name: test-reports-${{ matrix.php }}
path: tests/reports
reports:
name: Reports
if: needs.tests.outputs.has-reports == '1'
uses: projek-xyz/actions/.github/workflows/report.yml@main
secrets: inherit
needs: tests
with:
has-codeclimate: true