Skip to content

Commit

Permalink
Merge pull request #137 from Dealerdirect/feature/switch-to-ghactions
Browse files Browse the repository at this point in the history
CI: Switch to GH Actions
  • Loading branch information
Potherca committed Aug 16, 2021
2 parents 5d4a7cc + 49a4e7b commit 7d5cb88
Show file tree
Hide file tree
Showing 9 changed files with 354 additions and 175 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Expand Up @@ -3,7 +3,6 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
.github export-ignore

CONTRIBUTING.md export-ignore
Expand Down
180 changes: 180 additions & 0 deletions .github/workflows/integrationtest.yml
@@ -0,0 +1,180 @@
---
name: Integration Test

on:
# Run on pushes to `master` and on all pull requests.
push:
branches:
- master
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
phpcs_version: ['dev-master']
phpcompat: ['composer']
experimental: [false]

include:
# Ensure a "highest" PHP/PHPCS build combination for PHPCS 2.x is included.
- php: '5.3'
phpcs_version: '2.9.2'
phpcompat: 'composer'
experimental: false

# Complement the matrix with build against the lowest supported PHPCS version
# for each PHP version.
- php: '8.0'
# Lowest PHPCS version on which PHP 8.0 is supported.
phpcs_version: '3.5.7'
phpcompat: 'composer'
experimental: false
- php: '7.4'
# Lowest PHPCS version on which PHP 7.4 is supported.
phpcs_version: '3.5.0'
phpcompat: 'composer'
experimental: false
- php: '7.3'
# Lowest PHPCS version on which PHP 7.3 is supported.
phpcs_version: '3.3.1'
phpcompat: 'composer'
experimental: false
- php: '7.2'
# Lowest PHPCS version on which PHP 7.2 is supported.
phpcs_version: '2.9.2'
phpcompat: 'composer'
experimental: false
- php: '7.1'
phpcs_version: '2.0.0'
phpcompat: '^7.0'
experimental: false
- php: '7.0'
phpcs_version: '2.0.0'
phpcompat: '^7.0'
experimental: false
- php: '5.6'
phpcs_version: '2.0.0'
phpcompat: '^7.0'
experimental: false
- php: '5.5'
phpcs_version: '2.0.0'
phpcompat: '^7.0'
experimental: false
- php: '5.4'
phpcs_version: '2.0.0'
phpcompat: '^7.0'
experimental: false
- php: '5.3'
phpcs_version: '2.0.0'
phpcompat: '^7.0'
experimental: false

# Additional builds against arbitrary interim PHPCS versions.
- php: '7.3'
phpcs_version: '3.5.3'
phpcompat: 'composer'
experimental: false
- php: '7.2'
phpcs_version: '3.2.3'
phpcompat: 'composer'
experimental: false
- php: '7.1'
phpcs_version: '3.1.1'
phpcompat: 'composer'
experimental: false
- php: '7.0'
phpcs_version: '3.4.2'
phpcompat: 'composer'
experimental: false
- php: '7.0'
phpcs_version: '2.2.0'
phpcompat: '^8.0'
experimental: false
- php: '5.6'
phpcs_version: '3.0.2'
phpcompat: 'composer'
experimental: false
- php: '5.6'
phpcs_version: '2.4.0'
phpcompat: 'composer'
experimental: false
- php: '5.5'
phpcs_version: '2.6.1'
phpcompat: 'composer'
experimental: false
- php: '5.4'
phpcs_version: '3.5.3'
phpcompat: 'composer'
experimental: false
- php: '5.4'
phpcs_version: '2.8.1'
phpcompat: 'composer'
experimental: false

# Experimental builds. These are allowed to fail.
- php: '8.1'
phpcs_version: 'dev-master'
phpcompat: 'composer'
experimental: true

- php: '8.0'
phpcs_version: '4.0.x-dev as 3.9.99'
phpcompat: 'composer'
experimental: true

name: "Integration test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"

continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- 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: 'Composer: set PHPCS version for tests'
run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"

# Install PHPCompatibility 7.x/8.x for PHPCS < 2.3.
- name: 'Composer: set PHPCompatibility version for tests (PHPCS < 2.3)'
if: ${{ matrix.phpcompat != 'composer' }}
run: composer require --dev --no-update --no-scripts phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: 'Install Composer dependencies'
uses: "ramsey/composer-install@v1"
with:
composer-options: --no-scripts --optimize-autoloader

# Rename the PHPCompatibility directory as PHPCompatibility 7.x wasn't fully compatible with Composer yet.
- name: 'Rename the PHPCompatibility directory (PHPCS < 2.2)'
if: ${{ matrix.phpcompat == '^7.0' }}
run: mv ./vendor/phpcompatibility/php-compatibility ./vendor/phpcompatibility/PHPCompatibility

- name: 'Install standards'
run: composer install-codestandards

- name: 'Show installed standards'
run: vendor/bin/phpcs -i

# Test that an external standard has been registered correctly by running it against the codebase on PHPCS < 2.3.
- name: 'Test the PHPCompatibility standard was installed succesfully (PHPCS < 2.3)'
if: ${{ matrix.phpcompat != 'composer' }}
run: ./vendor/bin/phpcs -ps ./src/ --standard=PHPCompatibility --sniffs=PHPCompatibility.PHP.DeprecatedFunctions --runtime-set testVersion ${{ matrix.php }}

# Test that an external standard has been registered correctly by running it against the codebase.
- name: 'Test the PHPCompatibility standard was installed succesfully (PHPCS >= 2.3)'
if: ${{ matrix.phpcompat == 'composer' }}
run: ./vendor/bin/phpcs -ps ./src/ --standard=PHPCompatibility --sniffs=PHPCompatibility.FunctionUse.RemovedFunctions --runtime-set testVersion ${{ matrix.php }}
1 change: 1 addition & 0 deletions .github/workflows/linting.yaml
Expand Up @@ -5,6 +5,7 @@ name: Linting jobs
on:
- push
- pull_request
- workflow_dispatch

jobs:
validate-composer:
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/phplint.yml
@@ -0,0 +1,38 @@
---
name: PHP Lint

# yamllint disable-line rule:truthy
on:
- push
- pull_request
# Allow manually triggering the workflow.
- workflow_dispatch

jobs:
phplint:
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.3', '5.6', '7.2', 'latest']

name: "PHP Lint: PHP ${{ matrix.php }}"

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
tools: cs2pr

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: Lint against parse errors
run: composer lint -- --checkstyle | cs2pr
85 changes: 85 additions & 0 deletions .github/workflows/quicktest.yml
@@ -0,0 +1,85 @@
---
name: Quicktest

on:
# Run on pushes to feature branches.
push:
branches-ignore:
- master
# Allow manually triggering the workflow.
workflow_dispatch:

jobs:
#### QUICK TEST STAGE ####
# This is a much quicker test which only runs the integration tests against a limited set of
# supported PHP/PHPCS combinations.
quicktest:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- php: 'latest'
phpcs_version: 'dev-master'
phpcompat: 'composer'
- php: '7.3'
phpcs_version: '2.9.2'
phpcompat: 'composer'
- php: '7.1'
phpcs_version: '3.3.1'
phpcompat: 'composer'
- php: '5.6'
phpcs_version: '2.6.0'
phpcompat: 'composer'
- php: '5.3'
phpcs_version: '2.0.0'
phpcompat: '^7.0'

name: "Quick test: PHP ${{ matrix.php }} - PHPCS ${{ matrix.phpcs_version }}"

steps:
- name: Checkout code
uses: actions/checkout@v2

- 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: 'Composer: set PHPCS version for tests'
run: composer require --no-update --no-scripts squizlabs/php_codesniffer:"${{ matrix.phpcs_version }}"

# Install PHPCompatibility 7.x/8.x for PHPCS < 2.3.
- name: 'Composer: set PHPCompatibility version for tests (PHPCS < 2.3)'
if: ${{ matrix.phpcompat != 'composer' }}
run: composer require --dev --no-update --no-scripts phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}"

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: 'Install Composer dependencies'
uses: "ramsey/composer-install@v1"
with:
composer-options: --no-scripts --optimize-autoloader

# Rename the PHPCompatibility directory as PHPCompatibility 7.x wasn't fully compatible with Composer yet.
- name: 'Rename the PHPCompatibility directory (PHPCS < 2.2)'
if: ${{ matrix.phpcompat == '^7.0' }}
run: mv ./vendor/phpcompatibility/php-compatibility ./vendor/phpcompatibility/PHPCompatibility

- name: 'Install standards'
run: composer install-codestandards

- name: 'Show installed standards'
run: vendor/bin/phpcs -i

# Test that an external standard has been registered correctly by running it against the codebase on PHPCS < 2.3.
- name: 'Test the PHPCompatibility standard was installed succesfully (PHPCS < 2.3)'
if: ${{ matrix.phpcompat != 'composer' }}
run: ./vendor/bin/phpcs -ps ./src/ --standard=PHPCompatibility --sniffs=PHPCompatibility.PHP.DeprecatedFunctions --runtime-set testVersion ${{ matrix.php }}

# Test that an external standard has been registered correctly by running it against the codebase.
- name: 'Test the PHPCompatibility standard was installed succesfully (PHPCS >= 2.3)'
if: ${{ matrix.phpcompat == 'composer' }}
run: ./vendor/bin/phpcs -ps ./src/ --standard=PHPCompatibility --sniffs=PHPCompatibility.FunctionUse.RemovedFunctions --runtime-set testVersion ${{ matrix.php }}
42 changes: 42 additions & 0 deletions .github/workflows/securitycheck.yml
@@ -0,0 +1,42 @@
---
name: Security check

# yamllint disable-line rule:truthy
on:
- push
- pull_request
# Allow manually triggering the workflow.
- workflow_dispatch

jobs:
security-check:
runs-on: ubuntu-latest
name: "Security check"

strategy:
matrix:
php: ['5.3', 'latest']

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none

# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-composer-dependencies
- name: Install Composer dependencies
uses: "ramsey/composer-install@v1"

- name: Download security checker
run: wget -P . https://github.com/fabpot/local-php-security-checker/releases/download/v1.0.0/local-php-security-checker_1.0.0_linux_amd64

- name: Make security checker executable
run: chmod +x ./local-php-security-checker_1.0.0_linux_amd64

- name: Check against insecure dependencies
run: ./local-php-security-checker_1.0.0_linux_amd64 --path=composer.lock

0 comments on commit 7d5cb88

Please sign in to comment.