Bump codecov/codecov-action from 4.5.0 to 4.6.0 (#704) #793
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
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions | |
name: "Continuous Integration" | |
on: | |
pull_request: ~ | |
push: | |
branches: | |
- master | |
jobs: | |
continuous-integration: | |
name: "Continuous Integration" | |
runs-on: "ubuntu-latest" | |
strategy: | |
matrix: | |
install-args: ['', '--prefer-lowest'] | |
php-version: ['8.1', '8.2', '8.3'] | |
fail-fast: false | |
steps: | |
# Cancel previous runs of the same branch | |
- name: cancel | |
uses: styfle/cancel-workflow-action@0.12.1 | |
with: | |
access_token: ${{ github.token }} | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
coverage: "xdebug" | |
php-version: "${{ matrix.php-version }}" | |
tools: composer:v2 | |
- name: composer-cache-dir | |
id: composercache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: composer-cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composercache.outputs.dir }} | |
key: composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }} | |
restore-keys: | | |
composer-${{ hashFiles('**/composer.json') }}-${{ matrix.install-args }} | |
composer-${{ hashFiles('**/composer.json') }}- | |
composer- | |
- name: "Install dependencies with composer" | |
run: | | |
composer update ${{ matrix.install-args }} --no-interaction --no-progress --prefer-dist | |
- name: "Run tests with phpunit/phpunit" | |
run: "vendor/bin/phpunit" | |
- name: phpstan-cache | |
uses: actions/cache@v4 | |
with: | |
key: phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}-${{ github.sha }} | |
path: .phpstan-cache | |
restore-keys: | | |
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}-${{ github.ref }}- | |
phpstan-${{ matrix.php-version }}-${{ matrix.install-args }}- | |
phpstan-${{ matrix.php-version }}- | |
phpstan- | |
- name: "Run static code analysis with phpstan/phpstan" | |
run: "composer phpstan" | |
- name: "Run coding standard checks with squizlabs/php_codesniffer" | |
run: "composer cs-check" | |
- name: "Archive code coverage results" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: "codeCoverage" | |
path: "build" | |
overwrite: true | |
- uses: codecov/codecov-action@v4.6.0 # upload the coverage to codecov | |
with: | |
fail_ci_if_error: false # optional (default = false) - Need CODECOV_TOKEN | |
# Do not upload in forks, and only on php8.3, latest deps | |
if: ${{ github.repository == 'thecodingmachine/graphqlite' && matrix.php-version == '8.3' && matrix.install-args == '' }} | |
examples: | |
name: Check Examples | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
example: ['no-framework'] | |
fail-fast: false | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@v4" | |
- name: "Install PHP with extensions" | |
uses: "shivammathur/setup-php@v2" | |
with: | |
php-version: "8.2" | |
tools: composer:v2 | |
- name: "Install dependencies with composer" | |
working-directory: "examples/${{ matrix.example }}" | |
run: "composer --version && composer install --no-interaction --no-progress --prefer-dist" | |
- name: "Run example ${{ matrix.example }}" | |
working-directory: "examples/${{ matrix.example }}" | |
run: | | |
php -S localhost:8080 & | |
sleep 3 | |
curl --silent -X POST -H "Content-Type: application/json" \ | |
-d '{"query":"{ hello(name: \"World\") }"}' \ | |
http://localhost:8080/graphql -o output.json | |
grep -q '"data":{"hello":"Hello World"}' output.json || \ | |
(cat output.json && false) | |
kill %1 |