Skip to content
This repository was archived by the owner on Oct 17, 2023. It is now read-only.

Commit 69094e6

Browse files
Test Github Actions (#1)
1 parent 1cf9cda commit 69094e6

File tree

3 files changed

+41
-24
lines changed

3 files changed

+41
-24
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1=1

.github/workflows/unit.yml

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,52 @@ on:
99

1010
concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
12-
cancel-in-progress: ${{ github.ref != refs/heads/master }}
12+
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
1313

1414

1515
jobs:
16-
setup:
17-
name: Checkout & Restore Cache
16+
phpunit:
1817
runs-on: ubuntu-latest
19-
outputs:
20-
cache: ${{ steps.cache.outputs.cache-hit }}
18+
strategy:
19+
matrix:
20+
directory: [core, api]
2121

2222
steps:
2323
- uses: actions/checkout@v2
24+
25+
- name: Get composer cache directory
26+
id: composer-cache
27+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
28+
2429
- name: Cache Composer dependencies
2530
uses: actions/cache@v2
2631
id: cache
2732
with:
28-
path: /tmp/composer-cache
29-
key: ${{ runner.os }}-${{ hashFiles('./api/composer.lock') }}-${{ hashFiles('./core/composer.lock') }}
30-
31-
install:
32-
name: Install Dependencies
33-
runs-on: ubuntu-latest
34-
# if: ${{ needs.setup.outputs.cache }} != 'true'
35-
needs: setup
36-
strategy:
37-
matrix:
38-
directory:
39-
- core
40-
- api
33+
path: ${{ steps.composer-cache.outputs.dir }}
34+
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
4135

42-
steps:
43-
- name: Install ${{ matrix.directory }} dependencies
44-
uses: php-actions/composer@v6
36+
- name: Setup PHP
37+
uses: shivammathur/setup-php@v2
4538
with:
46-
php_version: "7.4"
47-
working_dir: ./${{ matrix.directory }}
39+
php-version: '7.4'
40+
# coverage: pcov
41+
tools: composer:v2
42+
43+
- name: Install dependencies (Cached) for ${{ matrix.directory }}
44+
working-directory: ./${{ matrix.directory }}
45+
run: composer install
46+
47+
- name: Install dependencies (No Cache) for ${{ matrix.directory }}
48+
working-directory: ./${{ matrix.directory }}
49+
run: composer install --no-cache
50+
51+
- name: Run PHPUnit tests
52+
working-directory: ./${{ matrix.directory }}
53+
run: vendor/bin/phpunit
54+
55+
# vendor/bin/phpunit --coverage-clover=${{ matrix.directory }}-coverage.xml
56+
57+
# - name: Send code coverage report to Codecov.io
58+
# uses: codecov/codecov-action@v2
59+
# with:
60+
# token: ${{ secrets.CODECOV_TOKEN }}

api/phpunit.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
</include>
77
</coverage>
88
<testsuites>
9-
<testsuite name="Project Test Suite">
9+
<testsuite name="api-testsuite-1">
10+
<directory>./tests</directory>
11+
</testsuite>
12+
<testsuite name="api-testsuite-2">
1013
<directory>./tests</directory>
1114
</testsuite>
1215
</testsuites>

0 commit comments

Comments
 (0)