Skip to content

Commit a1c34d7

Browse files
authored
Validate downloaded dependencies (#722)
* Validate downloaded dependencies
1 parent 285cf26 commit a1c34d7

5 files changed

Lines changed: 498 additions & 8 deletions

File tree

.github/workflows/ci.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,64 @@ jobs:
214214
path: ./*.vsix
215215
retention-days: 1
216216

217+
validate:
218+
name: Validate package (${{ matrix.target }})
219+
runs-on: ${{ matrix.platform }}
220+
needs: package
221+
strategy:
222+
fail-fast: false
223+
matrix:
224+
include:
225+
- target: win32-x64
226+
platform: windows-2022
227+
- target: win32-arm64
228+
platform: windows-2022
229+
- target: linux-x64
230+
platform: ubuntu-24.04
231+
- target: linux-arm64
232+
platform: ubuntu-24.04
233+
- target: darwin-arm64
234+
platform: macos-14
235+
permissions:
236+
packages: read
237+
steps:
238+
- name: Harden the runner (Audit all outbound calls)
239+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
240+
with:
241+
egress-policy: audit
242+
243+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
244+
245+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
246+
env:
247+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
248+
with:
249+
node-version-file: package.json
250+
registry-url: https://npm.pkg.github.com
251+
always-auth: true
252+
package-manager-cache: false
253+
254+
- name: Install dependencies
255+
run: |
256+
yarn --frozen-lockfile --ignore-scripts --prefer-offline
257+
258+
- name: Download vsix package
259+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
260+
with:
261+
pattern: vsix-package-${{ matrix.target }}
262+
263+
- name: Validate VSIX contents
264+
shell: bash
265+
run: |
266+
VSIX_FILE=$(ls *.vsix)
267+
echo "Validating VSIX: $VSIX_FILE"
268+
yarn validate-tools --target ${{ matrix.target }} --vsix "$VSIX_FILE"
269+
217270
publish:
218271
name: Publish release
219272
runs-on: [ubuntu-latest]
220273
if: github.event_name == 'release'
221-
needs: package
274+
needs: [ package, validate ]
222275
permissions:
223276
contents: write # for softprops/action-gh-release to create a GitHub release
224277
steps:

.github/workflows/nightly.yml

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,9 @@ jobs:
5555
run: |
5656
DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
5757
QUALIFIER=$(git describe --tags | grep -Eo '[0-9]+\-g[0-9a-f]+$')
58+
BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^0-9A-Za-z-]/-/g')
5859
yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}"
59-
if [ -n "${QUALIFIER}" ]; then
60-
yarn version --no-git-tag-version --prepatch --preid "${{ github.ref_name }}${QUALIFIER}"
61-
else
62-
yarn version --no-git-tag-version --prepatch --preid "${{ github.ref_name }}"
63-
fi
60+
yarn version -s --no-git-tag-version --prepatch --preid "${BRANCH}${QUALIFIER:+-${QUALIFIER}}"
6461
VERSION="$(jq -r ".version" < package.json)"
6562
sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
6663
echo "Version is ${VERSION}"
@@ -176,3 +173,56 @@ jobs:
176173
name: vsix-package-${{ matrix.target }}
177174
path: ./*.vsix
178175
retention-days: 1
176+
177+
validate:
178+
name: Validate package (${{ matrix.target }})
179+
runs-on: ${{ matrix.platform }}
180+
needs: package
181+
strategy:
182+
fail-fast: false
183+
matrix:
184+
include:
185+
- target: win32-x64
186+
platform: windows-2022
187+
- target: win32-arm64
188+
platform: windows-2022
189+
- target: linux-x64
190+
platform: ubuntu-24.04
191+
- target: linux-arm64
192+
platform: ubuntu-24.04
193+
- target: darwin-arm64
194+
platform: macos-14
195+
permissions:
196+
packages: read
197+
steps:
198+
- name: Harden the runner (Audit all outbound calls)
199+
uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
200+
with:
201+
egress-policy: audit
202+
203+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
204+
205+
- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
206+
env:
207+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208+
with:
209+
node-version-file: package.json
210+
registry-url: https://npm.pkg.github.com
211+
always-auth: true
212+
package-manager-cache: false
213+
214+
- name: Install dependencies
215+
run: |
216+
yarn --frozen-lockfile --ignore-scripts --prefer-offline
217+
218+
- name: Download vsix package
219+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
220+
with:
221+
pattern: vsix-package-${{ matrix.target }}
222+
223+
- name: Validate VSIX contents
224+
shell: bash
225+
run: |
226+
VSIX_FILE=$(ls *.vsix)
227+
echo "Validating VSIX: $VSIX_FILE"
228+
yarn validate-tools --target ${{ matrix.target }} --vsix "$VSIX_FILE"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@
343343
"prepare": "yarn run build",
344344
"download-tools": "tsx scripts/download-tools.ts pyocd gdb",
345345
"download-tools:nightly": "tsx scripts/download-tools.ts pyocdNightly gdb",
346+
"validate-tools": "tsx scripts/validate-tools.ts",
346347
"clean": "git clean -f -x ./node_modules ./dist ./coverage ./tools",
347348
"build": "webpack --mode production && yarn lint",
348349
"build:no-lint": "webpack --mode production",

scripts/copyright-manager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!npx tsx
22

33
/**
4-
* Copyright 2025 Arm Limited
4+
* Copyright 2026 Arm Limited
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@ const COPYRIGHT_TEXT = `/**
4242
*/`;
4343

4444
// Regular expression to match the copyright notice
45-
const COPYRIGHT_REGEX = /\/\*\*\n \* Copyright 2025(?:-(?:20\d{2}))? Arm Limited[\s\S]*?\*\//;
45+
const COPYRIGHT_REGEX = /\/\*\*\n \* Copyright 20\d{2}(?:-(?:20\d{2}))? Arm Limited[\s\S]*?\*\//;
4646

4747

4848
function getFiles(): string[] {

0 commit comments

Comments
 (0)