From b3f050110e51e28f82137b42b66838ee192b81d3 Mon Sep 17 00:00:00 2001 From: Ben Ramsey Date: Wed, 28 Oct 2020 21:39:44 -0500 Subject: [PATCH] Add CI workflow for GitHub Actions --- .codecov.yml | 29 ++++++ .github/workflows/continuous-integration.yml | 95 ++++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 .codecov.yml create mode 100644 .github/workflows/continuous-integration.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..a35f023 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,29 @@ +codecov: + require_ci_to_pass: yes + +coverage: + precision: 2 + round: down + range: "70...100" + status: + project: + default: + target: auto + threshold: 0% + patch: + default: + target: auto + threshold: 0% + +parsers: + gcov: + branch_detection: + conditional: yes + loop: yes + method: no + macro: no + +comment: + layout: "reach,diff,flags,tree" + behavior: default + require_changes: false diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..4efcb5f --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,95 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +name: "CI" + +on: + pull_request: + push: + branches: + - "master" + +env: + COMPOSER_ROOT_VERSION: "1.99.99" + +jobs: + + coding-standards: + name: "Coding Standards" + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + coverage: "none" + ini-values: "memory_limit=-1" + - uses: "ramsey/composer-install@v1" + - name: "Run the linter" + run: "composer lint -- --colors" + - name: "Check coding standards" + run: "composer phpcs -- --colors" + + static-analysis: + name: "Static Analysis" + runs-on: "ubuntu-latest" + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "7.4" + coverage: "none" + ini-values: "memory_limit=-1" + - uses: "ramsey/composer-install@v1" + - name: "Run PHPStan" + run: "composer phpstan -- --ansi" + - name: "Run Psalm" + run: "composer psalm -- --shepherd" + + benchmark: + name: "Benchmark" + runs-on: "ubuntu-latest" + strategy: + matrix: + php-version: + - "7.2" + - "7.3" + - "7.4" + - "8.0" + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + tools: pecl + extensions: bcmath, ctype, gmp, uuid + coverage: "none" + ini-values: "memory_limit=-1" + - uses: "ramsey/composer-install@v1" + - name: "Run PHPBench" + run: "composer phpbench -- --ansi" + + unit-tests: + name: "Unit Tests" + runs-on: "ubuntu-latest" + strategy: + fail-fast: false + matrix: + php-version: + - "7.2" + - "7.3" + - "7.4" + - "8.0" + steps: + - uses: "actions/checkout@v2" + - uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + tools: pecl + extensions: bcmath, ctype, gmp, uuid + coverage: "pcov" + ini-values: "memory_limit=-1" + - uses: "ramsey/composer-install@v1" + - name: "Run unit tests" + run: "./vendor/bin/phpunit --verbose --colors=always --coverage-clover build/logs/clover.xml --coverage-text" + - name: "Publish coverage report to Codecov" + uses: "codecov/codecov-action@v1"