Skip to content

Commit

Permalink
Merge pull request #26 from ericsizemore/ericsizemore-patch-1-2
Browse files Browse the repository at this point in the history
Create continuous-integration.yml
  • Loading branch information
ericsizemore authored May 29, 2024
2 parents 0e1a5e6 + 5014fff commit c11324e
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/continuous-integration.yml
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"

0 comments on commit c11324e

Please sign in to comment.