Skip to content

Commit 8f1bab0

Browse files
authored
Add tests action (#3)
* ci: run pest on pull request and push * ci: add static analysis
1 parent bac264c commit 8f1bab0

File tree

5 files changed

+112
-7
lines changed

5 files changed

+112
-7
lines changed

.github/workflows/static.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Static Analysis
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
static:
9+
if: github.event_name != 'schedule' || github.repository == 'tapperphp/tapper'
10+
name: Static Analysis
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: true
15+
matrix:
16+
dependency-version: [prefer-lowest, prefer-stable]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: 8.3
26+
tools: composer:v2
27+
coverage: none
28+
29+
- name: Install Dependencies
30+
run: composer update --prefer-stable --no-interaction --no-progress --ansi
31+
32+
- name: Code Style
33+
run: composer test:lint

.github/workflows/tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
tests:
9+
if: github.event_name != 'schedule' || github.repository == 'tapperphp/tapper'
10+
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: true
14+
matrix:
15+
os: [ubuntu-latest, macos-latest]
16+
php: ["8.2", "8.3", "8.4"]
17+
dependency_version: [prefer-lowest, prefer-stable]
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.os }} - ${{ matrix.dependency_version }}
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
tools: composer:v2
30+
coverage: none
31+
32+
- name: Setup Matchers
33+
run: |
34+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
35+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
36+
37+
- name: Install PHP dependencies
38+
shell: bash
39+
run: composer update --${{ matrix.dependency_version }} --no-interaction --no-progress --ansi
40+
41+
- name: Unit Tests
42+
run: composer test:unit

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,9 @@
3535
},
3636
"bin": [
3737
"bin/tapper"
38-
]
38+
],
39+
"scripts": {
40+
"test:unit": "pest --compact",
41+
"test:lint": "pint --test"
42+
}
3943
}

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpunit.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
cacheDirectory=".phpunit.cache"
6+
executionOrder="depends,defects"
7+
shortenArraysForExportThreshold="10"
8+
requireCoverageMetadata="true"
9+
beStrictAboutCoverageMetadata="true"
10+
beStrictAboutOutputDuringTests="true"
11+
displayDetailsOnPhpunitDeprecations="true"
12+
failOnPhpunitDeprecation="true"
13+
failOnRisky="true"
14+
failOnWarning="true">
15+
<testsuites>
16+
<testsuite name="default">
17+
<directory>tests</directory>
18+
</testsuite>
19+
</testsuites>
20+
21+
<source ignoreIndirectDeprecations="true" restrictNotices="true" restrictWarnings="true">
22+
<include>
23+
<directory>src</directory>
24+
</include>
25+
</source>
26+
</phpunit>

0 commit comments

Comments
 (0)