-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Add GitHub action for testing and coverage reporting
- Loading branch information
Martin Adler
committed
Apr 27, 2023
1 parent
c4ced96
commit 4991709
Showing
4 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
tests: | ||
name: Tests (PHP ${{ matrix.php-version }}, Composer ${{ matrix.composer-version }} & ${{ matrix.dependencies }} dependencies) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-version: ["8.1", "8.2"] | ||
composer-version: ["2.1", "2.2", "2.3", "2.4", "2.5"] | ||
dependencies: ["highest", "lowest"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Prepare environment | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-version }} | ||
tools: composer:v${{ matrix.composer-version }} | ||
coverage: none | ||
|
||
# Install dependencies | ||
- name: Install Composer dependencies | ||
uses: ramsey/composer-install@v2 | ||
with: | ||
dependency-versions: ${{ matrix.dependencies }} | ||
|
||
# Run tests | ||
- name: Run tests | ||
run: composer test:unit | ||
|
||
coverage: | ||
name: Test coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# Prepare environment | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 8.1 | ||
tools: composer:v2 | ||
coverage: pcov | ||
|
||
# Install dependencies | ||
- name: Install Composer dependencies | ||
uses: ramsey/composer-install@v2 | ||
with: | ||
dependency-versions: highest | ||
|
||
# Run Unit tests | ||
- name: Build coverage directory | ||
run: mkdir -p .build/coverage | ||
- name: Run Unit tests with coverage | ||
run: composer test:coverage | ||
|
||
# Report coverage | ||
- name: Fix coverage path | ||
working-directory: .Build/coverage | ||
run: sed -i 's#/home/runner/work/project-builder/project-builder#${{ github.workspace }}#g' clover.xml | ||
- name: codecov report | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
directory: .build/coverage | ||
fail_ci_if_error: true | ||
verbose: true |
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
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
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