Skip to content

Commit 4bb529f

Browse files
committedFeb 9, 2021
Run unit tests via github actions
1 parent e84017b commit 4bb529f

File tree

5 files changed

+63
-5
lines changed

5 files changed

+63
-5
lines changed
 

‎.coveralls.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
coverage_clover: ./logs/coverage-clover.xml
1+
coverage_clover: ./logs/clover.xml
22
json_path: ./logs/coveralls-upload.json

‎.github/workflows/php.yaml

+56
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,59 @@ jobs:
3636
- uses: gaurav-nelson/github-action-markdown-link-check@v1
3737
with:
3838
use-verbose-mode: 'yes'
39+
40+
unit-tests:
41+
name: "Unit tests"
42+
runs-on: ubuntu-latest
43+
44+
strategy:
45+
matrix:
46+
php-version: ['5.6', '7.1', '7.2', '7.3', '7.4']
47+
dependencies: ['']
48+
include:
49+
- { php-version: '5.6', dependencies: '--prefer-lowest' }
50+
- { php-version: '8.0', dependencies: '--ignore-platform-req=php' }
51+
52+
steps:
53+
- uses: actions/checkout@v2
54+
55+
- name: Setup PHP
56+
uses: shivammathur/setup-php@v2
57+
with:
58+
php-version: ${{ matrix.php-version }}
59+
extensions: mbstring, intl, zip
60+
coverage: xdebug
61+
ini-values: ${{ matrix.xdebug-ini-values }}
62+
tools: composer:v2
63+
64+
- name: Install dependencies
65+
run: composer update --no-interaction ${{ matrix.dependencies }}
66+
67+
- name: Apply PHPUnit patches
68+
if: ${{ matrix.php-version < 7.2 }}
69+
run: scripts/apply-phpunit-patches.sh
70+
71+
- name: Run tests
72+
run: vendor/bin/phpunit --testsuite unit --colors=always --coverage-clover ./logs/clover.xml
73+
74+
- name: Submit coverage to Coveralls
75+
# We use php-coveralls library for this, as the official Coveralls GitHub Action lacks support for clover reports:
76+
# https://github.com/coverallsapp/github-action/issues/15
77+
env:
78+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
COVERALLS_PARALLEL: true
80+
COVERALLS_FLAG_NAME: ${{ github.job }}-PHP-${{ matrix.php-version }} ${{ matrix.dependencies }}
81+
run: |
82+
composer global require php-coveralls/php-coveralls
83+
~/.composer/vendor/bin/php-coveralls -v
84+
85+
tests-finished:
86+
name: Tests finished
87+
needs: [unit-tests]
88+
runs-on: ubuntu-latest
89+
steps:
90+
- name: Notify Coveralls
91+
uses: coverallsapp/github-action@master
92+
with:
93+
github-token: ${{ secrets.GITHUB_TOKEN }}
94+
parallel-finished: true

‎.github/workflows/sauce-labs.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
include:
19+
# # Firefox 47 is the last Firefox with OSS protocol support
1920
- { name: "Firefox 47, OSS protocol", BROWSER_NAME: "firefox", VERSION: "47.0", PLATFORM: "Windows 10", DISABLE_W3C_PROTOCOL: "1", tunnel-id: "gh-1" }
20-
- { name: "Chrome 74, OSS protocol", BROWSER_NAME: "chrome", VERSION: "74.0", PLATFORM: "Windows 10", DISABLE_W3C_PROTOCOL: "1", tunnel-id: "gh-2" } # 74 is the last version which don't use W3C WebDriver by default
21+
# Chrome 74 is the last version which doesn't use W3C WebDriver by default and rather use OSS protocol
22+
- { name: "Chrome 74, OSS protocol", BROWSER_NAME: "chrome", VERSION: "74.0", PLATFORM: "Windows 10", DISABLE_W3C_PROTOCOL: "1", tunnel-id: "gh-2" }
2123
- { name: "Chrome latest, W3C protocol", BROWSER_NAME: "chrome", VERSION: "latest", PLATFORM: "Windows 10", tunnel-id: "gh-3" }
2224
- { name: "Edge latest, W3C protocol", BROWSER_NAME: "MicrosoftEdge", VERSION: "latest", PLATFORM: "Windows 10", tunnel-id: "gh-4" }
2325

@@ -58,7 +60,7 @@ jobs:
5860
if [ "$BROWSER_NAME" = "firefox" ]; then EXCLUDE_GROUP+="exclude-firefox,"; fi
5961
if [ "$BROWSER_NAME" = "chrome" ]; then EXCLUDE_GROUP+="exclude-chrome,"; fi
6062
if [ -n "$EXCLUDE_GROUP" ]; then EXTRA_PARAMS+=" --exclude-group $EXCLUDE_GROUP"; fi
61-
./vendor/bin/phpunit --coverage-clover ./logs/coverage-clover.xml $EXTRA_PARAMS
63+
./vendor/bin/phpunit --testsuite functional --coverage-clover ./logs/coverage-clover.xml $EXTRA_PARAMS
6264
6365
- name: Print logs
6466
if: ${{ always() }}

‎.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ script:
133133
- if [ "$BROWSER_NAME" = "chrome" ]; then EXCLUDE_GROUP+="exclude-chrome,"; fi
134134
- if [ "$BROWSER_NAME" = "htmlunit" ]; then EXCLUDE_GROUP+="exclude-htmlunit,"; fi
135135
- if [ -n "$EXCLUDE_GROUP" ]; then EXTRA_PARAMS+=" --exclude-group $EXCLUDE_GROUP"; fi
136-
- ./vendor/bin/phpunit --coverage-clover ./logs/coverage-clover.xml $EXTRA_PARAMS
136+
- ./vendor/bin/phpunit --coverage-clover ./logs/clover.xml $EXTRA_PARAMS
137137

138138
after_script:
139139
- if [ -f ./logs/selenium.log ]; then cat ./logs/selenium.log; fi

‎scripts/apply-phpunit-patches.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ sed -i '/<listeners>/,+2d' phpunit.xml.dist;
1717
sed -i 's/function runBare(): void/function runBare()/g' tests/functional/WebDriverTestCase.php;
1818

1919
# Return back to original dir
20-
cd - > /dev/null
20+
cd - > /dev/null

0 commit comments

Comments
 (0)