Skip to content

Commit

Permalink
Add test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasruunu committed Jun 20, 2024
1 parent b2725ab commit 5ea9695
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PHP Composer

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Validate composer.json and composer.lock
run: docker compose run composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-php-${{ hashFiles('**/composer.json') }}
${{ runner.os }}-php-
- name: Install packages
run: docker compose run composer install

- name: Run test suite
run: docker compose run phpspec

- name: Run static analyzer
run: docker compose run phpstan

- name: Run code style checker
run: docker compose run php-cs-fixer --dry-run
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
},
"scripts": {
"test": "vendor/bin/phpspec run",
"static-analyzer": "vendor/bin/phpstan",
"check-style": "vendor/bin/php-cs-fixer fix --dry-run",
"fix-style": "vendor/bin/php-cs-fixer fix"
},
"repositories": [
Expand Down

0 comments on commit 5ea9695

Please sign in to comment.