Skip to content

Commit

Permalink
Restructure things
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverklee committed Feb 3, 2024
1 parent 6dc97c9 commit 171ea94
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 53 deletions.
60 changes: 7 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,50 +39,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: [ '7.2', '7.3', '7.4' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: none

- name: Show the Composer configuration
run: composer config --global --list

- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ~/.cache/composer
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
- name: Install Composer dependencies
run: |
composer update --with-dependencies --no-progress;
composer show;
- name: Run Tests
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml

coverage:
name: Coverage

runs-on: ubuntu-22.04

needs: [ php-lint ]

strategy:
fail-fast: false
matrix:
php-version: [ '7.4' ]
php-version: [ '7.2', '7.3' ]
coverage: [ 'none' ]
include:
- php-version: '7.4'
coverage: none

steps:
- name: Checkout
Expand All @@ -94,7 +55,7 @@ jobs:
php-version: ${{ matrix.php-version }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: xdebug
coverage: "${{ matrix.coverage }}"

- name: Show the Composer configuration
run: composer config --global --list
Expand All @@ -113,14 +74,7 @@ jobs:
composer show;
- name: Run Tests
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml

- name: Upload coverage results to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: "${{ env.CODACY_PROJECT_TOKEN != '' }}"
run: |
./vendor/bin/codacycoverage clover build/coverage/xml
run: ./vendor/bin/phpunit

static-analysis:
name: Static Analysis
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/codecoverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions

on:
pull_request:
push:

name: Code coverage

jobs:
code-coverage:
name: Code coverage

runs-on: ubuntu-22.04

strategy:
matrix:
php-version: [ '7.4' ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
ini-values: error_reporting=E_ALL
tools: composer:v2
coverage: xdebug

- name: Show the Composer configuration
run: composer config --global --list

- name: Cache dependencies installed with composer
uses: actions/cache@v4
with:
path: ~/.cache/composer
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
- name: Install Composer dependencies
run: |
composer update --with-dependencies --no-progress;
composer show;
- name: Run Tests
run: ./vendor/bin/phpunit --coverage-clover build/coverage/xml

- name: Upload coverage results to Codacy
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
if: "${{ env.CODACY_PROJECT_TOKEN != '' }}"
run: |
./vendor/bin/codacycoverage clover build/coverage/xml

0 comments on commit 171ea94

Please sign in to comment.