Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
cmatosbc committed Dec 5, 2024
1 parent 8c2b4ec commit 939a0c6
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/composer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: PHP Composer

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

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

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

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-dist --no-progress

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Run test suite
# run: composer run-script test
43 changes: 43 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PHP Lint

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: ['8.2']

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: Install PHP_CodeSniffer
run: composer global require "squizlabs/php_codesniffer=*"

- name: Run PHP_CodeSniffer
run: ~/.composer/vendor/bin/phpcs

- name: Upload PHP_CodeSniffer results
if: always()
uses: actions/upload-artifact@v4
with:
name: phpcs-results
path: phpcs.xml

- name: Display PHP_CodeSniffer results
if: always()
run: cat phpcs.xml
28 changes: 28 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PHPUnit Tests

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2' # PHP version updated to 8.2
extensions: mbstring, intl
coverage: xdebug # If you need code coverage

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

- name: Run PHPUnit
run: vendor/bin/phpunit

0 comments on commit 939a0c6

Please sign in to comment.