Use attributes in tests #248
This file contains 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: Package tests | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
php: [ '8.0', '8.1', '8.2', '8.3' ] | |
l5-swagger-flags: ['latest', 'swagger-php-3', 'swagger-ui-3'] | |
name: PHP ${{ matrix.php }} - ${{ matrix.l5-swagger-flags }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
ini-values: xdebug.mode="coverage" | |
coverage: xdebug | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v2 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php- | |
- name: Install dependencies | |
run: composer update --no-interaction --no-progress --prefer-dist --prefer-stable | |
- name: Require Swagger PHP 3.* | |
run: composer require 'zircote/swagger-php:3.*' --no-interaction --no-update | |
if: matrix.l5-swagger-flags == 'swagger-php-3' | |
- name: Require Swagger UI 3.* | |
run: composer require 'swagger-api/swagger-ui:3.*' --no-interaction --no-update | |
if: matrix.l5-swagger-flags == 'swagger-ui-3' | |
- name: Prepare enviroment | |
run: | | |
sudo chown -R $USER:$USER . | |
sudo chmod -R g+rw . | |
mkdir -p tests/storage/logs/test-reports | |
mkdir -p vendor/orchestra/testbench-core/laravel/vendor/swagger-api | |
mkdir -p vendor/orchestra/testbench-core/laravel/vendor/swagger-api/swagger-ui | |
mkdir -p vendor/orchestra/testbench-core/laravel/vendor/swagger-api/swagger-ui/dist | |
sudo chown -R $USER:$USER vendor/orchestra/testbench-core/laravel/vendor/swagger-api | |
chmod -R 777 vendor/orchestra/testbench-core/laravel/vendor/swagger-api | |
- name: Prepare code climate | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build | |
if: matrix.php == '8.3' && matrix.l5-swagger-flags == 'latest' | |
- name: Run PHP 8.0 test suite | |
run: vendor/bin/phpunit --testdox -c phpunit-php80.xml | |
if: matrix.php == '8.0' | |
- name: Run test suite | |
run: composer run-script phpunit | |
if: matrix.php != '8.0' | |
- name: Publish code coverage | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
run: | | |
cp ${{github.workspace}}/tests/storage/logs/test-reports/clover.xml ${{github.workspace}}/clover.xml | |
./cc-test-reporter after-build -t clover --exit-code 0 | |
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r ${{github.workspace}}/clover.xml | |
if: matrix.php == '8.3' && matrix.l5-swagger-flags == 'latest' && github.event_name != 'pull_request' | |
- name: Publish coveralls report | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
cp ${{github.workspace}}/tests/storage/logs/test-reports/clover.xml ${{github.workspace}}/clover.xml | |
vendor/bin/php-coveralls --coverage_clover=clover.xml -v | |
if: matrix.php == '8.3' && matrix.l5-swagger-flags == 'latest' |