Skip to content

Commit 070ac95

Browse files
Create ci.yml
1 parent 33e270a commit 070ac95

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
2+
name: CI
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
php-versions:
8+
description: 'The php versions to test as JSON array. Will be converted and used to create a matrix.'
9+
default: '["8.1"]'
10+
required: true
11+
type: string
12+
prefer-stability:
13+
description: 'The staibility of the packages to use. Will be converted and used to create a matrix.'
14+
default: '["prefer-lowest", "prefer-stable"]'
15+
required: true
16+
type: string
17+
test-command:
18+
description: 'The command to run for executing tests'
19+
default: 'composer ci-all'
20+
required: true
21+
type: string
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref_name }}
25+
cancel-in-progress: true
26+
27+
jobs:
28+
test:
29+
strategy:
30+
matrix:
31+
php-versions: ${{fromJSON(input.php-versions)}}
32+
prefer: ${{fromJSON(input.prefer-stability)}}
33+
name: Test with ${{ matrix.prefer }} dependency versions on PHP ${{ matrix.php-versions }}
34+
runs-on: ubuntu-latest
35+
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v2
39+
40+
- name: Setup PHP
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: ${{ matrix.php-versions }}
44+
coverage: xdebug
45+
46+
- name: Validate composer.json
47+
run: composer validate
48+
49+
- name: Get Composer Cache Directory
50+
id: composer-cache
51+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
52+
- name: Setup cache
53+
uses: actions/cache@v2
54+
with:
55+
path: ${{ steps.composer-cache.outputs.dir }}
56+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.prefer }}-
57+
restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
58+
59+
- name: Install dependencies
60+
if: steps.composer-cache.outputs.cache-hit != 'true'
61+
run: composer update --prefer-dist --no-ansi --no-interaction --no-progress --${{ matrix.prefer }}
62+
63+
- name: Run CI tools
64+
run: ${{inputs.test-command}}

0 commit comments

Comments
 (0)