Skip to content

Commit 2abb23e

Browse files
authored
Merge pull request #274 from kenjis/update-workflows-phpunit.yml
chore: add language unit tests
2 parents d234619 + 0f5fe5e commit 2abb23e

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

.github/workflows/phpunit-lang.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Language Unit Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- develop
7+
paths:
8+
- 'src/Language/**.php'
9+
- '!src/Language/en/**.php'
10+
- 'phpunit*'
11+
- '.github/workflows/phpunit-lang.yml'
12+
push:
13+
branches:
14+
- develop
15+
paths:
16+
- 'src/Language/**.php'
17+
- '!src/Language/en/**.php'
18+
- 'phpunit*'
19+
- '.github/workflows/phpunit-lang.yml'
20+
21+
jobs:
22+
main:
23+
name: Language Unit Tests
24+
runs-on: ubuntu-latest
25+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v3
30+
31+
- name: Set up PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: '8.1'
35+
tools: composer, phive, phpunit
36+
extensions: intl, json, mbstring, gd, xdebug, xml, sqlite3
37+
coverage: xdebug
38+
env:
39+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Get composer cache directory
42+
id: composer-cache
43+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
44+
45+
- name: Cache composer dependencies
46+
uses: actions/cache@v3
47+
with:
48+
path: ${{ steps.composer-cache.outputs.dir }}
49+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ hashFiles('**/composer.lock') }}
50+
restore-keys: ${{ runner.os }}-composer-
51+
52+
- name: Install dependencies
53+
run: |
54+
if [ -f composer.lock ]; then
55+
composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
56+
else
57+
composer update --no-progress --no-interaction --prefer-dist --optimize-autoloader
58+
fi
59+
60+
- name: Test with PHPUnit
61+
run: vendor/bin/phpunit --verbose --no-coverage --testsuite lang
62+
env:
63+
TERM: xterm-256color
64+
TACHYCARDIA_MONITOR_GA: enabled

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<directory>./tests</directory>
4242
<exclude>./tests/Language</exclude>
4343
</testsuite>
44-
<testsuite name="language">
44+
<testsuite name="lang">
4545
<directory>./tests/Language</directory>
4646
</testsuite>
4747
</testsuites>

0 commit comments

Comments
 (0)