From 6b590986124955652e8c75725ffa750656a9a9e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 12 Apr 2022 08:52:11 +0200 Subject: [PATCH] [CI] Moved to Github Actions (#125) --- .github/workflows/ci.yaml | 69 +++++++++++++++++++++++++++++++++++++++ .travis.yml | 29 ---------------- composer.json | 4 ++- 3 files changed, 72 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..62062d97 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,69 @@ +name: CI + +on: + push: + branches: + - main + - '[0-9]+.[0-9]+' + pull_request: ~ + +jobs: + cs-fix: + name: Run code style check + runs-on: "ubuntu-20.04" + strategy: + matrix: + php: + - '7.3' + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: 'pdo_sqlite, gd' + tools: cs2pr + + - uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + + - name: Run code style check + run: composer run-script check-cs -- --format=checkstyle | cs2pr + + tests: + name: Unit tests + runs-on: "ubuntu-20.04" + timeout-minutes: 15 + + strategy: + fail-fast: false + matrix: + php: + - '7.1' + - '7.2' + - '7.3' + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: pdo_sqlite, gd + tools: cs2pr + + - uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + composer-options: "${{ matrix.composer_options }}" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run unit test suite + run: composer test diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cab2d722..00000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: php - -php: - - 7.1 - -branches: - only: - - master - - dev - - /^\d.\d+$/ - -cache: - directories: - - $HOME/.composer/cache/files - -env: - matrix: - - TARGET="phpspec" - - TARGET="codestyle" - -before_script: - - COMPOSER_MEMORY_LIMIT=-1 composer install - -script: - - if [ "$TARGET" == "phpspec" ] ; then ./vendor/bin/phpspec run --format=pretty; fi - - if [ "$TARGET" == "codestyle" ] ; then ./vendor/bin/php-cs-fixer fix --dry-run -v --show-progress=estimating; fi - -notification: - email: false diff --git a/composer.json b/composer.json index 283c20a5..f2723f45 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,8 @@ } }, "scripts": { - "fix-cs": "@php ./vendor/bin/php-cs-fixer fix -v --show-progress=estimating" + "fix-cs": "php-cs-fixer fix -v --show-progress=estimating", + "check-cs": "@fix-cs --dry-run", + "test": "phpspec run --format=pretty" } }