Merge branch 'main' of http://git.wdipl.com/KLC/KLC-Website-Frontend
This commit is contained in:
34
.gitea/workflows/build.yml
Normal file
34
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Build-Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- beta
|
||||||
|
- testing
|
||||||
|
- client
|
||||||
|
- staging
|
||||||
|
- production
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-test:
|
||||||
|
name: Build and Test PR
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 20
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build Check
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Audit Dependencies
|
||||||
|
run: npm audit --audit-level=critical
|
||||||
67
.gitea/workflows/compressimage.yml
Normal file
67
.gitea/workflows/compressimage.yml
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
name: Enforce Image Standards
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- beta
|
||||||
|
- testing
|
||||||
|
- client
|
||||||
|
- staging
|
||||||
|
- production
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
paths:
|
||||||
|
- '**/*.jpg'
|
||||||
|
- '**/*.jpeg'
|
||||||
|
- '**/*.png'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
optimize:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ gitea.head_ref }} # IMPORTANT
|
||||||
|
|
||||||
|
- name: Install Image Tools
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y imagemagick jpegoptim pngquant
|
||||||
|
|
||||||
|
- name: Resize Oversized Images
|
||||||
|
run: |
|
||||||
|
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" \) \
|
||||||
|
-exec mogrify -resize 1920x1920\> {} \;
|
||||||
|
|
||||||
|
- name: Optimize JPEG
|
||||||
|
run: |
|
||||||
|
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) \
|
||||||
|
-exec jpegoptim --strip-all --max=85 {} \;
|
||||||
|
|
||||||
|
- name: Optimize PNG
|
||||||
|
run: |
|
||||||
|
find . -type f -iname "*.png" \
|
||||||
|
-exec pngquant --force --ext .png --quality=75-90 {} \;
|
||||||
|
|
||||||
|
# Commit changes if any
|
||||||
|
- name: Commit changes
|
||||||
|
run: |
|
||||||
|
git config --global user.name "CI Bot"
|
||||||
|
git config --global user.email "ci@local"
|
||||||
|
|
||||||
|
if [ -n "$(git status --porcelain)" ]; then
|
||||||
|
git add .
|
||||||
|
git commit -m "chore: optimize images via CI"
|
||||||
|
else
|
||||||
|
echo "No changes to commit"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Push back to PR branch
|
||||||
|
- name: Push changes
|
||||||
|
if: success()
|
||||||
|
run: |
|
||||||
|
git push origin HEAD:${{ gitea.head_ref }}
|
||||||
39
.gitea/workflows/sonar.yml
Normal file
39
.gitea/workflows/sonar.yml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: Sonar Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- beta
|
||||||
|
- testing
|
||||||
|
- client
|
||||||
|
- staging
|
||||||
|
- production
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sonarqube:
|
||||||
|
name: SonarQube Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: sonarsource/sonar-scanner-cli:12.0.0.3214_8.0.1
|
||||||
|
options: --user root
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Run Sonar Scan
|
||||||
|
run: |
|
||||||
|
REPO_NAME=${{ gitea.event.repository.name }}
|
||||||
|
|
||||||
|
sonar-scanner \
|
||||||
|
-Dsonar.projectKey=$REPO_NAME \
|
||||||
|
-Dsonar.projectName=$REPO_NAME \
|
||||||
|
-Dsonar.sources=. \
|
||||||
|
-Dsonar.host.url=${{ secrets.SONARQUBE_HOST }} \
|
||||||
|
-Dsonar.token=${{ secrets.SONARQUBE_TOKEN }} \
|
||||||
|
-Dsonar.exclusions=node_modules/**,dist/**,coverage/** \
|
||||||
|
-Dsonar.qualitygate.wait=true
|
||||||
Reference in New Issue
Block a user