Skip to content

Commit

Permalink
ci: test with php 8.2 and simplify workflows (monicahq/chandler#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Mar 31, 2023
1 parent 8423f30 commit 326ae9a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 79 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/build_assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ on:
release:
types: [created]

workflow_run:
workflows: [PHP linting (Pint), Javascript linting]
types: [completed]
branches-ignore: [main]

env:
node-version: 18

Expand Down
32 changes: 2 additions & 30 deletions .github/workflows/lint_php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]

workflow_run:
workflows: [Javascript linting]
types: [completed]
branches-ignore: [main]

concurrency:
group: Lint php ${{ github.ref }}
cancel-in-progress: true
Expand All @@ -23,42 +18,19 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
if: env.GH_TOKEN != ''
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- uses: actions/checkout@v3
if: env.GH_TOKEN == ''
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Checkout sources
uses: actions/checkout@v3

- name: laravel-pint
uses: aglipanci/laravel-pint-action@1.0.0
with:
preset: laravel

- name: Commit changes
if: env.GH_TOKEN != ''
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: php linting with pint'
skip_fetch: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Check if there is any file update needed
if: env.GH_TOKEN == ''
run: |
status=$(git status --porcelain)
if [ -n "$status" ]; then
echo -e "Waiting modifications:\n$status"
echo "::error::Laravel pint found fixes. Please run 'vendor/bin/pint' prior to your next commit."
exit -1
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
32 changes: 2 additions & 30 deletions .github/workflows/lint_vue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]

workflow_run:
workflows: [PHP linting (Pint)]
types: [completed]
branches-ignore: [main]

concurrency:
group: Lint js ${{ github.ref }}
cancel-in-progress: true
Expand All @@ -23,19 +18,8 @@ jobs:
fail-fast: false

steps:
- uses: actions/checkout@v3
if: env.GH_TOKEN != ''
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_TOKEN }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- uses: actions/checkout@v3
if: env.GH_TOKEN == ''
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Checkout sources
uses: actions/checkout@v3

# Yarn
- name: Setup Node.js
Expand All @@ -62,23 +46,11 @@ jobs:
- name: Run prettier
run: yarn run format

- name: Commit changes
if: env.GH_TOKEN != ''
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore: javascript linting with eslint and prettier'
skip_fetch: true
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Check if there is any file update needed
if: env.GH_TOKEN == ''
run: |
status=$(git status --porcelain)
if [ -n "$status" ]; then
echo -e "Waiting modifications:\n$status"
echo "::error::Eslint and prettier found fixes. Please run 'yarn run lint' and 'yarn run format' prior to your next commit."
exit -1
fi
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
7 changes: 1 addition & 6 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ on:
pull_request:
types: [opened, synchronize, reopened]

workflow_run:
workflows: [PHP linting (Pint), Javascript linting]
types: [completed]
branches-ignore: [main]

env:
php-version: '8.1'
php-version: '8.2'

concurrency:
group: Static ${{ github.ref }}
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,8 @@ on:
release:
types: [created]

workflow_run:
workflows: [PHP linting (Pint), Javascript linting]
types: [completed]
branches-ignore: [main]

env:
default-php-version: '8.1'
default-php-version: '8.2'
coverage-with: sqlite

concurrency:
Expand All @@ -33,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1']
php-version: ['8.1', '8.2']
connection: [sqlite, mysql, pgsql]
testsuite: [Unit]
coverage: [true] # run test with coverage, if 'coverage-with' match with the connection
Expand All @@ -55,6 +50,8 @@ jobs:
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom, fileinfo, ${{ matrix.connection }}
coverage: pcov
ini-values: pcov.directory=., pcov.exclude="~vendor~"
- name: Check PHP Version
run: php -v
- name: Check Composer Version
Expand Down Expand Up @@ -124,7 +121,7 @@ jobs:
# Test
- name: Run tests suite with coverage
if: matrix.connection == env.coverage-with && matrix.php-version == env.default-php-version && matrix.coverage
run: php -dpcov.enabled=1 -dpcov.directory=. -dpcov.exclude="~vendor~" vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage${{ matrix.testsuite }}.xml
run: vendor/bin/phpunit -c phpunit.xml --testsuite ${{ matrix.testsuite }} --log-junit ./results/${{ matrix.connection }}/junit/results${{ matrix.testsuite }}.xml --coverage-clover ./results/${{ matrix.connection }}/coverage/coverage${{ matrix.testsuite }}.xml
env:
DB_CONNECTION: ${{ matrix.connection }}
- name: Run tests
Expand Down

0 comments on commit 326ae9a

Please sign in to comment.