Skip to content

Commit

Permalink
fixup! Add GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Jan 20, 2024
1 parent 8b0260b commit 13e8544
Showing 1 changed file with 20 additions and 39 deletions.
59 changes: 20 additions & 39 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,37 @@ name: Continuous Integration

on:
push:
paths-ignore:
- '**.md'
pull_request:
workflow_dispatch:

jobs:
phpunit:
name: PHPUnit
build:
runs-on: ubuntu-latest
strategy:
matrix:
operating-system:
- ubuntu-latest
php-version:
- '8.1'
dependencies:
- lowest
- highest
steps:
- name: Checkout
uses: actions/checkout@v1
- uses: actions/checkout@v2

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

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Run test suite
run: composer run-script test

- name: Install lowest dependencies
if: ${{ matrix.dependencies == 'lowest' }}
run: composer update --prefer-lowest --no-interaction --no-progress --no-suggest
- name: Insert todo seed
run: |
mysql -u root -e "INSERT INTO ticket (id, title, dateCreated) VALUES ('1', 'foo', '1970-01-01 00:00:00')" ticket
- name: Install highest dependencies
if: ${{ matrix.dependencies == 'highest' }}
run: composer update --no-interaction --no-progress --no-suggest
- name: Request /ticket resource
run: |
php bin/app.php get '/ticket?id=1'
- name: Run test suite
run: ./vendor/bin/phpunit -c ./phpunit.xml.dist --coverage-clover=coverage.xml

- name: Upload coverage report
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
- name: Create API doc
run: |
composer doc

0 comments on commit 13e8544

Please sign in to comment.