refactor(tests): update package.json scripts for linting and testing; enhance CI workflows for linting and testing integration
Frontend CI / frontend (push) Successful in 10m38s
Frontend CI / frontend (push) Successful in 10m38s
This commit is contained in:
@@ -8,7 +8,34 @@ on:
|
||||
- v4
|
||||
|
||||
jobs:
|
||||
lint-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
cd frontend && npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Test (frontend build)
|
||||
run: npm run test
|
||||
|
||||
build-and-push-fast:
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint-and-test
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
|
||||
@@ -6,8 +6,32 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
lint-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci
|
||||
cd frontend && npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Test (frontend build)
|
||||
run: npm run test
|
||||
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint-and-test
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -29,7 +53,7 @@ jobs:
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
file: ./Dockerfile.fast
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
cache-from: type=gha
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
name: Frontend CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- tabler
|
||||
- v3
|
||||
- v4
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
- '.gitea/workflows/frontend-ci.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- tabler
|
||||
- v3
|
||||
- v4
|
||||
paths:
|
||||
- 'frontend/**'
|
||||
- '.gitea/workflows/frontend-ci.yml'
|
||||
|
||||
jobs:
|
||||
frontend:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: frontend
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: frontend/package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
- name: Check bundle size
|
||||
id: bundle-size
|
||||
run: |
|
||||
SIZE_BYTES=$(du -sb dist | cut -f1)
|
||||
SIZE_MB=$(awk "BEGIN {printf \"%.2f\", $SIZE_BYTES / 1048576}")
|
||||
echo "size_bytes=$SIZE_BYTES" >> $GITHUB_OUTPUT
|
||||
echo "size_mb=$SIZE_MB" >> $GITHUB_OUTPUT
|
||||
echo "## Bundle size: ${SIZE_MB} MB" >> $GITHUB_STEP_SUMMARY
|
||||
# Fail if total bundle exceeds 5MB
|
||||
BUNDLE_LIMIT_BYTES=5242880
|
||||
if [ "$SIZE_BYTES" -gt "$BUNDLE_LIMIT_BYTES" ]; then
|
||||
echo "::error::Bundle size (${SIZE_MB} MB) exceeds 5MB limit"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user