mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-07-17 17:21:48 +00:00
88 lines
2.4 KiB
YAML
88 lines
2.4 KiB
YAML
name: Prober - Docker
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: '0 5 * * *'
|
|
|
|
permissions:
|
|
contents: read
|
|
actions: write
|
|
|
|
concurrency:
|
|
group: prober-${{ github.workflow }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
prober:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Pull Docker image
|
|
run: docker pull ghcr.io/pewu/topola-viewer:latest
|
|
|
|
- name: Run container
|
|
run: |
|
|
docker run -d -p 8080:8080 -e STATIC_URL=test.ged \
|
|
-v $(pwd)/src/datasource/testdata/test.ged:/app/public/test.ged \
|
|
--name topola-prober-${{ github.run_id }} \
|
|
ghcr.io/pewu/topola-viewer:latest
|
|
|
|
- name: Wait for container to be ready
|
|
run: |
|
|
for i in $(seq 1 30); do
|
|
if curl -sf -o /dev/null http://localhost:8080/; then break; fi
|
|
sleep 1
|
|
done
|
|
curl -sf -o /dev/null http://localhost:8080/
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24.x
|
|
cache: 'npm'
|
|
|
|
- run: npm ci
|
|
|
|
- name: Get Playwright version
|
|
id: playwright-version
|
|
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> $GITHUB_OUTPUT
|
|
|
|
- name: Cache Playwright Browsers
|
|
id: cache-playwright
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/ms-playwright
|
|
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
|
|
|
|
- name: Install Playwright System Dependencies
|
|
run: npx playwright install-deps chromium
|
|
|
|
- name: Install Playwright Browsers (If Not Cached)
|
|
if: steps.cache-playwright.outputs.cache-hit != 'true'
|
|
run: npx playwright install chromium
|
|
|
|
- name: Run prober
|
|
env:
|
|
PLAYWRIGHT_HTML_REPORT: playwright-report/prober
|
|
run: npx playwright test --config=playwright.prober.config.ts docker.spec.ts
|
|
|
|
- name: Upload Playwright report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: prober-report-docker
|
|
path: playwright-report/
|
|
retention-days: 30
|
|
|
|
- name: Stop and remove container
|
|
if: always()
|
|
run: |
|
|
docker stop topola-prober-${{ github.run_id }} 2>/dev/null || true
|
|
docker rm topola-prober-${{ github.run_id }} 2>/dev/null || true
|