313 lines
12 KiB
YAML
313 lines
12 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ '**' ]
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- '*.md'
|
|
pull_request:
|
|
branches: [ '**' ]
|
|
paths-ignore:
|
|
- 'docs/**'
|
|
- '*.md'
|
|
|
|
|
|
|
|
jobs:
|
|
silverstripe_410_php74:
|
|
name: "Silverstripe 4.10 | PHP 7.4"
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
|
|
env:
|
|
php_version: 7.4
|
|
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip
|
|
services:
|
|
mysql:
|
|
image: mysql:5.7
|
|
env:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
|
MYSQL_ROOT_PASSWORD: testpassword
|
|
MYSQL_DATABASE: test_db
|
|
ports:
|
|
- 3306/tcp
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP Extension Cache
|
|
id: cache-env
|
|
uses: shivammathur/cache-extensions@v1
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
key: php74-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
|
|
- name: Cache PHP Extensions
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.cache-env.outputs.dir }}
|
|
key: ${{ steps.cache-env.outputs.key }}
|
|
restore-keys: ${{ steps.cache-env.outputs.key }}
|
|
|
|
- name: Setup PHP, with composer and extensions
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
ini-values: log_errors=On, error_log="${{github.workspace}}/artifacts/php_errors.log"
|
|
coverage: none
|
|
tools: composer:v1
|
|
|
|
- name: Get composer cache directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Cache composer dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-ss410-php74-${{ hashFiles('**/composer.json') }}-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
restore-keys: ${{ runner.os }}-composer-ss410-php74-
|
|
|
|
- name: Install Composer dependencies
|
|
env:
|
|
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
composer self-update --ansi || true
|
|
if [[ $GITHUB_ACCESS_TOKEN ]]; then composer config --ansi -g github-oauth.github.com $GITHUB_ACCESS_TOKEN; fi
|
|
composer require silverstripe/admin 1.10.* --no-update
|
|
composer require silverstripe/versioned 1.10.*
|
|
composer install --verbose --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi
|
|
|
|
- name: Configure Environment
|
|
run: |
|
|
cp tests/utils/actions.env.template .env
|
|
mkdir artifacts
|
|
|
|
- name: Perform PHPUnit Tests
|
|
env:
|
|
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
|
|
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\PHPUnit\\Bootstrap\\GitHubActionsAnnotatorPrinter
|
|
|
|
silverstripe_410_php80:
|
|
name: "Silverstripe 4.10 | PHP 8.0"
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
|
|
env:
|
|
php_version: 8.0
|
|
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip
|
|
services:
|
|
mysql:
|
|
image: mysql:5.7
|
|
env:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
|
MYSQL_ROOT_PASSWORD: testpassword
|
|
MYSQL_DATABASE: test_db
|
|
ports:
|
|
- 3306/tcp
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP Extension Cache
|
|
id: cache-env
|
|
uses: shivammathur/cache-extensions@v1
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
key: php80-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
|
|
- name: Cache PHP Extensions
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.cache-env.outputs.dir }}
|
|
key: ${{ steps.cache-env.outputs.key }}
|
|
restore-keys: ${{ steps.cache-env.outputs.key }}
|
|
|
|
- name: Setup PHP, with composer and extensions
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
ini-values: log_errors=On, error_log="${{github.workspace}}/artifacts/php_errors.log"
|
|
coverage: none
|
|
tools: composer:v2
|
|
|
|
- name: Get composer cache directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Cache composer dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-ss410-php80-${{ hashFiles('**/composer.json') }}-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
restore-keys: ${{ runner.os }}-composer-ss410-php80-
|
|
|
|
- name: Install Composer dependencies
|
|
env:
|
|
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
composer self-update --ansi || true
|
|
if [[ $GITHUB_ACCESS_TOKEN ]]; then composer config --ansi -g github-oauth.github.com $GITHUB_ACCESS_TOKEN; fi
|
|
composer require silverstripe/admin 1.10.* --no-update
|
|
composer require silverstripe/versioned 1.10.*
|
|
composer install --verbose --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi
|
|
|
|
- name: Configure Environment
|
|
run: |
|
|
cp tests/utils/actions.env.template .env
|
|
mkdir artifacts
|
|
|
|
- name: Perform PHPUnit Tests
|
|
env:
|
|
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
|
|
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\PHPUnit\\Bootstrap\\GitHubActionsAnnotatorPrinter
|
|
|
|
silverstripe_49_php74:
|
|
name: "Silverstripe 4.9 | PHP 7.4"
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
|
|
env:
|
|
php_version: 7.4
|
|
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip
|
|
services:
|
|
mysql:
|
|
image: mysql:5.7
|
|
env:
|
|
MYSQL_ALLOW_EMPTY_PASSWORD: false
|
|
MYSQL_ROOT_PASSWORD: testpassword
|
|
MYSQL_DATABASE: test_db
|
|
ports:
|
|
- 3306/tcp
|
|
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP Extension Cache
|
|
id: cache-env
|
|
uses: shivammathur/cache-extensions@v1
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
key: php74-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
|
|
- name: Cache PHP Extensions
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.cache-env.outputs.dir }}
|
|
key: ${{ steps.cache-env.outputs.key }}
|
|
restore-keys: ${{ steps.cache-env.outputs.key }}
|
|
|
|
- name: Setup PHP, with composer and extensions
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
ini-values: log_errors=On, error_log="${{github.workspace}}/artifacts/php_errors.log"
|
|
coverage: none
|
|
tools: composer:v1
|
|
|
|
- name: Get composer cache directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Cache composer dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-ss49-php74-${{ hashFiles('**/composer.json') }}-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
restore-keys: ${{ runner.os }}-composer-ss49-php74-
|
|
|
|
- name: Install Composer dependencies
|
|
env:
|
|
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
composer self-update --ansi || true
|
|
if [[ $GITHUB_ACCESS_TOKEN ]]; then composer config --ansi -g github-oauth.github.com $GITHUB_ACCESS_TOKEN; fi
|
|
composer require silverstripe/admin 1.9.* --no-update
|
|
composer require silverstripe/versioned 1.9.*
|
|
composer install --verbose --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi
|
|
|
|
- name: Configure Environment
|
|
run: |
|
|
cp tests/utils/actions.env.template .env
|
|
mkdir artifacts
|
|
|
|
- name: Perform PHPUnit Tests
|
|
env:
|
|
SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }}
|
|
run: vendor/bin/phpunit --colors=always --printer UndefinedOffset\\SortableGridField\\Tests\\PHPUnit\\Bootstrap\\GitHubActionsAnnotatorPrinter
|
|
|
|
phpcs:
|
|
name: "PHP_CodeSniffer"
|
|
runs-on: ubuntu-latest
|
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
|
|
env:
|
|
php_version: 7.4
|
|
php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Setup PHP Extension Cache
|
|
id: cache-env
|
|
uses: shivammathur/cache-extensions@v1
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
key: php74-ext-cache-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
|
|
- name: Cache PHP Extensions
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.cache-env.outputs.dir }}
|
|
key: ${{ steps.cache-env.outputs.key }}
|
|
restore-keys: ${{ steps.cache-env.outputs.key }}
|
|
|
|
- name: Setup PHP, with composer and extensions
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ env.php_version }}
|
|
extensions: ${{ env.php_extensions }}
|
|
ini-values: log_errors=On, error_log="${{github.workspace}}/artifacts/php_errors.log"
|
|
coverage: none
|
|
tools: composer:v2
|
|
|
|
- name: Get composer cache directory
|
|
id: composer-cache
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
|
|
|
- name: Cache composer dependencies
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
key: ${{ runner.os }}-composer-phpcs-${{ hashFiles('.github/workflows/ci.yml') }}
|
|
restore-keys: ${{ runner.os }}-composer-phpcs-
|
|
|
|
- name: Install Composer dependencies
|
|
env:
|
|
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
rm composer.json
|
|
composer self-update --ansi || true
|
|
if [[ $GITHUB_ACCESS_TOKEN ]]; then composer config --ansi -g github-oauth.github.com $GITHUB_ACCESS_TOKEN; fi
|
|
composer require squizlabs/php_codesniffer ~3.4
|
|
composer install --verbose --no-interaction --no-progress --no-suggest --optimize-autoloader --ansi
|
|
mkdir artifacts
|
|
|
|
- name: Validate Code Style
|
|
run: vendor/bin/phpcs --colors --report=full --report-checkstyle=artifacts/phpcs.xml
|
|
|
|
- name: Annotate Code Style Issues
|
|
if: failure()
|
|
run: (test -f artifacts/phpcs.xml && echo "::add-matcher::.github/matchers/phpcs.json" && cat artifacts/phpcs.xml && echo "::remove-matcher owner=phpcs::")
|