mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-03-30 20:35:40 +00:00
Badge shows pass/fail in the repo. Job summary shows test counts and coverage percentages in the GitHub Actions UI.
68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
paths-ignore:
|
|
- '**.md'
|
|
- 'LICENSE'
|
|
- '.gitignore'
|
|
- 'docs/**'
|
|
|
|
concurrency:
|
|
group: deploy
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci --production=false
|
|
|
|
- name: Unit tests
|
|
run: npm run test:unit
|
|
|
|
- name: Integration tests + coverage
|
|
run: |
|
|
npx c8 --reporter=text-summary --reporter=text sh test-all.sh 2>&1 | tee test-output.txt
|
|
echo "## Test Results" >> $GITHUB_STEP_SUMMARY
|
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
grep -E 'passed|failed|Results|Statements|Branches|Functions|Lines' test-output.txt >> $GITHUB_STEP_SUMMARY
|
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
|
|
|
deploy:
|
|
needs: test
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Validate JS
|
|
run: sh scripts/validate.sh
|
|
|
|
- name: Build and deploy
|
|
run: |
|
|
set -e
|
|
docker build -t meshcore-analyzer .
|
|
docker rm -f meshcore-analyzer 2>/dev/null || true
|
|
docker run -d \
|
|
--name meshcore-analyzer \
|
|
--restart unless-stopped \
|
|
-p 80:80 -p 443:443 -p 1883:1883 \
|
|
-v $HOME/meshcore-data:/app/data \
|
|
-v $HOME/meshcore-config.json:/app/config.json:ro \
|
|
-v $HOME/caddy-data:/data/caddy \
|
|
-v $HOME/meshcore-analyzer/Caddyfile:/etc/caddy/Caddyfile \
|
|
meshcore-analyzer
|
|
echo "Deployed $(git rev-parse --short HEAD)"
|