From 075dcea91dfaed3e617447de6504d14d58325c5c Mon Sep 17 00:00:00 2001 From: Woody Gilk Date: Tue, 14 Nov 2023 07:11:34 -0600 Subject: [PATCH] Update Github actions --- .github/workflows/ci.yml | 92 ++++++++++++++++++++++++++ .github/workflows/static-analysis.yaml | 25 ------- .github/workflows/test.yaml | 66 ------------------ README.md | 2 +- 4 files changed, 93 insertions(+), 92 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/static-analysis.yaml delete mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..77c33c3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,92 @@ +name: CI + +on: + pull_request: ~ + push: + branches: [ main ] + +jobs: + check-style: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + + - name: Install dependencies + run: composer install + + - name: Check code style + run: composer run check + + test-code: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - '7.3' + - '7.4' + - '8.0' + - '8.1' + - '8.2' + - '8.3' + minimum_versions: [ false ] + coverage: [ 'none' ] + include: + - description: Minimum version + php: '7.3' + minimum_versions: true + - description: Code coverage + php: '8.2' + coverage: pcov + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: ${{ matrix.coverage }} + + - name: Install dependencies + run: composer install + if: matrix.minimum_versions == false + + - name: Install dependencies (minimum versions) + run: composer update --no-interaction --prefer-lowest + if: matrix.minimum_versions == true + + - name: Run tests + run: vendor/bin/phpunit --no-coverage + if: matrix.coverage == 'none' + + - name: Run tests with code coverage + run: vendor/bin/phpunit --exclude-group proxy --coverage-clover=coverage.xml + if: matrix.coverage == 'pcov' + + - name: Upload code coverage report + uses: codecov/codecov-action@v4-beta + if: matrix.coverage == 'pcov' + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + with: + file: coverage.xml + fail_ci_if_error: true diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml deleted file mode 100644 index 20e15c4..0000000 --- a/.github/workflows/static-analysis.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Code style - -on: - pull_request: - push: - branches: [ main ] - -jobs: - php-cs-fixer: - name: PHP-CodeSniffer - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '7.4' - - - name: Install dependencies - run: composer install - - - name: Run script - run: composer run check diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml deleted file mode 100644 index 2bdfe66..0000000 --- a/.github/workflows/test.yaml +++ /dev/null @@ -1,66 +0,0 @@ -name: test - -on: - pull_request: - push: - branches: [ main ] - -jobs: - run: - runs-on: ubuntu-18.04 - strategy: - fail-fast: false - matrix: - php: - - '7.3' - - '7.4' - - '8.0' - - '8.1' - minimum_versions: [false] - coverage: ['none'] - include: - - description: 'Minimum version' - php: '7.3' - minimum_versions: true - - description: 'Log Code Coverage' - php: '8.1' - coverage: 'xdebug' - - name: PHP ${{ matrix.php }} ${{ matrix.description }} - steps: - - name: Checkout - uses: actions/checkout@v2 - - - uses: actions/cache@v2 - with: - path: ~/.composer/cache/files - key: ${{ matrix.php }} - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - coverage: ${{ matrix.coverage }} - - - name: Install dependencies - run: composer install - if: matrix.minimum_versions == false - - - name: Install dependencies lower - run: composer update --no-interaction --prefer-lowest - if: matrix.minimum_versions == true - - - name: Run PHPUnit tests - run: vendor/bin/phpunit - if: matrix.coverage == 'none' - - - name: PHPUnit tests and Log Code coverage - run: ./vendor/bin/phpunit --exclude-group proxy --coverage-clover=coverage.xml - if: matrix.coverage == 'xdebug' - - - name: Run codecov - uses: codecov/codecov-action@v1 - if: matrix.coverage == 'xdebug' - with: - file: './coverage.xml' - fail_ci_if_error: true diff --git a/README.md b/README.md index dbaf9f1..b9fa215 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Google Provider for OAuth 2.0 Client -[![Build Status](https://img.shields.io/github/workflow/status/thephpleague/oauth2-google/test/main)](https://github.com/thephpleague/oauth2-google/actions/workflows/test.yaml) +[![Build Status](https://img.shields.io/github/workflow/status/thephpleague/oauth2-google/ci/main)](https://github.com/thephpleague/oauth2-google/actions/workflows/test.yaml) [![Code Coverage](https://img.shields.io/codecov/c/gh/thephpleague/oauth2-google)](https://app.codecov.io/gh/thephpleague/oauth2-google) [![License](https://img.shields.io/packagist/l/league/oauth2-google)](https://github.com/thephpleague/oauth2-google/blob/main/LICENSE) [![Latest Stable Version](https://img.shields.io/packagist/v/league/oauth2-google)](https://packagist.org/packages/league/oauth2-google)