Repository navigation
86 lines (74 loc) · 3.04 KB
/
Copy pathexample-todomvc.yml
File metadata and controls
86 lines (74 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Example TodoMVC
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: {}
permissions:
contents: read
jobs:
midscene-test:
# Fork PRs cannot access model secrets; quality checks still run there.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: read
environment:
name: CI
url: ${{ steps.test.outputs.page-url }}
env:
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_NAME: ${{ vars.MIDSCENE_MODEL_NAME || secrets.MIDSCENE_MODEL_NAME }}
MIDSCENE_MODEL_BASE_URL: ${{ vars.MIDSCENE_MODEL_BASE_URL || secrets.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_FAMILY: ${{ vars.MIDSCENE_MODEL_FAMILY || secrets.MIDSCENE_MODEL_FAMILY }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: '24'
cache: npm
cache-dependency-path: examples/todomvc/package-lock.json
- name: Install example dependencies and browser
working-directory: examples/todomvc
run: |
npm ci
npm run typecheck
npx playwright install --with-deps chromium
- name: Prepare AI CI
id: ai-ci
uses: web-infra-dev/midscene/.github/actions/ai-ci@a9d6f208dd3adb35ec281b452e31c96704adc116 # main
- name: Run real Midscene tests with this Action
uses: ./
id: test
env:
NODE_OPTIONS: ${{ steps.ai-ci.outputs.node-options }}
with:
working-directory: examples/todomvc
command: npm test
publish-pages: true
cloudflare-api-token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
cloudflare-account-id: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
artifact-name: example-todomvc-${{ github.run_id }}-${{ github.run_attempt }}
- name: Download native report artifact
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ steps.test.outputs.report-artifact-name }}
path: ${{ runner.temp }}/midscene-reports
- name: Verify downloaded native report
working-directory: ${{ runner.temp }}/midscene-reports
shell: bash
run: |
shopt -s nullglob
summaries=(midscene_run/test-results/*/summary.json .midscene/test-results/*/summary.json)
[[ ${#summaries[@]} == 1 ]]
report=$(jq -er '.report | select(type == "string" and length > 0)' "${summaries[0]}")
test -s "$(dirname "${summaries[0]}")/$report"
- name: Check published report
if: ${{ steps.test.outputs.page-url != '' }}
env:
PAGE_URL: ${{ steps.test.outputs.page-url }}
run: >-
curl --fail --location --retry 10 --retry-all-errors --retry-delay 3 --max-time 15
--output /dev/null "$PAGE_URL"