Repository navigation
202 lines (164 loc) · 6.17 KB
/
Copy pathtests.yml
File metadata and controls
202 lines (164 loc) · 6.17 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: Tests
on:
push:
branches: [ main ]
pull_request:
permissions:
contents: read
jobs:
verify-fixture:
name: Verify Test Fixture Bundle
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Verify fixture bundle integrity, refs and size
run: tests/fixtures/verify-bundle.sh
check-cs:
name: Check Coding Standards
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.4'
- name: Setup Castor
uses: castor-php/setup-castor@2a495b8c91f00be6768ad8a040ba8634c797d386 # v1.1.0
- name: Run CS check
run: castor cs --dry-run
check-archive:
name: Check the Archive
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Ship only the code, the docs and the license
run: diff <(git archive HEAD | tar -t | cut -d/ -f1 | sort -u) <(printf '%s\n' CHANGELOG.md LICENSE README.md UPGRADE-2.0.md composer.json doc src | sort)
phpstan:
name: Static Analysis
runs-on: ubuntu-24.04
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.4'
- name: Setup Castor
uses: castor-php/setup-castor@2a495b8c91f00be6768ad8a040ba8634c797d386 # v1.1.0
- name: Install dependencies
run: castor install
- name: Run PHPStan
run: castor phpstan
tests:
name: Test PHP ${{ matrix.php }} ${{ matrix.name }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['8.4', '8.5']
composer-flags: ['']
name: ['']
include:
- php: '8.4'
composer-flags: '--prefer-lowest'
name: '(prefer lowest dependencies)'
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php }}
- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Validate composer.json
run: composer validate --strict
- name: Install Composer dependencies
run: |
composer update --prefer-dist --no-interaction ${{ matrix.composer-flags }}
- name: Execute PHPUnit
run: vendor/bin/phpunit
tests-git:
name: Test git ${{ matrix.git }}
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
# The oldest supported git, and the one of Ubuntu 20.04: the other jobs test the latest one.
include:
- git: '1.8.4'
sha256: '5e0efe7cd30e258bc3be9ae023790743974e76eb1b24ecac24de6fc2af2b2786'
- git: '2.25.1'
sha256: 'aaef0cd609a7730cfbae530d7c91214a941d7e26054d2314cc99794880156b33'
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Cache git
id: cache-git
uses: actions/cache@v6
with:
path: ~/git
key: git-${{ matrix.git }}-ubuntu-24.04
- name: Build git
if: steps.cache-git.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://github.com/git/git/archive/refs/tags/v${{ matrix.git }}.tar.gz" -o git.tar.gz
echo "${{ matrix.sha256 }} git.tar.gz" | sha256sum --check
tar xzf git.tar.gz
make -C "git-${{ matrix.git }}" prefix="$HOME/git" CFLAGS='-std=gnu17 -O2' NO_OPENSSL=1 NO_CURL=1 NO_EXPAT=1 NO_GETTEXT=1 NO_PERL=1 NO_PYTHON=1 NO_TCLTK=1 --jobs="$(nproc)" install
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: '8.4'
- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Composer dependencies
run: composer update --prefer-dist --no-interaction
- name: Execute PHPUnit
run: GIT_COMMAND="$HOME/git/bin/git" vendor/bin/phpunit
tests-ffi:
name: Test PHP ${{ matrix.php }} (LibGit2Driver)
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['8.4', '8.5']
env:
# LibGit2Driver only supports libgit2 1.9, which Ubuntu 24.04 doesn't ship.
LIBGIT2_VERSION: '1.9.1'
LIBGIT2_SHA256: '14cab3014b2b7ad75970ff4548e83615f74d719afe00aa479b4a889c1e13fc00'
LIBGIT2_CMAKE_FLAGS: '-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_CLI=OFF -DUSE_HTTPS=OFF -DUSE_SSH=OFF'
steps:
- name: Checkout Code
uses: actions/checkout@v7
- name: Cache libgit2
id: cache-libgit2
uses: actions/cache@v6
with:
path: ~/libgit2
key: libgit2-${{ env.LIBGIT2_VERSION }}-${{ env.LIBGIT2_CMAKE_FLAGS }}-ubuntu-24.04
- name: Build libgit2
if: steps.cache-libgit2.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://github.com/libgit2/libgit2/archive/refs/tags/v${LIBGIT2_VERSION}.tar.gz" -o libgit2.tar.gz
echo "${LIBGIT2_SHA256} libgit2.tar.gz" | sha256sum --check
tar xzf libgit2.tar.gz
cmake -S "libgit2-${LIBGIT2_VERSION}" -B libgit2-build -DCMAKE_INSTALL_PREFIX="$HOME/libgit2" -DCMAKE_INSTALL_LIBDIR=lib $LIBGIT2_CMAKE_FLAGS
cmake --build libgit2-build --parallel
cmake --install libgit2-build
- name: Setup PHP
uses: shivammathur/setup-php@eb7c497e18156a6bbabfef1d3a82760b9eda3962 # 2.40.0
with:
php-version: ${{ matrix.php }}
extensions: ffi
- name: Setup Problem Matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Composer dependencies
run: composer update --prefer-dist --no-interaction
- name: Execute PHPUnit
run: LD_LIBRARY_PATH="$HOME/libgit2/lib" vendor/bin/phpunit
env:
GITLIB_DRIVER: ffi