Skip to content

Commit d0d1c83

Browse files
committed
Add continues integration workflow
1 parent b237abf commit d0d1c83

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: "Continuous Integration"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
php-versions:
7+
description: "The PHP versions to use when running the job"
8+
default: '["7.4", "8.0", "8.1"]'
9+
required: false
10+
type: "string"
11+
php-extensions:
12+
description: "The php extensions to install, allowing composer to pass"
13+
default: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo"
14+
required: false
15+
type: "string"
16+
composer-root-version:
17+
description: "The version of the package being tested, in case of circular dependencies."
18+
required: false
19+
type: "string"
20+
composer-options:
21+
description: "Additional flags for the composer install command."
22+
default: "--prefer-dist"
23+
required: false
24+
type: "string"
25+
test-suite:
26+
description: "Test suite to run"
27+
default: "unit"
28+
required: false
29+
type: "string"
30+
31+
jobs:
32+
tests:
33+
name: "Tests"
34+
35+
runs-on: "ubuntu-latest"
36+
37+
strategy:
38+
matrix:
39+
php-version: "${{ fromJson(inputs.php-versions) }}"
40+
dependencies:
41+
- "lowest"
42+
- "locked"
43+
- "highest"
44+
45+
steps:
46+
- name: "Checkout"
47+
uses: "actions/checkout@v3"
48+
49+
- name: "Set up PHP"
50+
uses: "shivammathur/setup-php@2.18.0"
51+
with:
52+
coverage: "none"
53+
extensions: "${{ inputs.php-extensions }}"
54+
php-version: "${{ matrix.php-version }}"
55+
56+
- name: "Set COMPOSER_ROOT_VERSION"
57+
run: |
58+
echo "COMPOSER_ROOT_VERSION=${{ inputs.composer-root-version }}" >> $GITHUB_ENV
59+
if: "${{ inputs.composer-root-version }}"
60+
61+
- name: "Install dependencies with Composer"
62+
uses: "ramsey/composer-install@v1"
63+
with:
64+
dependency-versions: "${{ inputs.composer-dependencies }}"
65+
composer-options: "${{ inputs.composer-options }}"
66+
67+
- name: "Run tests with phpunit/phpunit"
68+
run: "vendor/bin/phpunit --colors=always --testsuite=${{ inputs.test-suite }}"

0 commit comments

Comments
 (0)