-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from ericsizemore/ericsizemore-patch-1-2
Create continuous-integration.yml
- Loading branch information
Showing
1 changed file
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: "Continuous Integration" | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
# Cancels all previous workflow runs for the same branch that have not yet completed. | ||
concurrency: | ||
# The concurrency group contains the workflow name and the branch name. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
COMPOSER_ROOT_VERSION: "1.99.99" | ||
|
||
jobs: | ||
phpstan: | ||
name: "PHPStan Static Analysis ${{ matrix.php }}" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: [ '8.2', '8.3' ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: "Install PHP ${{ matrix.php }}" | ||
uses: shivammathur/setup-php@master | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: mbstring | ||
|
||
- name: "Validate composer.json and composer.lock" | ||
run: composer validate --strict | ||
|
||
- name: "Setup Composer, install dependencies" | ||
uses: ramsey/composer-install@v3 | ||
with: | ||
composer-options: "--prefer-dist --optimize-autoloader" | ||
require-lock-file: "true" | ||
|
||
- name: "Run PHPStan" | ||
run: composer run-script phpstan | ||
|
||
unit-test: | ||
name: "Run Unit Tests ${{ matrix.php }}" | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: [ '8.2', '8.3' ] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 10 | ||
|
||
- name: "Install PHP ${{ matrix.php }}" | ||
uses: shivammathur/setup-php@master | ||
with: | ||
php-version: ${{ matrix.php }} | ||
extensions: mbstring, | ||
coverage: xdebug, | ||
|
||
- name: "Validate composer.json and composer.lock" | ||
run: composer validate --strict | ||
|
||
- name: "Setup Composer, install dependencies" | ||
uses: ramsey/composer-install@v3 | ||
with: | ||
composer-options: "--prefer-dist --optimize-autoloader" | ||
require-lock-file: "true" | ||
|
||
- name: "Install Node.js" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 21.x | ||
cache: 'npm' | ||
|
||
- name: "Build Mocko" | ||
run: npm i -g @mocko/cli | ||
|
||
- name: "Check Mocko installation" | ||
run: mocko --help | ||
|
||
- name: "Start Mocko" | ||
run: (mocko -p 8080 ./mock-server &) | ||
|
||
- name: "Run test suite" | ||
run: composer run-script test | ||
|
||
- name: "Coverage check" | ||
run: composer run-script coverage-check | ||
|
||
- uses: sudo-bot/action-scrutinizer@latest | ||
with: | ||
cli-args: "--format=php-clover build/logs/clover.xml" |