Skip to content
This repository was archived by the owner on May 6, 2023. It is now read-only.

Commit 368137c

Browse files
authored
Merge pull request #55 from szepeviktor/patch-2
Separate CI jobs
2 parents c20e79d + 4dcfe1f commit 368137c

File tree

2 files changed

+42
-40
lines changed

2 files changed

+42
-40
lines changed

.scrutinizer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ checks:
3636
tools:
3737
external_code_coverage:
3838
timeout: 600
39-
runs: 3
39+
runs: 1

.travis.yml

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,54 @@
11
########################################################################
2-
# This pipeline is executed on PHP 7.4:
3-
# - required for development
4-
# - required to run Rector, to generate the PHP 7.1-compatible code for production
2+
# TravisCI configuration for GraphQLAPI/graphql-api-for-wp
53
#
6-
# It uses the Build Environment "Xenial", because it has PHP 7.1 preinstalled,
7-
# so we can switch from the global PHP 7.4 to local PHP 7.1 through `phpenv`
4+
# There are 1+3 jobs.
85
#
9-
# There are 2 parallel executions, with env variable:
10-
# 1. DOWNGRADE_CODE="true"
11-
# 2. DOWNGRADE_CODE="false"
12-
#
13-
# When DOWNGRADE_CODE is "false", it is the standard testing pipeline:
14-
# Execute PHPCS, PHPUnit and PHPStan to check there are no issues, and generate report.
15-
#
16-
# When DOWNGRADE_CODE is "true", it tests the conversion of the PHP code version 7.4 to 7.1:
17-
# - Run Rector to downgrade the code
18-
# - Run PHPStan. If it exits with no errors, then downgrading the code works well.
19-
########################################################################
20-
dist: xenial
21-
language: php
6+
# 1. PHPUnit on PHP 7.4 required for development
7+
# 2. PHPCS on PHP 7.4
8+
# 3. PHPStan on PHP 7.4
9+
# 4. Run Rector to generate the PHP 7.1-compatible code for production
10+
# then PHPStan on PHP 7.1
11+
########################################################################
2212

23-
jobs:
24-
include:
25-
- php: 7.4
26-
env: DOWNGRADE_CODE=false
27-
- php: 7.4
28-
env: DOWNGRADE_CODE=true
13+
language: php
14+
os:
15+
- linux
16+
dist: bionic
2917

30-
## Cache composer
3118
cache:
3219
directories:
33-
- $HOME/.composer/cache
20+
- "${HOME}/.composer/cache"
21+
22+
php:
23+
- 7.4
24+
25+
jobs:
26+
include:
27+
# FIXME TravisCI should run the default job
28+
- name: "Tests"
29+
script:
30+
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
31+
- name: "PHPCS"
32+
script:
33+
- vendor/bin/phpcs -n --standard=PSR2 src/
34+
after_script: skip
35+
- name: "PHPStan"
36+
script:
37+
- vendor/bin/phpstan analyse -c phpstan.neon.dist src/
38+
after_script: skip
39+
- name: "Downgraded code"
40+
script:
41+
- vendor/bin/rector process
42+
- phpenv local 7.1
43+
- php --version
44+
- vendor/bin/phpstan analyse -c phpstan.neon.dist src/
45+
after_script: skip
3446

35-
before_script:
36-
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-dist
37-
# Downgrade the code to PHP 7.1 via Rector
38-
- if [[ "$DOWNGRADE_CODE" == "true" ]]; then vendor/bin/rector process; fi
47+
install:
48+
- travis_retry composer update --no-interaction --prefer-dist
3949

4050
script:
41-
# Tests only on PHP 7.4
42-
- if [[ "$DOWNGRADE_CODE" != "true" ]]; then vendor/bin/phpcs -n --standard=psr2 src/; fi
43-
- if [[ "$DOWNGRADE_CODE" != "true" ]]; then vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover; fi
44-
# Switch to PHP 7.1 to test if downgraded code works, then up again to 7.4
45-
- if [[ "$DOWNGRADE_CODE" == "true" ]]; then phpenv local 7.1; fi
46-
- if [[ "$DOWNGRADE_CODE" == "true" ]]; then php --version; fi
47-
- vendor/bin/phpstan analyse -c phpstan.neon.dist src
48-
- if [[ "$DOWNGRADE_CODE" == "true" ]]; then phpenv local 7.4; fi
49-
- if [[ "$DOWNGRADE_CODE" == "true" ]]; then php --version; fi
51+
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
5052

5153
after_script:
5254
- wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover

0 commit comments

Comments
 (0)