Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/ci-cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI Cronjob

on:
# Run this workflow on day 15 of every month as the repo isn't that active.
schedule:
- cron: '0 0 15 * *'

permissions: {}

jobs:
QA:
# Don't run the cron job on forks.
if: ${{ github.event.repository.fork == false }}

uses: ./.github/workflows/reusable-qa-checks.yml
105 changes: 2 additions & 103 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,112 +6,11 @@ on:
branches:
- master
pull_request:
# Also run this workflow on day 15 of every month as the repo isn't that active.
schedule:
- cron: '0 0 15 * *'
# Allow manually triggering the workflow.
workflow_dispatch:

permissions: {}

jobs:
xmllint:
# Don't run the cron job on forks.
if: ${{ github.event_name != 'schedule' || github.event.repository.fork == false }}

name: 'Check XML'
runs-on: ubuntu-latest

env:
XMLLINT_INDENT: ' '

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: Install PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
with:
php-version: 'latest'
coverage: none

# Install dependencies to make sure the PHPCS XSD file is available.
- name: Install dependencies
run: composer install --no-dev --no-interaction --no-progress

- name: Validate Ruleset XML file against schema
uses: phpcsstandards/xmllint-validate@0fd9c4a9046055f621fca4bbdccb8eab1fd59fdc # v1.0.1
with:
pattern: "./*/ruleset.xml"
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"

# Check the code-style consistency of the xml file.
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner.
- name: Check code style
run: |
diff -B ./PHPCompatibilityPasswordCompat/ruleset.xml <(xmllint --format "./PHPCompatibilityPasswordCompat/ruleset.xml")

test:
# Don't run the cron job on forks.
if: ${{ github.event_name != 'schedule' || github.event.repository.fork == false }}

needs: xmllint
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.4', 'latest']
phpcompat: ['stable']
experimental: [false]

include:
- php: '7.4'
phpcompat: 'dev-develop as 10.99.99'
experimental: true

name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}"
continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: Install PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL, display_errors=On, display_startup_errors=On
coverage: none

- name: Conditionally update PHPCompatibility to develop version
if: ${{ matrix.phpcompat != 'stable' }}
run: |
composer config minimum-stability dev
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" --no-interaction

- name: Install dependencies
run: composer install --no-interaction --no-progress

# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict

# Make sure that known polyfills don't trigger any errors.
- name: Test the ruleset
run: >
vendor/bin/phpcs -ps ./Test/PasswordCompatTest.php --standard=PHPCompatibilityPasswordCompat
--exclude=PHPCompatibility.Upgrade.LowPHP
--runtime-set testVersion 5.4-

# Check that the ruleset doesn't throw unnecessary errors for the compat library itself.
- name: Test running against the polyfills
run: >
vendor/bin/phpcs -ps ./vendor/ircmaxell/ --standard=PHPCompatibilityPasswordCompat
--exclude=PHPCompatibility.Upgrade.LowPHP
--ignore=/password-compat/test/*
--runtime-set testVersion 5.4-
QA:
uses: ./.github/workflows/reusable-qa-checks.yml
102 changes: 102 additions & 0 deletions .github/workflows/reusable-qa-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: CI

on:
workflow_call:

permissions: {}

jobs:
xmllint:
name: 'Check XML'
runs-on: ubuntu-latest

env:
XMLLINT_INDENT: ' '

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: Install PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
with:
php-version: 'latest'
coverage: none

# Install dependencies to make sure the PHPCS XSD file is available.
- name: Install dependencies
run: composer install --no-dev --no-interaction --no-progress

- name: Validate Ruleset XML file against schema
uses: phpcsstandards/xmllint-validate@0fd9c4a9046055f621fca4bbdccb8eab1fd59fdc # v1.0.1
with:
pattern: "./*/ruleset.xml"
xsd-file: "vendor/squizlabs/php_codesniffer/phpcs.xsd"

# Check the code-style consistency of the xml file.
# Note: this needs xmllint, but that will be installed via the phpcsstandards/xmllint-validate action runner.
- name: Check code style
run: |
diff -B ./PHPCompatibilityPasswordCompat/ruleset.xml <(xmllint --format "./PHPCompatibilityPasswordCompat/ruleset.xml")

test:
needs: xmllint
runs-on: ubuntu-latest

strategy:
matrix:
php: ['5.4', 'latest']
phpcompat: ['stable']
experimental: [false]

include:
- php: '7.4'
phpcompat: 'dev-develop as 10.99.99'
experimental: true

name: "Test: PHP ${{ matrix.php }} - PHPCompat ${{ matrix.phpcompat }}"
continue-on-error: ${{ matrix.experimental }}

steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

- name: Install PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL, display_errors=On, display_startup_errors=On
coverage: none

- name: Conditionally update PHPCompatibility to develop version
if: ${{ matrix.phpcompat != 'stable' }}
run: |
composer config minimum-stability dev
composer require --no-update phpcompatibility/php-compatibility:"${{ matrix.phpcompat }}" --no-interaction

- name: Install dependencies
run: composer install --no-interaction --no-progress

# Validate the composer.json file.
# @link https://getcomposer.org/doc/03-cli.md#validate
- name: Validate Composer installation
run: composer validate --no-check-all --strict

# Make sure that known polyfills don't trigger any errors.
- name: Test the ruleset
run: >
vendor/bin/phpcs -ps ./Test/PasswordCompatTest.php --standard=PHPCompatibilityPasswordCompat
--exclude=PHPCompatibility.Upgrade.LowPHP
--runtime-set testVersion 5.4-

# Check that the ruleset doesn't throw unnecessary errors for the compat library itself.
- name: Test running against the polyfills
run: >
vendor/bin/phpcs -ps ./vendor/ircmaxell/ --standard=PHPCompatibilityPasswordCompat
--exclude=PHPCompatibility.Upgrade.LowPHP
--ignore=/password-compat/test/*
--runtime-set testVersion 5.4-