Skip to content

Commit 113fe0b

Browse files
authored
ci: run examples (#327)
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 71aefe5 commit 113fe0b

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/workflows/php.yml

+34
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,37 @@ jobs:
398398
src
399399
github
400400
phpmd.xml
401+
examples:
402+
name: Examples
403+
runs-on: ubuntu-latest
404+
timeout-minutes: 15
405+
steps:
406+
- name: Checkout
407+
# see https://github.com/actions/checkout
408+
uses: actions/checkout@v3
409+
- name: Setup PHP
410+
# see https://github.com/shivammathur/setup-php
411+
uses: shivammathur/setup-php@v2
412+
with:
413+
php-version: ${{ env.PHP_VERSION_LATEST }}
414+
tools: composer:v2
415+
coverage: none
416+
- name: Get composer cache directory
417+
id: composer-cache
418+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
419+
- name: Cache dependencies
420+
if: ${{ steps.composer-cache.outputs.dir }}
421+
# see https://github.com/actions/cache
422+
uses: actions/cache@v3
423+
with:
424+
path: ${{ steps.composer-cache.outputs.dir }}
425+
key: composer-${{ github.job }}-${{ runner.os }}-${{ hashFiles('composer.*', 'tools/phpmd/composer.*') }}
426+
restore-keys: |
427+
composer-${{ github.job }}-${{ runner.os }}-
428+
- name: Install dependencies
429+
run: composer install --no-dev --prefer-dist --no-interaction --no-progress
430+
- name: run all examples
431+
run: >
432+
find examples -type f -name '*.php' -print0
433+
| xargs -0 -L1 -t
434+
php -f

examples/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Examples
2+
3+
* [Build & Serialize](build_and_serialize.php)
4+
5+
----
6+
7+
see examples how to use data models in the [bom model data provider](../tests/_data/BomModelProvider.php)

0 commit comments

Comments
 (0)