Skip to content

Commit

Permalink
Merge pull request #17 from nicwortel/ci-workflow-template
Browse files Browse the repository at this point in the history
Create a Continuous Integration workflow template
  • Loading branch information
greg0ire authored Jan 9, 2021
2 parents af0dc37 + ed3c629 commit 2c60b2f
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
11 changes: 11 additions & 0 deletions workflow-templates/continuous-integration.properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Continuous Integration",
"description": "Runs automated tests on multiple PHP versions",
"iconName": "doctrine-logo",
"categories": [
"PHP"
],
"filePatterns": [
"^phpunit\\.xml(?:\\.dist)$"
]
}
82 changes: 82 additions & 0 deletions workflow-templates/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: "Continuous Integration"

on:
pull_request:
branches:
- "*.x"
- "master"
push:
branches:
- "*.x"
- "master"

env:
fail-fast: true

jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
dependencies:
- "highest"
include:
- php-version: "7.2"
dependencies: "lowest"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "--prefer-dist --no-suggest"

- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"

- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-${{ matrix.php-version }}.coverage"
path: "coverage.xml"

upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
needs:
- "phpunit"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Download coverage files"
uses: "actions/download-artifact@v2"
with:
path: "reports"

- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
with:
directory: "reports"

0 comments on commit 2c60b2f

Please sign in to comment.