Skip to content

Commit

Permalink
ci: update CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimDeluxe committed Dec 4, 2023
1 parent 4ad27ba commit dadf755
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 67 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/codecov.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/fix-code-style.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Code linting

on:
# Run linting on all push events that have committed changes in PHP files
push:
paths:
- '**.php'
# Make it possible to run the workflow manually
workflow_dispatch:

jobs:
phplint:
runs-on: ubuntu-latest

permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write

steps:

- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Run PHP CS Fixer
uses: docker://oskarstark/php-cs-fixer-ga
with:
args: --config=.php-cs-fixer.dist.php --allow-risky=yes

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: fix code style"
4 changes: 4 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
name: Tests

on:
# Run testing on all push and pull requests for the master branch that have committed changes in PHP files
push:
branches: [ "master" ]
paths:
- '**.php'
pull_request:
branches: [ "master" ]
paths:
- '**.php'
# Make it possible to run the workflow manually
workflow_dispatch:

permissions:
contents: read
Expand All @@ -14,7 +21,9 @@ jobs:

runs-on: ${{ matrix.os }}

# Define the matrix of different PHP and dependency versions
strategy:
# Fail the whole workflow if one of the jobs fails
fail-fast: true
matrix:
os: [ ubuntu-latest, windows-latest ]
Expand All @@ -23,7 +32,11 @@ jobs:
name: ${{ matrix.os }} / PHP ${{ matrix.php }}

steps:
- uses: actions/checkout@v3

- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand All @@ -39,10 +52,19 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: curl, json

- name: Install dependencies
run: composer update --prefer-dist --no-progress

- name: Run test suite
run: composer test
run: ./vendor/bin/phpunit --coverage-clover ./coverage.xml

- name: Upload coverage reports to Codecov
# Make sure the Codecov action is only executed once
if: matrix.os == 'ubuntu-latest' && matrix.php == '8.1' && matrix.dependency-version == 'prefer-stable'
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
verbose: true

0 comments on commit dadf755

Please sign in to comment.