Skip to content

Commit

Permalink
Merge pull request #66 from phiHero/master
Browse files Browse the repository at this point in the history
run test in github actions on push, pr
  • Loading branch information
jasonbosco authored Jun 18, 2024
2 parents 3353573 + 546ef3b commit d0ce46c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: tests

on: [push, pull_request]

jobs:
test:
name: Run tests with PHP v8.3
runs-on: ubuntu-latest
services:
typesense:
image: typesense/typesense:26.0
ports:
- 8108:8108/tcp
volumes:
- /tmp/typesense-server-data:/data
env:
TYPESENSE_DATA_DIR: /data
TYPESENSE_API_KEY: xyz
TYPESENSE_ENABLE_CORS: true
steps:
- uses: actions/checkout@v4
- name: Setup PHP 8.3
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
coverage: xdebug
- uses: php-actions/composer@v6
- name: Run tests
run: vendor/bin/phpunit --coverage-text
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@
"preferred-install": {
"*": "dist"
},
"sort-packages": true
"allow-plugins": {
"php-http/discovery": true
}
},
"scripts": {
"typesenseServer": [
Expand Down
22 changes: 18 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
columns="max"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnDeprecation="true"
failOnWarning="true"
failOnNotice="true"
failOnRisky="true"
>
<testsuites>
<testsuite name="feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>

<source>
<include>
<directory>src</directory>
</include>
</source>

<php>
<env name="TYPESENSE_NODE_HOST" value="host.docker.internal" />
<env name="TYPESENSE_NODE_HOST" value="localhost" />
<env name="TYPESENSE_NODE_PORT" value="8108" />
<env name="TYPESENSE_NODE_PROTOCOL" value="http" />
<env name="TYPESENSE_API_KEY" value="xyz" />
</php>
</phpunit>
</phpunit>

0 comments on commit d0ce46c

Please sign in to comment.