Repository navigation
131 lines (114 loc) · 4.81 KB
/
Copy pathtest.yml
File metadata and controls
131 lines (114 loc) · 4.81 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
# Default job `test` is what a pull request must pass. It does not need the
# proprietary IDM jars or dirxml-simulator (neither is in this repo).
# Job `engine` runs the full `mvn -B test` only when the repository variable
# RUN_ENGINE_TESTS is true. On a clean GitHub-hosted runner that variable is
# unset, so the job is skipped and the workflow stays green.
# See docs/install.md section 2.4.
name: test
on:
push:
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Validate workflow YAML
run: |
python3 - << 'PY'
import sys
try:
import yaml
except ImportError:
import subprocess
subprocess.check_call([sys.executable, "-m", "pip", "install", "pyyaml", "-q"])
import yaml
with open(".github/workflows/test.yml") as f:
data = yaml.safe_load(f)
jobs = data["jobs"]
assert "test" in jobs and "engine" in jobs
assert "idm.portable" in open(".github/workflows/test.yml").read()
print("workflow yaml ok", sorted(jobs))
PY
- name: Shell syntax
run: |
dash -n bin/idm
dash -n bin/require-engine.sh
dash -n bin/ci-portable.sh
python3 -m py_compile bin/apps
- name: Engine jars (informational)
run: bash bin/require-engine.sh --inform
- name: Doctor shell fallback
run: |
set +e
out=$(HOME="$(mktemp -d)" bin/idm doctor --json)
code=$?
set -e
printf '%s\n' "$out"
test "$code" -eq 1
printf '%s\n' "$out" | python3 -c 'import json,sys; d=json.load(sys.stdin); assert d["ok"] is False; names={c["name"] for c in d["checks"]}; assert {"jdk","simulator","lib"} <= names'
- name: Trace parser (DirXMLTraceViewer release)
env:
GH_TOKEN: ${{ github.token }}
run: |
TRACE=$(sed -n 's#.*<tracecore.version>\([^<]*\)</tracecore.version>.*#\1#p' pom.xml | head -1)
gh release download "v$TRACE" --repo PointBlueTechnology/DirXMLTraceViewer -p "dirxml-trace-core-$TRACE.jar" -D /tmp
printf '<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion><groupId>com.pointbluetech</groupId><artifactId>dirxml-trace-core</artifactId><version>%s</version></project>' "$TRACE" > /tmp/trace-core.pom
mvn -B -q install:install-file -Dfile=/tmp/dirxml-trace-core-$TRACE.jar -DpomFile=/tmp/trace-core.pom
- name: Portable tests
run: mvn -B -Pidm.portable test
- name: Set up Node 22
uses: actions/setup-node@v4
with:
node-version: "22"
- name: MCP server tests
working-directory: mcp/dirxmldev-mcp
run: |
npm ci
npm test
engine:
# Full suite. Skipped unless a maintainer turns it on (self-hosted runner
# or a machine that already has lib/ and the simulator). A skip is not a failure.
if: vars.RUN_ENGINE_TESTS == 'true'
runs-on: ${{ vars.ENGINE_RUNNER || 'ubuntu-latest' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Copy engine jars from IDM_LIB
env:
IDM_LIB: ${{ vars.IDM_LIB }}
run: |
if [ -n "$IDM_LIB" ]; then
mkdir -p lib
# Regular files. requireFilesExist rejects a directory symlink and per-jar symlinks.
for j in dirxml.jar dirxml_misc.jar nxsl.jar xp.jar CommonDriverShim.jar jclient.jar dhutil.jar XDS.jar js.jar; do
cp -L "$IDM_LIB/$j" "lib/$j"
done
fi
- name: Require engine jars and simulator
run: bash bin/require-engine.sh
- name: Trace parser (DirXMLTraceViewer release)
env:
GH_TOKEN: ${{ github.token }}
run: |
TRACE=$(sed -n 's#.*<tracecore.version>\([^<]*\)</tracecore.version>.*#\1#p' pom.xml | head -1)
gh release download "v$TRACE" --repo PointBlueTechnology/DirXMLTraceViewer -p "dirxml-trace-core-$TRACE.jar" -D /tmp
printf '<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion><groupId>com.pointbluetech</groupId><artifactId>dirxml-trace-core</artifactId><version>%s</version></project>' "$TRACE" > /tmp/trace-core.pom
mvn -B -q install:install-file -Dfile=/tmp/dirxml-trace-core-$TRACE.jar -DpomFile=/tmp/trace-core.pom
- name: Test
run: mvn -B test