Migrate GitLab CI to GitHub Actions (#1)

This commit is contained in:
Daniel Siepmann 2023-02-21 14:46:47 +01:00 committed by GitHub
parent c771924b8e
commit c659e5310f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 153 additions and 166 deletions

153
.github/workflows/ci.yaml vendored Normal file
View file

@ -0,0 +1,153 @@
name: CI
on:
- pull_request
jobs:
check-composer:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Validate composer.json
run: composer validate
php-linting:
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- 7.2
- 7.3
- 7.4
- 8.0
- 8.1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
tools: composer:v2
- name: PHP lint
run: "find *.php Classes Configuration Tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l"
xml-linting:
runs-on: ubuntu-latest
needs: [check-composer]
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
tools: composer:v2
- name: Install xmllint
run: sudo apt-get install libxml2-utils
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: PHPUnit configuration file
run: xmllint --schema vendor/phpunit/phpunit/phpunit.xsd --noout phpunit.xml.dist
- name: Fetch schema for xliff
run: wget https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=.Build/xliff-core-1.2-strict.xsd
- name: TYPO3 language files
run: xmllint --schema .Build/xliff-core-1.2-strict.xsd --noout $(find Resources -name '*.xlf')
coding-guideline:
runs-on: ubuntu-latest
needs:
- php-linting
- xml-linting
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest
- name: Coding Guideline
run: ./vendor/bin/ecs check --no-progress-bar --clear-cache
code-quality:
runs-on: ubuntu-latest
needs:
- php-linting
strategy:
matrix:
include:
- php-version: '7.2'
typo3-version: '^10.4'
- php-version: '7.3'
typo3-version: '^10.4'
- php-version: '7.4'
typo3-version: '^10.4'
- php-version: '7.4'
typo3-version: '^11.5'
- php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^11.5'
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
tools: composer:v2
- name: Install dependencies with expected TYPO3 version
run: composer require --no-interaction --prefer-dist --no-progress "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" "typo3/cms-fluid:${{ matrix.typo3-version }}" "typo3/cms-filelist:${{ matrix.typo3-version }}" "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-fluid-styled-content:${{ matrix.typo3-version }}"
- name: Code Quality (by PHPStan)
run: ./vendor/bin/phpstan analyse
tests:
runs-on: ubuntu-latest
needs:
- php-linting
- xml-linting
strategy:
matrix:
include:
- php-version: '7.2'
typo3-version: '^10.4'
- php-version: '7.3'
typo3-version: '^10.4'
- php-version: '7.4'
typo3-version: '^10.4'
- php-version: '7.4'
typo3-version: '^11.5'
- php-version: '8.0'
typo3-version: '^11.5'
- php-version: '8.1'
typo3-version: '^11.5'
steps:
- uses: actions/checkout@v3
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
tools: composer:v2
- name: Install system dependencies
run: sudo apt-get install graphicsmagick
- name: Install dependencies with expected TYPO3 version
run: composer require --no-interaction --prefer-dist --no-progress "typo3/cms-core:${{ matrix.typo3-version }}" "typo3/cms-extbase:${{ matrix.typo3-version }}" "typo3/cms-frontend:${{ matrix.typo3-version }}" "typo3/cms-fluid:${{ matrix.typo3-version }}" "typo3/cms-filelist:${{ matrix.typo3-version }}" "typo3/cms-backend:${{ matrix.typo3-version }}" "typo3/cms-fluid-styled-content:${{ matrix.typo3-version }}"
- name: PHPUnit Tests
run: ./vendor/bin/phpunit --testdox

View file

@ -1,166 +0,0 @@
stages:
- validate
- test
- deploy
before_script:
- apk add zip graphicsmagick
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php --filename composer --install-dir /bin
- php -r "unlink('composer-setup.php');"
validate:composer:
image: php:8.0-alpine
stage: validate
script:
- composer validate --no-check-publish --strict
validate:php:8.1:
image: php:8.1-alpine
stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
validate:php:8.0:
image: php:8.0-alpine
stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
validate:php:7.4:
image: php:7.4-alpine
stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
validate:php:7.3:
image: php:7.3-alpine
stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
validate:php:7.2:
image: php:7.2-alpine
stage: validate
script:
- find *.php Classes Configuration -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l
validate:xml:
image: php:7.3-alpine
stage: validate
script:
- apk add libxml2-utils wget
- composer install --prefer-dist --no-progress
- wget https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=.Build/xliff-core-1.2-strict.xsd
- xmllint --schema .Build/xliff-core-1.2-strict.xsd --noout $(find Resources -name '*.xlf')
validate:cgl:
image: php:7.3-alpine
stage: validate
script:
- composer install --prefer-dist --no-progress
- ./vendor/bin/ecs check --no-progress-bar --clear-cache
validate:phpstan:8.1:
image: php:8.1-alpine
stage: validate
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
validate:phpstan:8.0:
image: php:8.0-alpine
stage: validate
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
validate:phpstan:7.4:11.5:
image: php:7.4-alpine
stage: validate
script:
- composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^11.5"
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
validate:phpstan:7.4:10.4:
image: php:7.4-alpine
stage: validate
script:
- composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^10.4"
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
validate:phpstan:7.3:
image: php:7.3-alpine
stage: validate
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
validate:phpstan:7.2:
image: php:7.2-alpine
stage: validate
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpstan --no-progress
test:phpunit:8.1:
image: php:8.1-alpine
stage: test
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
test:phpunit:8.0:
image: php:8.0-alpine
stage: test
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
test:phpunit:7.4:11.5:
image: php:7.4-alpine
stage: test
script:
- composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^11.5"
- php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
test:phpunit:7.4:10.4:
image: php:7.4-alpine
stage: test
script:
- composer require --no-ansi --no-interaction --no-progress typo3/cms-core:"^10.4"
- php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
test:phpunit:7.3:
image: php:7.3-alpine
stage: test
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
test:phpunit:7.2:
image: php:7.2-alpine
stage: test
script:
- composer install --prefer-dist --no-progress
- php -d memory_limit=-1 ./vendor/bin/phpunit --testdox
deploy:composer:package:tag:
before_script: []
image: alpine:3.15.5
stage: deploy
script:
- apk add curl
- 'curl --header "Job-Token: $CI_JOB_TOKEN" --data tag=${CI_COMMIT_TAG} "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"'
only:
- tags
deploy:composer:package:branch:
before_script: []
image: alpine:3.15.5
stage: deploy
script:
- apk add curl
- 'curl --header "Job-Token: $CI_JOB_TOKEN" --data branch=${CI_COMMIT_BRANCH} "${CI_API_V4_URL}/projects/$CI_PROJECT_ID/packages/composer"'
only:
- branches