Skip to content

Commit

Permalink
ci(github): add workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Aug 13, 2023
1 parent 90a07fc commit 0820224
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: build
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer:v2

- name: Install dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader

- name: Generate code
run: composer build

- name: Check Git working tree
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'Detected uncommitted changes. See status below:'
git diff
exit 1
fi
14 changes: 14 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: commitlint
on: [push, pull_request]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Commitlint
uses: remarkablemark/commitlint@v1
31 changes: 31 additions & 0 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: php-cs-fixer
on:
pull_request:
paths:
- '**.php'

permissions:
contents: write

jobs:
php-cs-fixer:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: php-cs-fixer:3

- name: Run php-cs-fixer
run: vendor/bin/php-cs-fixer fix

- name: Git commit and push
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'style: run php-cs-fixer'
18 changes: 18 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: release-please
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Release Please
uses: google-github-actions/release-please-action@v3
with:
release-type: php
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test
on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer:v2
coverage: pcov

- name: Install dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader

- name: Run tests
run: vendor/bin/pest --coverage --coverage-clover=coverage.xml

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.xml

0 comments on commit 0820224

Please sign in to comment.