Skip to content

Commit a4094cf

Browse files
committed
✨ Add pointer-based build system for MTA extensions
This commit introduces a new build approach where we: - Reference upstream konveyor/editor-extensions by SHA - Pull upstream source at build time - Apply MTA branding via scripts during prebuild - Build extensions with MTA-specific configuration Key files: - mta-build.yaml: Configuration for upstream ref and branding - scripts/pull-upstream.js: Clones and prepares upstream workspace - scripts/apply-branding.js: Transforms package.json files for MTA - scripts/update-upstream.sh: Helper to update upstream SHA - .github/workflows/ci.yml: Build workflow using pointer-based approach This approach allows us to track upstream changes while maintaining MTA-specific branding and configuration without duplicating source.
1 parent ed9b2a7 commit a4094cf

File tree

13 files changed

+1259
-21282
lines changed

13 files changed

+1259
-21282
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
* @konveyor/kai-ide-reviewers
2-
/tests @konveyor/kai-qe-reviewers
1+
# MTA VSCode Extension Build Repository
2+
# TODO: Update to internal migtools team when available
33

4+
* @konveyor/kai-ide-reviewers

.github/workflows/ci.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
inputs:
10+
upstream_ref:
11+
description: "Override upstream ref (leave empty to use mta-build.yaml)"
12+
required: false
13+
type: string
14+
15+
concurrency:
16+
group: ci-${{ github.event_name }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
env:
20+
HUSKY: 0
21+
22+
jobs:
23+
build:
24+
name: Build MTA Extensions
25+
runs-on: ubuntu-latest
26+
outputs:
27+
upstream_sha: ${{ steps.pull.outputs.upstream_sha }}
28+
upstream_sha_short: ${{ steps.pull.outputs.upstream_sha_short }}
29+
mta_version: ${{ steps.info.outputs.mta_version }}
30+
31+
steps:
32+
- name: Checkout MTA build repo
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: "22"
39+
40+
- name: Install MTA build dependencies
41+
run: npm install
42+
43+
- name: Pull upstream and apply branding
44+
id: pull
45+
run: |
46+
# Allow workflow input to override upstream ref
47+
if [ -n "${{ inputs.upstream_ref }}" ]; then
48+
npm run pull-upstream -- --ref=${{ inputs.upstream_ref }}
49+
else
50+
npm run pull-upstream
51+
fi
52+
53+
# Capture upstream SHA for provenance
54+
cd .upstream-workspace
55+
SHA=$(git rev-parse HEAD)
56+
SHA_SHORT=$(git rev-parse --short HEAD)
57+
echo "upstream_sha=${SHA}" >> $GITHUB_OUTPUT
58+
echo "upstream_sha_short=${SHA_SHORT}" >> $GITHUB_OUTPUT
59+
60+
- name: Show build configuration
61+
run: |
62+
echo "## Build Configuration" >> $GITHUB_STEP_SUMMARY
63+
echo "" >> $GITHUB_STEP_SUMMARY
64+
echo "### mta-build.yaml" >> $GITHUB_STEP_SUMMARY
65+
echo '```yaml' >> $GITHUB_STEP_SUMMARY
66+
cat mta-build.yaml >> $GITHUB_STEP_SUMMARY
67+
echo '```' >> $GITHUB_STEP_SUMMARY
68+
echo "" >> $GITHUB_STEP_SUMMARY
69+
echo "**Upstream SHA**: [\`${{ steps.pull.outputs.upstream_sha_short }}\`](https://github.com/konveyor/editor-extensions/commit/${{ steps.pull.outputs.upstream_sha }})" >> $GITHUB_STEP_SUMMARY
70+
71+
- name: Install upstream dependencies
72+
working-directory: .upstream-workspace
73+
run: npm ci
74+
75+
- name: Collect runtime assets
76+
working-directory: .upstream-workspace
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
run: |
80+
# Use release artifacts from konveyor/editor-extensions
81+
# This downloads assets from the latest GitHub release
82+
npm run collect-assets -- --use-release
83+
84+
- name: Build all workspaces
85+
working-directory: .upstream-workspace
86+
run: npm run build
87+
env:
88+
UPSTREAM_GIT_SHA: ${{ steps.pull.outputs.upstream_sha }}
89+
90+
- name: Show transformed package.json files
91+
run: |
92+
echo "## Transformed package.json files" >> $GITHUB_STEP_SUMMARY
93+
echo "" >> $GITHUB_STEP_SUMMARY
94+
95+
for ext in core java javascript go; do
96+
PKG=".upstream-workspace/vscode/${ext}/package.json"
97+
if [ -f "$PKG" ]; then
98+
echo "### vscode/${ext}/package.json" >> $GITHUB_STEP_SUMMARY
99+
echo '```json' >> $GITHUB_STEP_SUMMARY
100+
# Show key fields only
101+
jq '{name, displayName, version, publisher, coreExtensionId, extensionDependencies}' "$PKG" >> $GITHUB_STEP_SUMMARY
102+
echo '```' >> $GITHUB_STEP_SUMMARY
103+
echo "" >> $GITHUB_STEP_SUMMARY
104+
fi
105+
done
106+
107+
- name: Get build info
108+
id: info
109+
working-directory: .upstream-workspace
110+
run: |
111+
VERSION=$(jq -r '.version' vscode/core/package.json)
112+
echo "mta_version=${VERSION}" >> $GITHUB_OUTPUT
113+
114+
- name: Create distribution
115+
working-directory: .upstream-workspace
116+
run: npm run dist
117+
118+
- name: Package extensions
119+
working-directory: .upstream-workspace
120+
run: |
121+
npm run package-core
122+
npm run package-java
123+
npm run package-javascript
124+
# npm run package-go # Enable when Go is ready
125+
126+
- name: Show dist file tree
127+
run: |
128+
echo "## Distribution Contents" >> $GITHUB_STEP_SUMMARY
129+
echo '```' >> $GITHUB_STEP_SUMMARY
130+
find .upstream-workspace/dist -type f -name "*.vsix" | sort >> $GITHUB_STEP_SUMMARY
131+
echo '```' >> $GITHUB_STEP_SUMMARY
132+
echo "" >> $GITHUB_STEP_SUMMARY
133+
echo "### VSIX Files" >> $GITHUB_STEP_SUMMARY
134+
ls -lh .upstream-workspace/dist/*.vsix >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo "No VSIX files found" >> $GITHUB_STEP_SUMMARY
135+
136+
- name: Upload VSIX artifacts
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: mta-vsix-${{ github.run_number }}
140+
path: .upstream-workspace/dist/*.vsix
141+
retention-days: 30
142+
143+
- name: Upload workspace for debugging
144+
if: failure()
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: workspace-debug-${{ github.run_number }}
148+
path: |
149+
.upstream-workspace/vscode/*/package.json
150+
.upstream-workspace/mta-build.yaml
151+
.upstream-workspace/.mta-build-info.json
152+
retention-days: 7
153+
154+
summary:
155+
name: Build Summary
156+
runs-on: ubuntu-latest
157+
needs: build
158+
steps:
159+
- name: Summary
160+
run: |
161+
echo "## ✅ MTA Build Complete" >> $GITHUB_STEP_SUMMARY
162+
echo "" >> $GITHUB_STEP_SUMMARY
163+
echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
164+
echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY
165+
echo "| MTA Version | ${{ needs.build.outputs.mta_version }} |" >> $GITHUB_STEP_SUMMARY
166+
echo "| Upstream SHA | [\`${{ needs.build.outputs.upstream_sha_short }}\`](https://github.com/konveyor/editor-extensions/commit/${{ needs.build.outputs.upstream_sha }}) |" >> $GITHUB_STEP_SUMMARY
167+
echo "| Trigger | ${{ github.event_name }} |" >> $GITHUB_STEP_SUMMARY
168+
echo "| Run | [#${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) |" >> $GITHUB_STEP_SUMMARY
169+

0 commit comments

Comments
 (0)