-
Notifications
You must be signed in to change notification settings - Fork 0
157 lines (140 loc) · 4.97 KB
/
Copy pathnode-compat-smoke.yml
File metadata and controls
157 lines (140 loc) · 4.97 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
148
149
150
151
152
153
154
155
156
157
name: Node Compatibility Smoke
on:
pull_request:
paths:
- "packages/memory-server/**"
- "src/main/java/org/jongodb/server/**"
- "testkit/node-compat/**"
- ".github/workflows/node-compat-smoke.yml"
push:
branches:
- main
paths:
- "packages/memory-server/**"
- "src/main/java/org/jongodb/server/**"
- "testkit/node-compat/**"
- ".github/workflows/node-compat-smoke.yml"
workflow_dispatch:
schedule:
- cron: "0 4 * * *"
permissions:
contents: read
jobs:
smoke:
name: node-compat smoke (${{ matrix.os }}, node-${{ matrix.node }})
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
node:
- "20"
- "22"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Temurin 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Set up Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
cache-dependency-path: |
package-lock.json
testkit/node-compat/package-lock.json
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: "8.10.2"
- name: Install root workspace dependencies
run: npm ci
- name: Build memory-server package
run: npm run node:build
- name: Resolve launcher classpath
id: classpath
shell: bash
run: |
CLASSPATH=$(gradle --no-daemon -q printLauncherClasspath | tail -n 1)
if [[ -z "$CLASSPATH" ]]; then
echo "Failed to resolve launcher classpath."
exit 1
fi
echo "value=$CLASSPATH" >> "$GITHUB_OUTPUT"
- name: Install node compatibility smoke dependencies
run: npm --prefix testkit/node-compat ci
- name: Run node compatibility smoke suite
env:
JONGODB_CLASSPATH: ${{ steps.classpath.outputs.value }}
run: npm --prefix testkit/node-compat test
- name: Render lane summary
if: always()
run: |
python3 - <<'PY'
import json
import os
from pathlib import Path
lane = "${{ matrix.os }}-node${{ matrix.node }}"
report_path = Path("testkit/node-compat/reports/node-compat-smoke.json")
summary_path = Path(f"testkit/node-compat/reports/node-compat-smoke-summary-{lane}.md")
lines = [
"# Node Compatibility Smoke Lane Summary",
"",
f"- lane: {lane}",
]
if report_path.exists():
report = json.loads(report_path.read_text(encoding="utf-8"))
summary = report.get("summary", {})
scenarios = report.get("scenarios", [])
failed = [s for s in scenarios if s.get("status") != "pass"]
lines.extend([
f"- generatedAt: {report.get('generatedAt', 'unknown')}",
f"- total={summary.get('total', 0)} passed={summary.get('passed', 0)} failed={summary.get('failed', 0)}",
"",
"## Failed Scenarios",
])
if failed:
for scenario in failed:
lines.append(f"- {scenario.get('name', 'unknown')} ({scenario.get('status', 'unknown')})")
else:
lines.append("- none")
else:
lines.extend([
"- report: missing",
"",
"## Failed Scenarios",
"- report not generated",
])
lines.extend([
"",
"## Reproduce",
"```bash",
"npm run node:build",
"export JONGODB_CLASSPATH=\"$(./.tooling/gradle-8.10.2/bin/gradle --no-daemon -q printLauncherClasspath | tail -n 1)\"",
"npm --prefix testkit/node-compat ci",
"npm --prefix testkit/node-compat test",
"```",
"",
])
summary_path.parent.mkdir(parents=True, exist_ok=True)
summary_path.write_text("\n".join(lines), encoding="utf-8")
if step_summary := os.environ.get("GITHUB_STEP_SUMMARY"):
with open(step_summary, "a", encoding="utf-8") as fp:
fp.write(summary_path.read_text(encoding="utf-8"))
PY
- name: Upload node compatibility report
if: always()
uses: actions/upload-artifact@v4
with:
name: node-compat-smoke-report-${{ matrix.os }}-node${{ matrix.node }}
path: |
testkit/node-compat/reports/node-compat-smoke.json
testkit/node-compat/reports/node-compat-smoke-summary-${{ matrix.os }}-node${{ matrix.node }}.md
if-no-files-found: warn
retention-days: 14