Skip to content

Commit f112b37

Browse files
authored
Merge pull request #13 from OpenCortexIDE/feature/ci-cd-infrastructure
Feature/ci cd infrastructure
2 parents 6f5705b + b0c8eeb commit f112b37

File tree

27 files changed

+1406
-27
lines changed

27 files changed

+1406
-27
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
# GitHub actions required reviewers
2-
.github/workflows/monaco-editor.yml @hediet @alexdima @lszomoru @joaomoreno
3-
.github/workflows/no-package-lock-changes.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
4-
.github/workflows/no-yarn-lock-changes.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
5-
.github/workflows/pr-darwin-test.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
6-
.github/workflows/pr-linux-cli-test.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
7-
.github/workflows/pr-linux-test.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
8-
.github/workflows/pr-node-modules.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
9-
.github/workflows/pr-win32-test.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
10-
.github/workflows/pr.yml @lszomoru @joaomoreno @TylerLeonhardt @rzhao271
11-
.github/workflows/telemetry.yml @lramos15 @lszomoru @joaomoreno
12-
13-
# VS Code API
14-
# Ensure the API team is aware of changes to the vscode-dts file
15-
# this is only about the final API, not about proposed API changes
16-
src/vscode-dts/vscode.d.ts @jrieken @mjbvz @alexr00
1+
# Code owners for OpenCortexIDE
2+
# All files owned by the repository maintainer
3+
* @pterjudin
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Reusable E2E Sanity Check
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
description: 'Platform to run on'
8+
required: false
9+
default: 'ubuntu-latest'
10+
type: string
11+
12+
jobs:
13+
e2e-sanity:
14+
name: E2E Sanity
15+
runs-on: ${{ inputs.platform }}
16+
timeout-minutes: 15
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v5
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version-file: .nvmrc
25+
26+
- name: Restore node_modules cache
27+
id: cache-node-modules
28+
uses: actions/cache/restore@v4
29+
with:
30+
path: node_modules
31+
key: node_modules-e2e-${{ hashFiles('package-lock.json') }}
32+
restore-keys: |
33+
node_modules-e2e-
34+
35+
- name: Install dependencies
36+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
37+
run: npm ci
38+
env:
39+
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
40+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
41+
42+
- name: Cache Playwright browsers
43+
id: cache-playwright
44+
uses: actions/cache@v4
45+
with:
46+
path: ~/.cache/ms-playwright
47+
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
48+
restore-keys: |
49+
playwright-browsers-${{ runner.os }}-
50+
51+
- name: Install Playwright browsers
52+
if: steps.cache-playwright.outputs.cache-hit != 'true'
53+
run: npx playwright install --with-deps chromium
54+
env:
55+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 0
56+
57+
- name: Transpile client and extensions
58+
run: npm run gulp transpile-client-esbuild transpile-extensions
59+
60+
- name: Run E2E tests
61+
working-directory: test/e2e
62+
run: npx playwright test
63+
env:
64+
CI: true
65+
66+
- name: Upload test results
67+
if: always()
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: playwright-report-${{ github.run_id }}
71+
path: test/e2e/playwright-report/
72+
retention-days: 7
73+
74+
- name: Cache node_modules
75+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
76+
uses: actions/cache/save@v4
77+
with:
78+
path: node_modules
79+
key: node_modules-e2e-${{ hashFiles('package-lock.json') }}
80+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Reusable Lint Check
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
description: 'Platform to run on'
8+
required: false
9+
default: 'ubuntu-latest'
10+
type: string
11+
12+
jobs:
13+
lint:
14+
name: Lint
15+
runs-on: ${{ inputs.platform }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v6
22+
with:
23+
node-version-file: .nvmrc
24+
25+
- name: Restore node_modules cache
26+
id: cache-node-modules
27+
uses: actions/cache/restore@v4
28+
with:
29+
path: node_modules
30+
key: node_modules-lint-${{ hashFiles('package-lock.json') }}
31+
restore-keys: |
32+
node_modules-lint-
33+
34+
- name: Install dependencies
35+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
36+
run: npm ci
37+
env:
38+
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
39+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
40+
41+
- name: Run ESLint
42+
run: npm run eslint
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Cache node_modules
47+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
48+
uses: actions/cache/save@v4
49+
with:
50+
path: node_modules
51+
key: node_modules-lint-${{ hashFiles('package-lock.json') }}
52+
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
name: Reusable Node.js Setup
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
node-version-file:
7+
description: 'Path to .nvmrc file'
8+
required: false
9+
default: '.nvmrc'
10+
type: string
11+
cache-key-prefix:
12+
description: 'Prefix for cache keys'
13+
required: false
14+
default: 'node_modules'
15+
type: string
16+
platform:
17+
description: 'Platform (linux, darwin, win32)'
18+
required: false
19+
default: 'linux'
20+
type: string
21+
arch:
22+
description: 'Architecture (x64, arm64)'
23+
required: false
24+
default: 'x64'
25+
type: string
26+
27+
jobs:
28+
setup:
29+
name: Setup Node.js and Cache
30+
runs-on: ${{ inputs.platform == 'darwin' && 'macos-14' || inputs.platform == 'win32' && 'windows-latest' || 'ubuntu-latest' }}
31+
outputs:
32+
cache-hit: ${{ steps.cache-node-modules.outputs.cache-hit }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v5
36+
37+
- name: Setup Node.js
38+
uses: actions/setup-node@v6
39+
with:
40+
node-version-file: ${{ inputs.node-version-file }}
41+
42+
- name: Prepare node_modules cache key
43+
id: cache-key
44+
shell: bash
45+
run: |
46+
mkdir -p .build
47+
if [ -f "build/azure-pipelines/common/computeNodeModulesCacheKey.js" ]; then
48+
node build/azure-pipelines/common/computeNodeModulesCacheKey.js ${{ inputs.platform }} ${{ inputs.arch }} $(node -p process.arch) > .build/packagelockhash
49+
else
50+
echo "${{ hashFiles('package-lock.json') }}" > .build/packagelockhash
51+
fi
52+
53+
- name: Restore node_modules cache
54+
id: cache-node-modules
55+
uses: actions/cache/restore@v4
56+
with:
57+
path: .build/node_modules_cache
58+
key: "${{ inputs.cache-key-prefix }}-${{ inputs.platform }}-${{ hashFiles('.build/packagelockhash') }}"
59+
restore-keys: |
60+
${{ inputs.cache-key-prefix }}-${{ inputs.platform }}-
61+
62+
- name: Extract node_modules cache
63+
if: steps.cache-node-modules.outputs.cache-hit == 'true'
64+
shell: bash
65+
run: |
66+
if [ "${{ inputs.platform }}" = "win32" ]; then
67+
# Try 7z first, fallback to PowerShell Expand-Archive if 7z not available
68+
if command -v 7z.exe &> /dev/null; then
69+
7z.exe x .build/node_modules_cache/cache.7z -aoa || true
70+
elif command -v powershell.exe &> /dev/null; then
71+
powershell.exe -Command "Expand-Archive -Path .build/node_modules_cache/cache.7z -DestinationPath . -Force" || true
72+
else
73+
echo "Warning: No extraction tool found for Windows. Skipping cache extraction."
74+
fi
75+
else
76+
tar -xzf .build/node_modules_cache/cache.tgz || true
77+
fi
78+
79+
- name: Install dependencies
80+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
81+
shell: bash
82+
run: |
83+
if [ "${{ inputs.platform }}" = "win32" ]; then
84+
# Windows-specific setup if needed
85+
npm ci
86+
else
87+
npm ci
88+
fi
89+
env:
90+
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
91+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
94+
- name: Create node_modules archive
95+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
96+
shell: bash
97+
run: |
98+
if [ "${{ inputs.platform }}" = "win32" ]; then
99+
if [ -f "build/azure-pipelines/common/listNodeModules.js" ]; then
100+
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
101+
mkdir -p .build/node_modules_cache
102+
# Try 7z first, fallback to PowerShell Compress-Archive if 7z not available
103+
if command -v 7z.exe &> /dev/null; then
104+
7z.exe a .build/node_modules_cache/cache.7z -mx3 `@.build/node_modules_list.txt
105+
elif command -v powershell.exe &> /dev/null; then
106+
# PowerShell fallback - note: this creates a zip, not 7z
107+
powershell.exe -Command "Compress-Archive -Path (Get-Content .build/node_modules_list.txt) -DestinationPath .build/node_modules_cache/cache.zip -Force" || echo "Warning: Failed to create archive"
108+
else
109+
echo "Warning: No compression tool found for Windows. Skipping cache creation."
110+
fi
111+
fi
112+
else
113+
if [ -f "build/azure-pipelines/common/listNodeModules.js" ]; then
114+
node build/azure-pipelines/common/listNodeModules.js .build/node_modules_list.txt
115+
mkdir -p .build/node_modules_cache
116+
tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt
117+
fi
118+
fi
119+
120+
- name: Save node_modules cache
121+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
122+
uses: actions/cache/save@v4
123+
with:
124+
path: .build/node_modules_cache
125+
key: "${{ inputs.cache-key-prefix }}-${{ inputs.platform }}-${{ hashFiles('.build/packagelockhash') }}"
126+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Reusable Headless Smoke Test
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
platform:
7+
description: 'Platform to run on'
8+
required: false
9+
default: 'ubuntu-latest'
10+
type: string
11+
12+
jobs:
13+
smoke-headless:
14+
name: Headless Smoke Test
15+
runs-on: ${{ inputs.platform }}
16+
timeout-minutes: 10
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v5
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v6
23+
with:
24+
node-version-file: .nvmrc
25+
26+
- name: Restore node_modules cache
27+
id: cache-node-modules
28+
uses: actions/cache/restore@v4
29+
with:
30+
path: node_modules
31+
key: node_modules-smoke-${{ hashFiles('package-lock.json') }}
32+
restore-keys: |
33+
node_modules-smoke-
34+
35+
- name: Install dependencies
36+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
37+
run: npm ci
38+
env:
39+
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
40+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- name: Transpile client and extensions
44+
run: npm run gulp transpile-client-esbuild transpile-extensions
45+
46+
- name: Download Electron
47+
run: npm run electron
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
51+
- name: Compile smoke tests
52+
working-directory: test/smoke
53+
run: npm run compile
54+
55+
- name: Compile extensions for smoke tests
56+
run: npm run gulp compile-extension-media
57+
58+
- name: Run headless smoke test
59+
run: npm run smoketest-no-compile -- --headless --quick || npm run smoketest-no-compile -- --web --headless --quick
60+
continue-on-error: false
61+
62+
- name: Cache node_modules
63+
if: steps.cache-node-modules.outputs.cache-hit != 'true'
64+
uses: actions/cache/save@v4
65+
with:
66+
path: node_modules
67+
key: node_modules-smoke-${{ hashFiles('package-lock.json') }}
68+

0 commit comments

Comments
 (0)