Skip to content

Commit

Permalink
add ci workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
gwleuverink committed Aug 16, 2024
1 parent 8546347 commit 3ae8177
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: codestyle

# Commits made in here will not trigger any workflows
# Checkout Duster's documentation for a workaround

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

jobs:
duster-fix:
runs-on: ubuntu-latest

permissions:
contents: write

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

- name: "Duster Fix"
uses: tighten/duster-action@v2
with:
args: fix

- uses: stefanzweifel/git-auto-commit-action@v4
id: auto_commit_action
with:
commit_message: Dusting
commit_user_name: GitHub Action
commit_user_email: actions@github.com

- name: Ignore Duster commit in git blame
if: steps.auto_commit_action.outputs.changes_detected == 'true'
run: echo ${{ steps.auto_commit_action.outputs.commit_hash }} >> .git-blame-ignore-revs

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Ignore Dusting commit in git blame
commit_user_name: GitHub Action
commit_user_email: actions@github.com

duster-lint:
runs-on: ubuntu-latest

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Restore Composer Cache
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependecies
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-reqs

- name: "Duster Lint"
uses: tighten/duster-action@v2
with:
args: lint
58 changes: 58 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: tests

on:
workflow_dispatch:
pull_request:
branches: [development, main]
workflow_run:
workflows: [codestyle]
types: [completed]

jobs:
workbench-tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [8.2, 8.3]
laravel: [^10, ^11]
dependency-version: [prefer-lowest, prefer-stable]

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: zip
coverage: xdebug

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Restore Composer Cache
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install Composer dependecies
run: composer update --no-progress --optimize-autoloader --${{ matrix.dependency-version }}

- name: Directory Permissions
run: sudo chown -R $(whoami) vendor/pestphp/pest/.temp vendor/orchestra

- name: Run tests - coverage threshold 80%
run: composer test -- --coverage --min=80 --coverage-clover clover.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit 3ae8177

Please sign in to comment.