-
Notifications
You must be signed in to change notification settings - Fork 3
127 lines (114 loc) · 3.42 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
name: Tests
on:
push:
branches:
- main
- develop
pull_request:
branches:
- '**'
jobs:
tests:
name: Tests (PHP ${{ matrix.php-version }} & ${{ matrix.dependencies }} dependencies)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version: ["8.1", "8.2", "8.3"]
dependencies: ["locked", "highest", "lowest"]
# @todo Remove once PHP 8.3 is released as stable version
include:
- php-version: "8.3"
experimental: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: none
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: ${{ matrix.experimental && '--ignore-platform-req=php' }}
# Run tests
- name: Run tests
run: composer test
coverage:
name: Test coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
coverage: pcov
# Install dependencies
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
# Run tests
- name: Build coverage directory
run: mkdir -p .build/coverage
- name: Run tests with coverage
run: composer test:coverage
# Report coverage
- name: Fix coverage path
working-directory: .build/coverage
run: sed -i 's#/home/runner/work/frontend-asset-handler/frontend-asset-handler#${{ github.workspace }}#g' clover.xml
- name: CodeClimate report
uses: paambaati/[email protected]
if: env.CC_TEST_REPORTER_ID
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{ github.workspace }}/.build/coverage/clover.xml:clover
- name: codecov report
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: .build/coverage
fail_ci_if_error: true
verbose: true
e2e:
name: Tests (E2E)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Prepare environment
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2, phive
# Compile PHAR
- name: Install box
run: phive install --trust-gpg-keys 2DF45277AEF09A2F humbug/box
- name: Install Composer dependencies
uses: ramsey/composer-install@v2
with:
composer-options: "--no-dev"
- name: Compile PHAR
run: ./tools/box compile
# Run test with PHAR
- name: Test PHAR
run: |
.build/frontend-asset-handler.phar init \
--source-type=http \
--source-url=https://www.example.com \
--target-type=archive \
--target-path=.build/assets \
--handler-type=default