Skip to content

Commit

Permalink
add Codecov action and run tests in own workflow
Browse files Browse the repository at this point in the history
Fahl-Design committed Aug 6, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent da4463b commit 4a61961
Showing 2 changed files with 64 additions and 38 deletions.
57 changes: 19 additions & 38 deletions .github/workflows/cocdeception.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
on: [push, pull_request]
on: [ push, pull_request ]
name: Cocdeception

jobs:
@@ -9,48 +9,29 @@ jobs:
strategy:
matrix:
include:
# - { php-version: 7.4, dependencies: locked, coverage: none, with_coverage: false, allow-fail: false }
# - { php-version: 7.4, dependencies: locked, coverage: none, with_coverage: false, allow-fail: false }
- { php-version: 7.4, dependencies: highest, coverage: none, with_coverage: false, allow-fail: true }
- { php-version: 8.0, dependencies: locked, coverage: none, with_coverage: false, allow-fail: false }
- { php-version: 8.0, dependencies: highest, coverage: none, with_coverage: false, allow-fail: true }
- { php-version: 8.0, dependencies: locked, coverage: xdebug, with_coverage: true, allow-fail: false }
# - { php-version: 8.1, dependencies: highest, coverage: none, with_coverage: false, allow-fail: true }
# - { php-version: 8.1, dependencies: highest, coverage: none, with_coverage: false, allow-fail: true }

steps:
- name: "Checkout code"
uses: "actions/checkout@v2"
- name: "Checkout code"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "${{ matrix.coverage }}"
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
php-version: "${{ matrix.php-version }}"
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "${{ matrix.coverage }}"
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
php-version: "${{ matrix.php-version }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run Codeception"
env:
WITH_COVERAGE: "${{ matrix.with_coverage }}"
run: |
if [ "$WITH_COVERAGE" == false ]; then
vendor/bin/codecept run -c . -vvv --json
fi
- name: "Run Codeception with coverage"
env:
WITH_COVERAGE: "${{ matrix.with_coverage }}"
run: |
if [ "$WITH_COVERAGE" == true ]; then
vendor/bin/codecept run -c . -vvv --json --coverage --coverage-xml=coverage.xml
fi
- name: Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: /home/runner/work/ikea-tradfri-php/ikea-tradfri-php/tests/_output/coverage.xml # optional
flags: unittests # optional
fail_ci_if_error: "${{ matrix.with_coverage }}" # optional (default = false)
verbose: true # optional (default = false)
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run Codeception"
run: |
vendor/bin/codecept run -c . -vvv --json
45 changes: 45 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on: [ push, pull_request ]
name: Codecov

jobs:
codeception-tests:
name: "Codeception tests"
runs-on: "ubuntu-20.04"
continue-on-error: ${{ matrix.allow-fail }}
strategy:
matrix:
include:
# - { php-version: 7.4, dependencies: locked, coverage: none, with_coverage: false, allow-fail: false }
# - { php-version: 7.4, dependencies: highest, coverage: none, with_coverage: false, allow-fail: true }
# - { php-version: 8.0, dependencies: locked, coverage: none, with_coverage: false, allow-fail: false }
# - { php-version: 8.0, dependencies: highest, coverage: none, with_coverage: false, allow-fail: true }
- { php-version: 8.0, dependencies: locked, coverage: xdebug, with_coverage: true, allow-fail: false }
# - { php-version: 8.1, dependencies: highest, coverage: none, with_coverage: false, allow-fail: true }

steps:
- name: "Checkout code"
uses: "actions/checkout@v2"

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "${{ matrix.coverage }}"
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
php-version: "${{ matrix.php-version }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run Codeception with coverage"
run: |
vendor/bin/codecept run -c . -vvv --json --coverage --coverage-xml=coverage.xml
- name: Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./build/logs/coverage.xml
flags: unittests # optional
fail_ci_if_error: "${{ matrix.with_coverage }}" # optional (default = false)
verbose: true # optional (default = false)

0 comments on commit 4a61961

Please sign in to comment.