forked from lynx-family/lynx-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (145 loc) · 5 KB
/
workflow-test.yml
File metadata and controls
147 lines (145 loc) · 5 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Reusable Test
on:
workflow_call:
secrets:
CODECOV_TOKEN:
required: false
LHCI_GITHUB_APP_TOKEN:
required: false
MIDSCENE_MODEL_API_KEY:
required: false
MIDSCENE_MODEL_BASE_URL:
required: false
MIDSCENE_MODEL_FAMILY:
required: false
MIDSCENE_MODEL_NAME:
required: false
MIDSCENE_OPENAI_INIT_CONFIG_JSON:
required: false
inputs:
runs-on:
required: true
type: string
run:
required: true
type: string
description: "Command run parameters, limited to predefined test commands"
is-web:
required: false
type: boolean
default: false
upload-codecov:
required: false
type: boolean
default: true
web-report-name:
required: false
type: string
default: "playwright-report"
web-report-path:
required: false
type: string
default: "packages/web-platform/web-core-e2e/playwright-report"
artifact-name:
required: false
type: string
default: ""
artifact-path:
required: false
type: string
default: ""
artifact-if-no-files-found:
required: false
type: string
default: "warn"
codecov-flags:
required: false
type: string
default: "unittest"
# Set minimum permissions to prevent unnecessary access
permissions: {}
env:
CI: 1
TURBO_TELEMETRY_DISABLED: 1
jobs:
check:
timeout-minutes: 30
runs-on: ${{ inputs.runs-on }}
permissions: {}
container:
image: ${{ inputs.is-web && 'mcr.microsoft.com/playwright:v1.58.2-noble' || null }}
env:
CI: 1
TURBO_TELEMETRY_DISABLED: 1
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
with:
# Codecov requires fetch-depth: 0
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
with:
node-version: "22"
package-manager-cache: false
- name: TurboCache
uses: lynx-infra/cache@5c6160a6a4c7fca80a2f3057bb9dfc9513fcb732
with:
path: .turbo
# We have to be strict here to make sure getting the cache of build-all
key: turbo-v4-${{ runner.os }}-${{ hashFiles('**/packages/**/src/**/*.rs') }}-${{ github.sha }}
fail-on-cache-miss: true
- name: Install
run: |
npm install -g corepack@latest
corepack enable
pnpm install --frozen-lockfile
- name: Build
run: pnpm turbo build --summarize
- name: Test # zizmor: ignore[template-injection] The inputs.run is provided by us.
id: test
env:
NODE_OPTIONS: --max-old-space-size=16384
GITHUB_SHA: ${{ github.event.pull_request.head.sha }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
MIDSCENE_MODEL_API_KEY: ${{ secrets.MIDSCENE_MODEL_API_KEY }}
MIDSCENE_MODEL_BASE_URL: ${{ secrets.MIDSCENE_MODEL_BASE_URL }}
MIDSCENE_MODEL_FAMILY: ${{ secrets.MIDSCENE_MODEL_FAMILY }}
MIDSCENE_MODEL_NAME: ${{ secrets.MIDSCENE_MODEL_NAME }}
MIDSCENE_OPENAI_INIT_CONFIG_JSON: ${{ secrets.MIDSCENE_OPENAI_INIT_CONFIG_JSON }}
run: ${{ inputs.run }}
- name: Upload coverage reports to Codecov
if: ${{ inputs.upload-codecov }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ inputs.codecov-flags }}
- name: Upload test results to Codecov
if: ${{ !cancelled() && inputs.upload-codecov }}
continue-on-error: true
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ inputs.codecov-flags }}
override_branch: ${{ github.event_name == 'merge_group' && 'main' || '' }}
- name: Upload Artifact
if: ${{ always() && !cancelled() && inputs.artifact-name != '' && inputs.artifact-path != '' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ inputs.artifact-name }}
path: ${{ inputs.artifact-path }}
if-no-files-found: ${{ inputs.artifact-if-no-files-found }}
retention-days: 1
overwrite: true
include-hidden-files: true
- name: Upload Test Result
if: ${{ inputs.is-web && failure() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ inputs.web-report-name }}
path: ${{ inputs.web-report-path }}
if-no-files-found: error
retention-days: 1
overwrite: true
include-hidden-files: true