Skip to content

Commit

Permalink
#6 - Introduce GitHub Action (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
BarTracz authored Jun 10, 2024
1 parent 070efe2 commit 85163b6
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Check PR Title
on:
pull_request:
types:
- opened
- edited
- synchronize
- ready_for_review
- reopened

jobs:
check-pr-title:
name: Check PR title
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04

steps:
- uses: blumilksoftware/action-pr-title@e05fc76a1cc45b33644f1de51218be43ac121dd0 # v1.2.0
52 changes: 52 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Test & lint PHP stuff

on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
- ready_for_review
paths:
- '**.php'
- 'composer.json'
- 'composer.lock'
- 'phpunit.xml'

jobs:
test-and-lint-php:
name: Test & lint PHP stuff
timeout-minutes: 10
if: github.event.pull_request.draft == false
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: Validate composer.json and composer.lock
run: composer validate

- name: Cache dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: vendor
key: ${{ runner.os }}-composer-dependencies-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-dependencies

- name: Setup PHP
uses: shivammathur/setup-php@c665c7a15b5295c2488ac8a87af9cb806cd72198 # 2.30.4
with:
php-version: 8.2
extensions: dom, curl, libxml, mbstring, zip, pcntl, intl, gd
coverage: none

- name: Install Composer dependencies
run: composer install --prefer-dist --no-interaction --no-suggest

- name: Run PHP linter
run: composer cs

- name: Execute tests
run: php vendor/bin/phpunit --configuration phpunit.xml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
.composer
vendor
composer.lock
index.php
.phpunit.result.cache
10 changes: 10 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/|version|/phpunit.xsd"
bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="unit">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit 85163b6

Please sign in to comment.