From 72d8565c44c3780c01eb822e3dc3aaafd4e33e06 Mon Sep 17 00:00:00 2001 From: otsch Date: Mon, 4 Jan 2021 22:35:15 +0100 Subject: [PATCH] Add github workflow for ci (#20) Running PHP CS Fixer on PHP 7.2 and phpunit tests on PHP 7.2, 7.3, 7.4 and 8.0. Add .github directory export-ignore to .gitattributes file. And add .editorconfig rule indent_size = 2 for .yml files. --- .editorconfig | 3 +++ .gitattributes | 1 + .github/workflows/ci.yml | 51 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.editorconfig b/.editorconfig index 498f82b..75349f8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,3 +12,6 @@ trim_trailing_whitespace = true [*.md] trim_trailing_whitespace = false + +[*.yml] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes index 8979158..0a2c694 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,3 +6,4 @@ phpunit.xml export-ignore tests export-ignore git-hooks export-ignore bin/add-git-hooks export-ignore +.github export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2446ed2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI (tests and code style) + +on: pull_request + +jobs: + cs: + name: PHP CS Fixer + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.2' + + - name: Check PHP Version + run: php -v + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run PHP CS Fixer + run: composer cs + + tests: + name: PHPUnit tests + runs-on: ubuntu-latest + strategy: + matrix: + php-versions: ['7.2', '7.3', '7.4', '8.0'] + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Check PHP Version + run: php -v + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run tests + run: composer test