-
-
Notifications
You must be signed in to change notification settings - Fork 3
155 lines (127 loc) · 6.04 KB
/
ci.yml
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
148
149
150
151
152
153
154
155
name: CI
on:
# Run on pushes to `master` and on all pull requests.
push:
branches:
- master
pull_request:
# Also run this workflow on day 15 of every month as the repo isn't that active.
schedule:
- cron: '0 0 15 * *'
# Allow manually triggering the workflow.
workflow_dispatch:
jobs:
xmllint:
name: 'Check XML'
runs-on: ubuntu-latest
env:
XMLLINT_INDENT: ' '
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 'latest'
coverage: none
# Install dependencies to make sure the PHPCS XSD file is available.
- name: Install dependencies
run: composer install --no-dev --no-interaction --no-progress
# Updating the lists can fail intermittently, typically after Microsoft has released a new package.
# This should not be blocking for this job, so ignore any errors from this step.
# Ref: https://github.com/dotnet/core/issues/4167
- name: Update the available packages list
continue-on-error: true
run: sudo apt-get update
- name: Install xmllint
run: sudo apt-get install --no-install-recommends -y libxml2-utils
# Show violations inline in the file diff.
# @link https://github.com/marketplace/actions/xmllint-problem-matcher
- name: Enable showing XML issues inline
uses: korelstar/xmllint-problem-matcher@v1
# Validate the xml file.
# @link http://xmlsoft.org/xmllint.html
- name: Validate against schema
run: xmllint --noout --schema vendor/squizlabs/php_codesniffer/phpcs.xsd ./*/ruleset.xml
# Check the code-style consistency of the xml file.
- name: Check code style
run: |
diff -B ./PHPCompatibilityParagonieRandomCompat/ruleset.xml <(xmllint --format "./PHPCompatibilityParagonieRandomCompat/ruleset.xml")
diff -B ./PHPCompatibilityParagonieSodiumCompat/ruleset.xml <(xmllint --format "./PHPCompatibilityParagonieSodiumCompat/ruleset.xml")
test:
needs: xmllint
runs-on: ubuntu-latest
strategy:
matrix:
include:
# Sodium Compat 1.x is compatible with PHP 5.3 - current.
- php: '5.4'
phpcompat: 'stable'
sodium: '1'
experimental: false
- php: 'latest'
phpcompat: 'stable'
sodium: '1'
experimental: false
# Sodium Compat 2.x (master) is compatible with PHP 8.1 - current.
- php: '8.1'
phpcompat: 'stable'
sodium: 'dev'
experimental: false
- php: 'latest'
phpcompat: 'stable'
sodium: 'dev'
experimental: false
# Experimental builds against PHPCompatibility 10.
- php: '7.4'
phpcompat: 'dev-develop as 9.99.99'
sodium: '1'
experimental: true
- php: '8.1'
phpcompat: 'dev-develop as 9.99.99'
sodium: 'dev'
experimental: true
name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat != 'stable' && ' dev' || 'stable' }} - Sodium ${{ matrix.sodium }}"
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL, display_errors=On
coverage: none
- name: Conditionally update PHPCompatibility to develop version
if: ${{ matrix.phpcompat != 'stable' }}
run: |
composer config minimum-stability dev
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" --no-interaction
- name: Conditionally update Sodium Compat
if: ${{ matrix.sodium != 'dev' }}
run: |
composer require --no-update paragonie/sodium_compat:"^${{ matrix.sodium }}.0" --no-interaction
- name: Install dependencies
run: composer install --no-interaction --no-progress
# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict
# Make sure that known polyfills don't trigger any errors.
- name: Test the RandomCompat ruleset
run: vendor/bin/phpcs -ps ./Test/ParagonieRandomCompatTest.php --standard=PHPCompatibilityParagonieRandomCompat --runtime-set testVersion 5.2-
- name: "Test the SodiumCompat ruleset (1.x)"
if: ${{ matrix.sodium != 'dev' }}
run: vendor/bin/phpcs -ps ./Test/ParagonieSodiumCompatTest.php --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 5.3-
- name: "Test the SodiumCompat ruleset (2.x)"
if: ${{ matrix.sodium == 'dev' }}
run: vendor/bin/phpcs -ps ./Test/ParagonieSodiumCompatTest.php --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 8.1-
# Check that the rulesets don't throw unnecessary errors for the compat libraries themselves.
- name: Test running against the RandomCompat polyfills
run: vendor/bin/phpcs -ps ./vendor/paragonie/random_compat/ --standard=PHPCompatibilityParagonieRandomCompat --runtime-set testVersion 5.2- --ignore=/random_compat/psalm-autoload.php,/random_compat/phpunit-autoload.php,/random_compat/tests/*,/random_compat/other/*
- name: "Test running against the SodiumCompat polyfills (1.x)"
if: ${{ matrix.sodium != 'dev' }}
run: vendor/bin/phpcs -ps ./vendor/paragonie/sodium_compat/ --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 5.3- --ignore=/sodium_compat/tests/*
- name: "Test running against the SodiumCompat polyfills (2.x)"
if: ${{ matrix.sodium == 'dev' }}
run: vendor/bin/phpcs -ps ./vendor/paragonie/sodium_compat/ --standard=PHPCompatibilityParagonieSodiumCompat --runtime-set testVersion 8.1- --ignore=/sodium_compat/tests/*