Migrate to GitHub actions

This commit is contained in:
Niklas Keller 2022-02-03 20:02:22 +01:00
parent 221ee7cc8b
commit 43959fbdc5
4 changed files with 125 additions and 39 deletions

91
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,91 @@
name: Continuous Integration
on:
- push
- pull_request
jobs:
tests:
strategy:
matrix:
include:
- operating-system: 'ubuntu-latest'
php-version: '7.4'
- operating-system: 'ubuntu-latest'
php-version: '8.0'
- operating-system: 'ubuntu-latest'
php-version: '8.1'
- operating-system: 'windows-latest'
php-version: '8.1'
job-description: 'on Windows'
- operating-system: 'macos-latest'
php-version: '8.1'
job-description: 'on macOS'
name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }}
runs-on: ${{ matrix.operating-system }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: fiber-amphp/ext-fiber@master
- name: Get Composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-${{ matrix.composer-flags }}
restore-keys: |
composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.*') }}-
composer-${{ runner.os }}-${{ matrix.php-version }}-
composer-${{ runner.os }}-
composer-
- name: Install dependencies
uses: nick-invision/retry@v2
with:
timeout_minutes: 5
max_attempts: 5
retry_wait_seconds: 30
command: |
composer update --optimize-autoloader --no-interaction --no-progress ${{ matrix.composer-flags }}
composer info -D
- name: Run tests
run: vendor/bin/phpunit ${{ matrix.phpunit-flags }}
- name: Run examples
run: (for f in examples/*.php; do echo $f && if ! php $f; then echo '!! failed !!' && exit 1; fi && echo "-------"; done)
- name: Run style fixer
env:
PHP_CS_FIXER_IGNORE_ENV: 1
run: vendor/bin/php-cs-fixer --diff --dry-run -v fix
if: runner.os != 'Windows'
- name: Install composer-require-checker
run: php -r 'file_put_contents("composer-require-checker.phar", file_get_contents("https://github.com/maglnet/ComposerRequireChecker/releases/download/3.7.0/composer-require-checker.phar"));'
if: runner.os != 'Windows' && matrix.composer-require-checker-version != 'none'
- name: Run composer-require-checker
run: php composer-require-checker.phar check composer.json --config-file $PWD/composer-require-check.json
if: runner.os != 'Windows' && matrix.composer-require-checker-version != 'none'

View File

@ -1,38 +0,0 @@
sudo: false
language: php
php:
- 7.4
- 8.0
- nightly
matrix:
allow_failures:
- php: nightly
fast_finish: true
env:
- AMP_DEBUG=true
before_install:
- phpenv config-rm xdebug.ini || echo "No xdebug config."
install:
- composer update -n --prefer-dist
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v1.0.2/coveralls.phar
- chmod +x coveralls.phar
script:
# Run with phpdbg or xdebug as soon as one of both doesn't segfault anymore
- vendor/bin/phpunit --coverage-text --coverage-clover build/logs/clover.xml
- (for f in examples/*.php; do echo $f && if ! php $f; then echo '!! failed !!' && exit 1; fi && echo "-------"; done)
- PHP_CS_FIXER_IGNORE_ENV=1 composer fix-syntax -- --dry-run
after_script:
- ./coveralls.phar -v
cache:
directories:
- $HOME/.composer/cache/files
- $HOME/.php-cs-fixer

View File

@ -1,7 +1,7 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2017 amphp Copyright (c) 2017-2022 amphp (Niklas Keller, and contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -0,0 +1,33 @@
{
"symbol-whitelist": [
"null",
"true",
"false",
"static",
"self",
"parent",
"array",
"string",
"int",
"float",
"bool",
"iterable",
"callable",
"mixed",
"void",
"object",
"escapeArguments",
"IS_WINDOWS",
"posix_kill"
],
"php-core-extensions": [
"Core",
"date",
"pcre",
"Phar",
"Reflection",
"SPL",
"standard",
"hash"
]
}