Skip to content

Commit 71356c6

Browse files
committed
Migrate to GitHub Actions
1 parent dbadf07 commit 71356c6

File tree

5 files changed

+125
-33
lines changed

5 files changed

+125
-33
lines changed

.github/workflows/coverage.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.3']
17+
setup: ['stable']
18+
19+
name: PHP
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
coverage: pcov
30+
31+
- name: Cache Composer packages
32+
id: composer-cache
33+
uses: actions/cache@v4
34+
with:
35+
path: vendor
36+
key: ${{ runner.os }}-${{ matrix.setup }}-coverage-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-${{ matrix.setup }}-coverage-${{ matrix.php }}-
39+
40+
- name: Code Climate Test Reporter Preparation
41+
run: |
42+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
43+
chmod +x ./cc-test-reporter
44+
./cc-test-reporter before-build
45+
env:
46+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
47+
48+
- name: Install dependencies
49+
if: steps.composer-cache.outputs.cache-hit != 'true'
50+
run: |
51+
${{ matrix.php >= 7.2 && matrix.php < 8 && matrix.setup == 'lowest' && 'composer require --no-update "phpunit/phpunit:^5.7.27||^6.5.14||^7.5.20" --dev --no-interaction;' || '' }}
52+
${{ matrix.php >= 8 && 'composer require --no-update phpunit/phpunit:^8.5.33 --dev --no-interaction && composer require --no-update phug/phug:^1.9.0 --no-interaction;' || '' }}
53+
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress
54+
55+
- name: Run test suite
56+
run: vendor/bin/phug-dev check --report --coverage-php-version=${{ matrix.php }}
57+
58+
- name: Coverage
59+
uses: codecov/codecov-action@v3
60+
61+
- name: Code Climate Test Reporter
62+
if: ${{ env.CC_TEST_REPORTER_ID != '' }}
63+
run: |
64+
cp coverage.xml clover.xml
65+
bash <(curl -s https://codecov.io/bash)
66+
env:
67+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

.github/workflows/tests.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['5.5', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
17+
setup: ['lowest', 'stable']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v4
33+
with:
34+
path: vendor
35+
key: ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
run: |
42+
${{ matrix.php >= 7.2 && matrix.php < 8 && matrix.setup == 'lowest' && 'composer require --no-update "phpunit/phpunit:^5.7.27||^6.5.14||^7.5.20" --dev --no-interaction;' || '' }}
43+
${{ matrix.php >= 8 && 'composer require --no-update phpunit/phpunit:^8.5.33 --dev --no-interaction && composer require --no-update phug/phug:^1.9.0 --no-interaction;' || '' }}
44+
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress --no-interaction
45+
env:
46+
MULTI_TESTER_LABELS: install
47+
48+
- name: Run test suite
49+
run: vendor/bin/phug-dev check --report
50+
env:
51+
MULTI_TESTER_LABELS: script

.travis.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "MIT",
77
"homepage": "https://phug-lang.com",
88
"require": {
9-
"phug/phug": "^0.1.8 || ^0.2.0 || ^0.3.0 || ^1.0",
9+
"phug/phug": "^0.1.8 || ^0.2.0 || ^0.3.0 || ^1.0 || ^2.0",
1010
"js-transformer/js-transformer": "^1.0"
1111
},
1212
"require-dev": {
@@ -22,5 +22,10 @@
2222
"npm-confirm": {
2323
"jstransformer": "It allows you to use any jstransformer npm package as filter by adding it in your extra.npm section of composer.json."
2424
}
25+
},
26+
"config": {
27+
"allow-plugins": {
28+
"nodejs-php-fallback/nodejs-php-fallback": true
29+
}
2530
}
2631
}

tests/Phug/JsTransformerExtensionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ protected static function removeDirectory($dir)
2323
static::removeDirectory($dir.'/'.$object);
2424
continue;
2525
}
26+
2627
// move before delete to avoid Windows too long name error
2728
try {
2829
@rename($dir.'/'.$object, sys_get_temp_dir().'/to-delete');

0 commit comments

Comments
 (0)