Skip to content

Commit 82952aa

Browse files
committed
Add testing on GitHub actions
1 parent 46cd78d commit 82952aa

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/ci.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
tests:
11+
if: "!contains(github.event.head_commit.message, 'skip ci')"
12+
name: PHP ${{ matrix.php-versions }} on ${{ matrix.os }}
13+
runs-on: ${{ matrix.os }}
14+
continue-on-error: ${{ matrix.php-versions >= '8.4' }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
php-versions: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
19+
os: [ubuntu-latest, windows-latest]
20+
21+
steps:
22+
- name: Configure git
23+
if: runner.os == 'Windows'
24+
run: git config --system core.autocrlf false; git config --system core.eol lf
25+
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
29+
- name: Set up PHP ${{ matrix.php-versions }}
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php-versions }}
33+
ini-values: date.timezone=Europe/Berlin
34+
35+
- name: Validate composer.json and composer.lock
36+
run: composer validate
37+
38+
- name: Get Composer Cache Directory
39+
id: composer-cache
40+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
41+
42+
- name: Cache dependencies
43+
uses: actions/cache@v4
44+
with:
45+
path: ${{ steps.composer-cache.outputs.dir }}
46+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
47+
restore-keys: ${{ runner.os }}-composer-
48+
49+
- name: Install dependencies
50+
run: >
51+
curl -sSL https://baltocdn.com/xp-framework/xp-runners/distribution/downloads/e/entrypoint/xp-run-8.8.0.sh > xp-run &&
52+
composer install --prefer-dist &&
53+
echo "vendor/autoload.php" > composer.pth &&
54+
echo "vendor/xp-framework/compiler/src/test/php" >> composer.pth
55+
56+
- name: Run test suite
57+
run: sh xp-run xp.test.Runner -r Dots src/test/php

0 commit comments

Comments
 (0)