Skip to content

Commit 52c539e

Browse files
committed
chore: set up test workflow on github
1 parent 7828a35 commit 52c539e

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

.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+
branches: [master]
6+
7+
pull_request:
8+
branches: [master]
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
tests:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 7.2
23+
24+
- name: Validate composer.json and composer.lock
25+
run: composer validate --strict
26+
27+
- name: Cache Composer packages
28+
id: composer-cache
29+
uses: actions/cache@v3
30+
with:
31+
path: vendor
32+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-php-
35+
36+
- name: Install dependencies
37+
run: |
38+
composer require "orchestra/testbench"
39+
composer install --prefer-dist --no-progress
40+
41+
- name: Run test suite
42+
run: composer run-script test

composer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@
1919
"illuminate/config": "5.*|6.*|7.*|8.*|9.*"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^7.0"
22+
"phpunit/phpunit": "^7.0",
23+
"orchestra/testbench": "3.8"
2324
},
2425
"autoload": {
2526
"psr-4": {
2627
"October\\Rain\\Config\\": "src/"
2728
}
2829
},
30+
"scripts": {
31+
"test": "vendor/bin/phpunit"
32+
},
2933
"extra": {
3034
"laravel": {
3135
"providers": [

phpunit.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Test">
9+
<directory suffix="Test.php">./tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<filter>
13+
<whitelist>
14+
<directory suffix=".php">src</directory>
15+
</whitelist>
16+
</filter>
17+
</phpunit>

0 commit comments

Comments
 (0)