ci: add eslint, vitest coverage, improved CI and deploy workflows
This commit is contained in:
@@ -2,10 +2,12 @@ name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [dev]
|
||||
branches-ignore: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
lint-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -18,10 +20,12 @@ jobs:
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npx eslint src/ --ext .js,.jsx,.ts,.tsx --max-warnings 0 || true
|
||||
run: npx eslint src/ --max-warnings 0
|
||||
|
||||
- name: Test
|
||||
run: npx vitest run --reporter=verbose
|
||||
run: npx vitest run --coverage --reporter=verbose
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Coverage Check
|
||||
run: |
|
||||
npx vitest run --coverage 2>&1 | tee coverage-output.txt
|
||||
echo "Coverage report generated"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Deploy Production
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -8,14 +8,18 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
- name: Deploy pulse-web
|
||||
run: |
|
||||
cd /opt/digital-home/pulse-web
|
||||
docker compose pull
|
||||
docker compose up -d --build
|
||||
echo "Waiting for container..."
|
||||
sleep 5
|
||||
STATUS=$(docker inspect --format='{{.State.Status}}' pulse-web 2>/dev/null || echo "unknown")
|
||||
echo "Container status: $STATUS"
|
||||
if [ "$STATUS" != "running" ]; then
|
||||
echo "::error::Container is not running after deploy"
|
||||
docker logs pulse-web --tail=20
|
||||
exit 1
|
||||
fi
|
||||
echo "Deploy successful!"
|
||||
|
||||
Reference in New Issue
Block a user