Skip to content

Commit

Permalink
Merge branch 'dev' into template
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 authored Nov 4, 2023
2 parents eaeb626 + d11d815 commit a172674
Show file tree
Hide file tree
Showing 395 changed files with 15,558 additions and 5,920 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ rector.php export-ignore
vite.config.js export-ignore

.github/ export-ignore
admin/ export-ignore
docs/ export-ignore
resources/ export-ignore
18 changes: 10 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
interval: "weekly"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
37 changes: 37 additions & 0 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ASSETS

on:
pull_request:
branches:
- "dev"
paths:
- ".github/workflows/assets.yml"
- "resources/**"
- "package.json"

jobs:
build:
name: Generator
if: github.repository == 'ataslangit/sistem-informasi-desa'
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependency
run: npm install
- name: Generate
run: npm run build
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Assets auto generate"
10 changes: 6 additions & 4 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy Docs
name: Docs

on:
push:
Expand All @@ -9,13 +9,15 @@ on:
- ".github/workflows/deploy-docs.yml"

jobs:
deploy:
runs-on: ubuntu-latest
build:
name: Deploy
if: github.repository == 'ataslangit/sistem-informasi-desa'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
- name: Cache dependencies
Expand Down
21 changes: 13 additions & 8 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: draft-release
name: Build ZIP release

on:
push:
Expand All @@ -7,20 +7,25 @@ on:

jobs:
build:
runs-on: ubuntu-latest
name: Draft
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- id: get_zipball_name
run: echo ::set-output name=ZIPBALL_NAME::${{ github.event.repository.name }}-${{ github.ref_name }}
- name: Set Nama file ZIP
id: get_zipball_name
run: echo "ZIPBALL_NAME=${{ github.event.repository.name }}-${{ github.ref_name }}" >> $GITHUB_OUTPUT

- run: composer install --ansi --no-progress --no-interaction --prefer-dist --no-dev
- name: Jalankan Composer
run: composer install --ansi --no-progress --no-interaction --prefer-dist --no-dev

- uses: thedoctor0/zip-release@main
- name: Buat file ZIP
uses: thedoctor0/zip-release@main
with:
type: "zip"
filename: "${{ steps.get_zipball_name.outputs.ZIPBALL_NAME }}.zip"
exclusions: "*.git* /*docs/* /*resources/* .editorconfig .php-cs-fixer.php code_of_conduct.md composer.lock package-lock.json package.json vite.config.js"
exclusions: "*.git* /*admin/* /*docs/* /*resources/* .editorconfig .php-cs-fixer.php code_of_conduct.md composer.lock package-lock.json package.json rector.php vite.config.js"

- name: Upload Release
uses: ncipollo/release-action@v1
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ on:
jobs:
build:
name: Validate
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4

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

- name: Install Dependency
run: composer install

- name: Run PHP-CS-FIXER
run: composer run cs
42 changes: 42 additions & 0 deletions .github/workflows/phpmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PHPMD

on:
push:
branches: ["dev"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["dev"]
schedule:
- cron: '27 4 * * 2'

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
contents: read # for checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status

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

- name: Setup PHP
uses: shivammathur/setup-php@aa1fe473f9c687b6fb896056d771232c0bc41161
with:
coverage: none
tools: phpmd

- name: Run PHPMD
run: phpmd donjo-app sarif codesize,cleancode,naming,unusedcode --reportfile phpmd-results.sarif
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: phpmd-results.sarif
wait-for-processing: true
43 changes: 43 additions & 0 deletions .github/workflows/pr-dependabot-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: PULL_REQUEST

on:
pull_request_review:
types: [submitted]

permissions:
actions: write
contents: write
pull-requests: write

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request._links.html.href }}

jobs:
build:
name: MERGE & LOCK
runs-on: ubuntu-22.04
if: >-
github.event.review.state == 'APPROVED' &&
github.event.review.user.id == 2387514
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get PR Title
id: getTitle
run: echo "title=$(gh pr view --json=title --jq '.title' $PR_URL)" >> $GITHUB_OUTPUT

- name: Squash & Merge
uses: "pascalgn/[email protected]"
id: squashmerge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_METHOD: "squash"
MERGE_LABELS: "dependencies"
MERGE_COMMIT_MESSAGE: "(#{pullRequest.number}) ${{ steps.getTitle.outputs.title }}"

- if: steps.squashmerge.outputs.mergeResult == 'merged'
name: lock PR
run: gh pr lock ${{ steps.squashmerge.outputs.pullRequestNumber }} -r "resolved"
File renamed without changes.
31 changes: 31 additions & 0 deletions admin/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"`
STAGED_PHP_FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php$`

echo "Starting pre-commit..."

if [ "$STAGED_PHP_FILES" != "" ]; then
echo "Linting PHP code..."
for FILE in $STAGED_PHP_FILES; do
php -l -d display_errors=0 "$PROJECT/$FILE"

if [ $? != 0 ]; then
echo "Fix the error(s) before commit."
exit 1
fi

FILES="$FILES $FILE"
done
fi

if [ "$FILES" != "" ]; then
echo "Running PHP CS Fixer..."

composer run csfix
fi

echo "Add all to stage changes..."
git add .

exit $?
7 changes: 7 additions & 0 deletions admin/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

# Install a pre-commit hook that
# automatically runs php-cs-fixer to lint code
mkdir -p .git/hooks
cp admin/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"license": "GPL-3.0-or-later",
"require": {
"php": "^7.4 || ^8.0",
"codeigniter4/framework": "4.4.1",
"codeigniter4/framework": "4.4.3",
"kenjis/ci3-to-4-upgrade-helper": "0.8.0",
"totoprayogo1916/codeigniter-additional": "^1.0"
},
"require-dev": {
"codeigniter/coding-standard": "^1.1",
"fakerphp/faker": "^1.9",
"mikey179/vfsstream": "1.6.*",
"rector/rector": "0.18.4"
"rector/rector": "0.18.6"
},
"autoload": {
"exclude-from-classmap": [
Expand All @@ -29,6 +30,10 @@
},
"scripts": {
"cs": "./donjo-sys/bin/php-cs-fixer fix --ansi --verbose --dry-run --diff",
"csfix": "./donjo-sys/bin/php-cs-fixer fix --ansi --verbose --diff"
"csfix": "./donjo-sys/bin/php-cs-fixer fix --ansi --verbose --diff",
"update-resources": "git submodule update --init --remote resources",
"post-update-cmd": [
"bash -c \"if [ -f admin/setup.sh ]; then bash admin/setup.sh; fi\""
]
}
}
2 changes: 1 addition & 1 deletion donjo-app/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function asset(string $file): string
}

// Decode the JSON file.
$manifest = json_decode(file_get_contents($manifest_path), true, 512, JSON_THROW_ON_ERROR);
$manifest = json_decode(file_get_contents($manifest_path), true);

// Check if the file exists in the manifest file.
if (! isset($manifest[$file])) {
Expand Down
4 changes: 4 additions & 0 deletions donjo-app/Config/Autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ class Autoload extends AutoloadConfig
* @phpstan-var list<string>
*/
public $helpers = [
'donjolib',
'form',
'html',
'pict',
'text',
];
}
2 changes: 2 additions & 0 deletions donjo-app/Config/Boot/development.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(-1);
ini_set('display_errors', '1');
Expand Down
2 changes: 2 additions & 0 deletions donjo-app/Config/Boot/production.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
ini_set('display_errors', '0');
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
Expand Down
6 changes: 6 additions & 0 deletions donjo-app/Config/Boot/testing.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<?php

/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You can’t use it for your development.
*/

/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
Expand Down
2 changes: 1 addition & 1 deletion donjo-app/Config/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class Exceptions extends BaseConfig
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $throwable): ExceptionHandlerInterface
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
Expand Down
7 changes: 5 additions & 2 deletions donjo-app/Config/Filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Config;

use App\Filters\IsLogin;
use App\Filters\SudahInstall;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Filters\CSRF;
Expand All @@ -16,8 +17,9 @@ class Filters extends BaseConfig
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, string>
* @phpstan-var array<string, class-string>
* @var array<string, array<int, string>|string> [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
* @phpstan-var array<string, class-string|list<class-string>>
*/
public array $aliases = [
'csrf' => CSRF::class,
Expand All @@ -26,6 +28,7 @@ class Filters extends BaseConfig
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
'sudahinstall' => SudahInstall::class,
'isLogin' => IsLogin::class,
];

/**
Expand Down
Loading

0 comments on commit a172674

Please sign in to comment.