Skip to content

Commit

Permalink
(#581) Perbaikan GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
totoprayogo1916 authored Dec 11, 2023
1 parent b2aa655 commit df81281
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 61 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/auto.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/composer-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Composer

on:
pull_request:
branches:
- "4.5.x"
paths:
- "composer.json"
- ".github/workflows/composer-validate.yml"

permissions:
contents: read

jobs:
validate:
name: Validate in PHP ${{ matrix.php-versions }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-versions: ["7.4", "8.0", "8.1", "8.2"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, json, mysqlnd, libcurl
coverage: xdebug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Validate composer.json
run: composer validate --no-check-all
- name: Install dependencies
run: composer update --ansi --no-interaction
8 changes: 4 additions & 4 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
build:
name: Deploy
if: github.repository == 'ataslangit/sistem-informasi-desa'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- 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 All @@ -28,7 +28,7 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npm install
- run: npm run docs:build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
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@v3
- 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/* .editorconfig .php-cs-fixer.php code_of_conduct.md composer.json package-lock.json package.json"
exclusions: "*.git* /*docs/* .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
10 changes: 5 additions & 5 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: PHP-CS-FIXER
on:
pull_request:
branches:
- "dev"
- "4.5.x"
paths:
- ".github/workflows/php-cs-fixer.yml"
- "composer.json"
Expand All @@ -13,18 +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: ["4.5.x"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["4.5.x"]
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"
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"name": "ataslangit/sistem-informasi-desa",
"description": "Sistem Informasi Desa pengambangan dari CRI",
"license": "GPL-3.0-or-later",
"require": {
"php": ">=7.4",
"codeigniter/framework": "^3",
Expand Down

0 comments on commit df81281

Please sign in to comment.