-
Notifications
You must be signed in to change notification settings - Fork 23
107 lines (91 loc) · 3.34 KB
/
tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: "Tests"
on:
push:
branches:
- "main"
- "master"
pull_request: null
schedule:
- cron: '0 0 1 * *'
jobs:
unit-tests:
runs-on: "ubuntu-latest"
name: "Unit Tests on PHP ${{ matrix.php }} and ${{ matrix.tools }}"
strategy:
fail-fast: false
matrix:
php:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"
tools: [ "composer" ]
dependency-versions: [ "highest" ]
include:
- php: "7.2"
tools: "composer:v2.0"
dependency-versions: "lowest"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
tools: "${{ matrix.tools }}"
- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependency-versions }}"
- name: "Validate composer.json"
run: "composer validate --strict --no-check-lock"
- name: "Run tests"
run: "vendor/bin/phpunit --group default"
e2e-tests:
runs-on: "ubuntu-latest"
name: "E2E Tests on PHP ${{ matrix.php }}"
strategy:
fail-fast: false
matrix:
php:
- "8.2"
- "8.3"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v3"
- name: "Setup PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
tools: "composer"
- name: "Correct bin plugin version for e2e scenarios (PR-only)"
if: github.event_name == 'pull_request'
run: find e2e -maxdepth 1 -mindepth 1 -type d -exec bash -c "cd {} && composer require --dev bamarni/composer-bin-plugin:dev-${GITHUB_SHA} --no-update" \;
- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"
- name: "Run tests"
run: "vendor/bin/phpunit --group e2e"
# This is a "trick", a meta task which does not change, and we can use in
# the protected branch rules as opposed to the E2E tests one above which
# may change regularly.
# This allows us to mark only this job as required instead of each individual
# ever-changing E2E tests.
validate-tests:
name: "Tests Status"
runs-on: "ubuntu-latest"
needs:
- "unit-tests"
- "e2e-tests"
if: "always()"
steps:
- name: "Successful run"
if: "${{ !(contains(needs.*.result, 'failure')) }}"
run: "exit 0"
- name: "Failing run"
if: "${{ contains(needs.*.result, 'failure') }}"
run: "exit 1"