-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (90 loc) · 3.51 KB
/
tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Tests
on:
workflow_dispatch:
push:
branches:
- "**"
pull_request:
types: [ ready_for_review, synchronize, opened ]
jobs:
tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'skip test')"
strategy:
fail-fast: true
matrix:
php-version: [ 8.1 ]
coverage-file: [ default ]
dependency-versions: [ lowest, highest ]
name: PHP ${{ matrix.php-version }} - ${{ matrix.dependency-versions }}
steps:
- name: Checkout project
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
tools: composer:v2, php-cs-fixer, phpunit
coverage: :coverage_value
- name: Setup Problem Matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
#- name: Add HTTP Basic Auth Credentials
# run: echo '${{ secrets.COMPOSER_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
- name: Install Composer Dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependency-versions }}
composer-options: "--optimize-autoloader --no-interaction --no-progress --no-suggest"
#- name: Remove auth.json File
# run: rm -f $GITHUB_WORKSPACE/auth.json
# <deleteCoverageElse> #
- name: Run Tests
run: composer test
# </deleteCoverageElse> #
# <deleteCoverage> #
- name: Run Tests (with Coverage)
run: vendor/bin/pest --colors=always --coverage-clover coverage/reports/${{ matrix.coverage-file }}-report.xml
# <deleteCodecov> #
- name: Upload Coverage
uses: actions/upload-artifact@v3
if: "github.repository_owner == ':vendor_name'"
with:
path: coverage/reports/${{ matrix.coverage-file }}-report.xml
# </deleteCodecov> #
# </deleteCoverage> #
# <deleteCoverage> #
# <deleteCodecov> #
coverage-upload:
if: "github.repository_owner == ':vendor_name' && !contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'skip test') && !contains(github.event.head_commit.message, 'skip coverage')"
needs: tests
runs-on: ubuntu-latest
name: Coverage Reports
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Coverage Files
uses: actions/download-artifact@v3
with:
path: coverage/reports
- name: Display Downloaded Coverage Files
run: ls -R
working-directory: coverage/reports
- name: Get Coverage Files
run: |
echo "::set-output name=COVERAGE_FILES::$(ls ./coverage/reports/artifact | sed -n '/-report.xml/s/.*/\.\/coverage\/reports\/artifact\/&/p' | xargs | sed -e 's/ /,/g')"
id: coverages
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS
fail_ci_if_error: true
files: ${{ steps.coverages.outputs.COVERAGE_FILES }}
flags: tests
name: codecov-umbrella
verbose: true
# </deleteCodecov> #
# </deleteCoverage> #