-
-
Notifications
You must be signed in to change notification settings - Fork 93
147 lines (125 loc) · 3.86 KB
/
ci.yml
File metadata and controls
147 lines (125 loc) · 3.86 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: CI
on:
push:
pull_request:
env:
PHPSTAN_PHP_VERSION: "8.5"
COVERAGE_PHP_VERSION: "8.5"
jobs:
phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHPSTAN_PHP_VERSION }}
- name: Install composer dependencies
uses: ramsey/composer-install@v3
- name: Run PHPStan
run: vendor/bin/phpstan --no-progress
coding-standard:
name: Coding Standard
uses: brick/coding-standard/.github/workflows/coding-standard.yml@v4
with:
php-version: "8.2"
working-directory: "tools/ecs"
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
- "8.5"
calculator:
- GMP
- BCMath
- Native
deps:
- "highest"
include:
- php-version: "8.2"
calculator: GMP
deps: "lowest"
- php-version: "8.2"
calculator: BCMath
deps: "lowest"
- php-version: "8.2"
calculator: Native
deps: "lowest"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
- name: Install composer dependencies
uses: ramsey/composer-install@v3
with:
dependency-versions: ${{ matrix.deps }}
- name: Run PHPUnit
run: vendor/bin/phpunit
env:
CALCULATOR: ${{ matrix.calculator }}
if: ${{ matrix.php-version != env.COVERAGE_PHP_VERSION }}
- name: Run PHPUnit with coverage
run: vendor/bin/phpunit --coverage-clover clover.xml
env:
CALCULATOR: ${{ matrix.calculator }}
if: ${{ matrix.php-version == env.COVERAGE_PHP_VERSION }}
- name: Run PHPUnit with bcscale()
run: vendor/bin/phpunit
env:
CALCULATOR: BCMath
BCMATH_DEFAULT_SCALE: 8
if: ${{ matrix.calculator == 'BCMath' }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
if: ${{ matrix.php-version == env.COVERAGE_PHP_VERSION }}
phpunit-32bit:
name: PHPUnit (32-bit)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
calculator:
- GMP
- BCMath
- Native
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run PHPUnit with coverage
run: |
docker run --platform linux/386 --rm -i \
-v ${{ github.workspace }}:/app \
-w /app \
-e CI=true \
-e CALCULATOR=${{ matrix.calculator }} \
php:8.5-cli bash -e <<'EOF'
apt-get update
apt-get install -y unzip
if [ "$CALCULATOR" = "GMP" ]; then apt-get install -y libgmp-dev && docker-php-ext-install gmp > /dev/null; fi
if [ "$CALCULATOR" = "BCMath" ]; then docker-php-ext-install bcmath > /dev/null; fi
pecl install pcov > /dev/null
docker-php-ext-enable pcov
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
composer install --no-interaction
php -r 'echo "PHP_INT_SIZE=", PHP_INT_SIZE, "\n";'
php -r 'exit(PHP_INT_SIZE === 4 ? 0 : 1);'
vendor/bin/phpunit --coverage-clover clover.xml
EOF
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}