Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ jobs:
run: npm run lint

- name: Update version for nightly build
id: nightly_version
run: |
# Increment patch version by 1 (e.g. 1.64.1 -> 1.64.2)
BASE_VERSION=$(node -p "require('./package.json').version.split('-')[0]")
Expand Down Expand Up @@ -111,6 +112,12 @@ jobs:
# Create nightly version: 1.64.2-12-abc1234
NIGHTLY_VERSION="${NEXT_PATCH_VERSION}-${COMMIT_COUNT}-${SHORT_SHA}"
echo "Setting version to ${NIGHTLY_VERSION}"
echo "nightly_version=${NIGHTLY_VERSION}" >> $GITHUB_OUTPUT

# Print badge to GitHub Actions summary
echo "### Nightly Build Version" >> $GITHUB_STEP_SUMMARY
NIGHTLY_VERSION_BADGE=${NIGHTLY_VERSION//-/--}
echo "![Nightly Version](https://img.shields.io/badge/version-${NIGHTLY_VERSION_BADGE}-blue)" >> $GITHUB_STEP_SUMMARY

# Update package.json
npm version "${NIGHTLY_VERSION}" --no-git-tag-version
Expand Down Expand Up @@ -221,6 +228,10 @@ jobs:
path: ./*darwin-arm64*.vsix
retention-days: 1

- name: Print nightly build snapshot
run: |
npx tsx scripts/get-package-deps.ts "${{ steps.nightly_version.outputs.nightly_version }}" >> "$GITHUB_STEP_SUMMARY"
Comment thread
soumeh01 marked this conversation as resolved.

test:
name: 'Test (windows-latest)'
runs-on: windows-latest
Expand Down
129 changes: 129 additions & 0 deletions scripts/get-package-deps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/**
* Copyright 2026 Arm Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// generated with AI

/*
* Script to extract version info from manifest_*.yml files in ./tools/cmsis-toolbox
* and print a dependency graph in the format used in the GitHub Actions summary.
* Usage: npx tsx scripts/print-toolbox-deps.ts <nightlyVersion>
Comment thread
soumeh01 marked this conversation as resolved.
Outdated
*/
import fs from 'fs';
import path from 'path';
import yaml from 'yaml';
import { fileURLToPath } from 'url';
Comment thread
soumeh01 marked this conversation as resolved.

// ESM-compatible __dirname
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const TOOLBOX_DIR = path.join(__dirname, '../tools/cmsis-toolbox');
const UV2CSOLUTION_DIR = path.join(__dirname, '../tools/uv2csolution');
const PACKAGE_JSON_PATH = path.join(__dirname, '../package.json');
const MANIFEST_PATTERN = /^manifest_.*\.yml$/;

// Children of cmsis-toolbox (in display order)
const TOOLBOX_CHILDREN = [
'cbridge',
'cbuild',
'cbuild2cmake',
'cbuildgen',
'cpackget',
'csolution',
'packchk',
'svdconv',
'vidx2pidx',
];

function findManifestFiles(dir: string): string[] {
return fs.readdirSync(dir)
.filter(f => MANIFEST_PATTERN.test(f))
.map(f => path.join(dir, f));
Comment thread
soumeh01 marked this conversation as resolved.
Outdated
}

function parseManifest(file: string): Record<string, string> {
const doc = yaml.parse(fs.readFileSync(file, 'utf8')) as any;
const versions: Record<string, string> = {};
// Top-level cmsis-toolbox version
if (doc?.version) {
versions['cmsis-toolbox'] = doc.version;
}
// binaries is a map: { cbridge: { version: '...' }, cbuild: { version: '...' }, ... }
if (doc?.binaries && typeof doc.binaries === 'object') {
for (const [name, info] of Object.entries(doc.binaries as Record<string, any>)) {
if (info?.version) {
versions[name] = info.version;
}
}
}
return versions;
}

function getUv2csolutionVersion(): string | undefined {
// Try version.txt in the uv2csolution folder first
const versionFile = path.join(UV2CSOLUTION_DIR, 'version.txt');
if (fs.existsSync(versionFile)) {
const v = fs.readFileSync(versionFile, 'utf8').trim();
if (v) return v;
}
// Fall back to package.json csolution.uv2csolutionVersion
if (fs.existsSync(PACKAGE_JSON_PATH)) {
const pkg = JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH, 'utf8'));
const v = pkg?.csolution?.uv2csolutionVersion;
if (v) return String(v);
}
return undefined;
}

function mergeVersions(manifests: Record<string, string>[]): Record<string, string> {
const merged: Record<string, string> = {};
for (const m of manifests) {
for (const [k, v] of Object.entries(m)) {
merged[k] = v;
}
}
return merged;
Comment thread
soumeh01 marked this conversation as resolved.
}

function printDependencyGraph(versions: Record<string, string>, uv2csolutionVersion: string | undefined, nightlyVersion: string) {
console.log('```text');
console.log(`vscode-cmsis-solution ${nightlyVersion}`);
console.log(` └── cmsis-toolbox v${versions['cmsis-toolbox'] ?? 'unknown'}`);
for (let i = 0; i < TOOLBOX_CHILDREN.length; ++i) {
const tool = TOOLBOX_CHILDREN[i];
const ver = versions[tool] ?? 'unknown';
const isLast = i === TOOLBOX_CHILDREN.length - 1;
const prefix = isLast ? ' β”‚ └──' : ' β”‚ β”œβ”€β”€';
console.log(`${prefix} ${tool} v${ver}`);
}
console.log(` └─── uv2csolution v${uv2csolutionVersion ?? 'unknown'}`);
Comment thread
soumeh01 marked this conversation as resolved.
Outdated
console.log('```');
}

function main() {
const nightlyVersion = process.argv[2] || process.env.NIGHTLY_VERSION || 'unknown';
const manifestFiles = findManifestFiles(TOOLBOX_DIR);
if (manifestFiles.length === 0) {
console.error('No manifest_*.yml files found in', TOOLBOX_DIR);
process.exit(1);
}
const manifests = manifestFiles.map(parseManifest);
const versions = mergeVersions(manifests);
const uv2csolutionVersion = getUv2csolutionVersion();
printDependencyGraph(versions, uv2csolutionVersion, nightlyVersion);
}

main();
Loading