Skip to content

Commit

Permalink
Add GitHub Actions workflow for code checks (#11)
Browse files Browse the repository at this point in the history
* Add GitHub Actions workflow to checks both php and javascript files

* use explicit php version

* update composer dependencies & install phpstan

---------

Co-authored-by: Ali Kemal Özkan <[email protected]>
  • Loading branch information
InensusDev and Ali Kemal Özkan authored Dec 1, 2023
1 parent c4017d3 commit 24393bb
Show file tree
Hide file tree
Showing 6 changed files with 2,292 additions and 1,241 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/php_linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code Quality

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

jobs:
laravel-lint:
runs-on: ubuntu-latest

strategy:
matrix:
php: [8.2]

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

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

- name: Install Composer Dependencies
run: |
composer install --no-interaction --prefer-dist
working-directory: ./Website/htdocs/mpmanager

- name: Run Code sniffer
run: ./vendor/bin/phpcbf --standard=PSR12 --tab-width=4 app/
working-directory: ./Website/htdocs/mpmanager
continue-on-error: true

- name: Run PHPStan
run: ./vendor/bin/phpstan analyze app/Http app/Services --memory-limit=4G --level=1
working-directory: ./Website/htdocs/mpmanager
continue-on-error: true
87 changes: 87 additions & 0 deletions .github/workflows/ui_linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Code Quality

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

jobs:
setup-node:
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.10.0

eslint-js:
needs: setup-node
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.10.0

- name: Install Node.js dependencies
run: npm install
working-directory: ./Website/ui

- name: Run ESLint for JavaScript files
run: npx eslint ./src/**/*.js
working-directory: ./Website/ui
continue-on-error: true

eslint-vue:
needs: setup-node
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.10.0

- name: Install Node.js dependencies
run: npm install
working-directory: ./Website/ui

- name: Run ESLint for Vue files
run: npx eslint ./src/**/*.vue
working-directory: ./Website/ui
continue-on-error: true

build-production:
needs: setup-node
runs-on: ubuntu-latest

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

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.10.0

- name: Install Node.js dependencies
run: npm install
working-directory: ./Website/ui

- name: Build npm on production mode
run: npm run production
working-directory: ./Website/ui
2 changes: 1 addition & 1 deletion Docker/DockerfileLaravelDev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8-apache
FROM php:8.2-apache

RUN apt-get update && \
apt-get install -y \
Expand Down
7 changes: 4 additions & 3 deletions Website/htdocs/mpmanager/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@
"webpatser/laravel-uuid": "^4.0"
},
"require-dev": {
"roave/security-advisories": "dev-latest",
"barryvdh/laravel-debugbar": "^3.5",
"barryvdh/laravel-debugbar": "^3.5",
"beyondcode/laravel-dump-server": "^1.8",
"spatie/laravel-ignition": "^1.0",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^6.1",
"phpstan/phpstan": "^1.1",
"phpunit/phpunit": "^9.0",
"roave/security-advisories": "dev-latest",
"spatie/laravel-ignition": "^1.0",
"spatie/laravel-web-tinker": "^1.7",
"squizlabs/php_codesniffer": "*",
"vimeo/psalm": "^4.4"
Expand Down
Loading

0 comments on commit 24393bb

Please sign in to comment.