Skip to content

Commit bd2c337

Browse files
OmotolaCopilot
andcommitted
Merge main into dev/oakeredolu/ctest-testname-variable
Resolve conflicts: - CHANGELOG.md: include both testName variable and main's new entries - src/ctest.ts: combine testName re-expansion with getTestNamesForSourceDir fix Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 parents c8bb730 + 53f2fcd commit bd2c337

103 files changed

Lines changed: 3402 additions & 346 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-main-linux.yml

Lines changed: 157 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,83 +6,205 @@ on:
66
pull_request:
77
branches: [ main, 'release/**' ]
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
12+
913
jobs:
1014
build:
1115
runs-on: ubuntu-latest
1216

1317
steps:
14-
- uses: actions/checkout@v3
15-
16-
- name: Setup LCOV
17-
uses: hrishikesh-kadam/setup-lcov@v1
18+
- uses: actions/checkout@v4
1819

1920
- name: Setup Node environment
20-
uses: actions/setup-node@v3
21+
uses: actions/setup-node@v4
2122
with:
2223
node-version: 20
24+
cache: 'yarn'
2325

2426
- name: Install Yarn
2527
run: npm install -g yarn
2628

29+
# Cache node_modules archive keyed on lockfile + os + arch + node version (keytar.node is arch-specific)
30+
- name: Restore node_modules cache
31+
id: node-modules-cache
32+
uses: actions/cache@v4
33+
with:
34+
path: .build/node_modules_cache
35+
key: node_modules-${{ runner.os }}-${{ runner.arch }}-node20-${{ hashFiles('yarn.lock', 'package.json') }}
36+
37+
- name: Extract node_modules archive
38+
if: steps.node-modules-cache.outputs.cache-hit == 'true'
39+
shell: bash
40+
run: tar -xzf .build/node_modules_cache/cache.tgz
41+
2742
- name: Install dependencies
28-
run: yarn install
43+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
44+
run: yarn install --frozen-lockfile
45+
46+
- name: Create node_modules archive
47+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
48+
shell: bash
49+
run: |
50+
mkdir -p .build/node_modules_cache
51+
tar -czf .build/node_modules_cache/cache.tgz node_modules
2952
3053
- name: Build the extension
31-
run: yarn compile-production
54+
run: yarn compile-production-ci
3255

3356
- name: Lint
3457
run: yarn lint
3558

3659
- name: Install CMake/Ninja
3760
uses: lukka/get-cmake@latest
3861
with:
39-
cmakeVersion: 3.18.3
40-
ninjaVersion: 1.10.1
62+
cmakeVersion: 3.18.3
63+
ninjaVersion: 1.10.1
64+
65+
# Cache fakebin to skip rebuild when source unchanged
66+
- name: Restore fakebin cache
67+
id: fakebin-cache
68+
uses: actions/cache@v4
69+
with:
70+
path: test/fakebin
71+
key: fakebin-${{ runner.os }}-${{ hashFiles('test/fakeOutputGenerator/CMakeLists.txt', 'test/fakeOutputGenerator/main.cpp', 'test/fakeOutputGenerator/configfiles/**') }}
4172

4273
- name: Build fake compilers for tests
43-
uses: urkle/action-cmake-build@v1.0.0
74+
if: steps.fakebin-cache.outputs.cache-hit != 'true'
75+
run: yarn pretest-buildfakebin
76+
77+
# Ensure fakebin files are executable (cache may not preserve permissions)
78+
- name: Fix fakebin permissions
79+
run: chmod +x test/fakebin/* || true
80+
81+
# Compile test TypeScript ONCE for all matrix jobs
82+
- name: Compile test sources
83+
run: yarn pretest
84+
85+
# Package build outputs for the matrix test jobs. node_modules is reused via the cache above
86+
# (matrix jobs use the same cache key); only build/test artifacts are uploaded here.
87+
- name: Pack build outputs
88+
shell: bash
89+
run: |
90+
tar -czf build-outputs.tgz \
91+
out \
92+
dist \
93+
test/fakebin
94+
95+
- name: Upload build outputs
96+
uses: actions/upload-artifact@v4
4497
with:
45-
source-dir: ${{ github.workspace }}/test/fakeOutputGenerator
46-
configure-options: -DCMAKE_INSTALL_PREFIX:STRING=${{ github.workspace }}/test/fakebin
47-
install-build: true
98+
name: build-outputs-${{ runner.os }}
99+
path: build-outputs.tgz
100+
retention-days: 1
101+
if-no-files-found: error
102+
103+
test:
104+
name: test (${{ matrix.suite.name }})
105+
needs: build
106+
runs-on: ubuntu-latest
48107

49-
- name: Run backend tests
50-
run: yarn backendTests
108+
strategy:
109+
fail-fast: false
110+
matrix:
111+
suite:
112+
- { name: backend, cmd: 'yarn backendTests', timeout: 5 }
113+
- { name: smoke, cmd: 'yarn smokeTests-only', timeout: 15 }
114+
- { name: unit, cmd: 'yarn unitTests-only', timeout: 20 }
115+
- { name: integration, cmd: 'yarn integrationTests-only', timeout: 15 }
116+
- { name: e2e-successful, cmd: 'yarn endToEndTestsSuccessfulBuild-only', timeout: 25 }
117+
- { name: e2e-single-root, cmd: 'yarn endToEndTestsSingleRoot-only', timeout: 25 }
118+
- { name: e2e-single-root-ctest, cmd: 'yarn endToEndTestsSingleRootCTest-only', timeout: 25 }
119+
- { name: e2e-multi-root, cmd: 'yarn endToEndTestsMultiRoot-only', timeout: 25 }
51120

52-
- name: Run smoke tests
53-
uses: GabrielBB/xvfb-action@v1.6
54-
with:
55-
run: yarn smokeTests
121+
steps:
122+
- uses: actions/checkout@v4
56123

57-
- name: Run unit tests
58-
uses: GabrielBB/xvfb-action@v1.6
124+
- name: Setup Node environment
125+
uses: actions/setup-node@v4
59126
with:
60-
run: yarn unitTests
127+
node-version: 20
128+
cache: 'yarn'
129+
130+
- name: Install Yarn
131+
run: npm install -g yarn
61132

62-
- name: Run integration tests
63-
uses: GabrielBB/xvfb-action@v1.6
133+
# Restore the SAME node_modules cache the build job populated (key must match).
134+
- name: Restore node_modules cache
135+
id: node-modules-cache
136+
uses: actions/cache@v4
64137
with:
65-
run: yarn integrationTests
138+
path: .build/node_modules_cache
139+
key: node_modules-${{ runner.os }}-${{ runner.arch }}-node20-${{ hashFiles('yarn.lock', 'package.json') }}
140+
141+
- name: Extract node_modules archive
142+
if: steps.node-modules-cache.outputs.cache-hit == 'true'
143+
shell: bash
144+
run: tar -xzf .build/node_modules_cache/cache.tgz
66145

67-
- name: Run successful-build test
68-
uses: GabrielBB/xvfb-action@v1.6
146+
# Fallback: install fresh if the build job's cache was evicted between jobs (rare).
147+
- name: Install dependencies (fallback)
148+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
149+
run: yarn install --frozen-lockfile
150+
151+
- name: Download build outputs
152+
uses: actions/download-artifact@v4
69153
with:
70-
run: yarn endToEndTestsSuccessfulBuild
154+
name: build-outputs-${{ runner.os }}
155+
156+
- name: Unpack build outputs
157+
shell: bash
158+
run: tar -xzf build-outputs.tgz
71159

72-
- name: Run single root test
73-
uses: GabrielBB/xvfb-action@v1.6
160+
- name: Install CMake/Ninja
161+
uses: lukka/get-cmake@latest
74162
with:
75-
run: yarn endToEndTestsSingleRoot
163+
cmakeVersion: 3.18.3
164+
ninjaVersion: 1.10.1
165+
166+
# Ensure fakebin files are executable (artifact tar may preserve perms but be defensive)
167+
- name: Fix fakebin permissions
168+
run: chmod +x test/fakebin/* || true
76169

77-
- name: Run multi root test
78-
uses: GabrielBB/xvfb-action@v1.6
170+
# Cache VS Code download for E2E / smoke / unit / integration tests
171+
- name: Restore VS Code cache
172+
uses: actions/cache@v4
79173
with:
80-
run: yarn endToEndTestsMultiRoot
174+
path: .vscode-test
175+
key: vscode-test-${{ runner.os }}-stable
176+
restore-keys: vscode-test-${{ runner.os }}-
177+
178+
- name: Start Xvfb
179+
if: matrix.suite.name != 'backend'
180+
run: |
181+
# xvfb is not preinstalled on ubuntu-latest runners
182+
if ! command -v Xvfb >/dev/null 2>&1; then
183+
sudo apt-get update
184+
sudo apt-get install -y --no-install-recommends xvfb
185+
fi
186+
Xvfb :99 -screen 0 1920x1080x24 -nolisten tcp &
187+
# Wait for the Xvfb socket to be ready (no extra packages needed)
188+
for i in $(seq 1 40); do
189+
if [ -S /tmp/.X11-unix/X99 ]; then
190+
break
191+
fi
192+
sleep 0.25
193+
done
194+
if [ ! -S /tmp/.X11-unix/X99 ]; then
195+
echo "Xvfb failed to start" >&2
196+
exit 1
197+
fi
198+
echo "DISPLAY=:99" >> "$GITHUB_ENV"
199+
200+
- name: Run ${{ matrix.suite.name }} tests
201+
timeout-minutes: ${{ matrix.suite.timeout }}
202+
run: ${{ matrix.suite.cmd }}
81203

82204
- name: Upload test logs if tests failed
83205
if: failure()
84206
uses: actions/upload-artifact@v4
85207
with:
86-
name: TestLogs
208+
name: TestLogs-${{ runner.os }}-${{ matrix.suite.name }}
87209
path: test/**/log.txt
88210
if-no-files-found: warn

0 commit comments

Comments
 (0)