Skip to content

Nightly

Nightly #198

Workflow file for this run

name: Nightly
on:
schedule:
- cron: '0 5 * * *' # nightly at 05:00 UTC
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
if: github.repository == 'Open-CMSIS-Pack/vscode-cmsis-debugger'
strategy:
matrix:
platform: [ubuntu-24.04, windows-2022, macos-14]
include:
- platform: ubuntu-24.04
target: linux
- platform: windows-2022
target: windows
- platform: macos-14
target: darwin
runs-on: ${{ matrix.platform }}
permissions:
packages: read
name: 'Build and test (${{ matrix.target }})'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- run: git config --global core.autocrlf false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
submodules: true
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
node-version-file: package.json
registry-url: https://npm.pkg.github.com
package-manager-cache: false
- name: Set version
if: runner.os == 'Linux' && github.repository_owner == 'Open-CMSIS-Pack'
run: |
DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
QUALIFIER=$(git describe --tags | grep -Eo '[0-9]+\-g[0-9a-f]+$' || true)
BRANCH=$(echo "${{ github.ref_name }}" | sed 's/[^0-9A-Za-z-]/-/g')
BASE="${DESCRIBE#v}"
IFS='.' read -r MAJ MIN PAT <<< "$BASE"
PR_VERSION="${MAJ}.${MIN}.$((PAT + 1))-${BRANCH}${QUALIFIER:+-${QUALIFIER}}"
npm version --no-git-tag-version --new-version "${PR_VERSION}"
VERSION="$(jq -r ".version" < package.json)"
sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
echo "Version is ${VERSION}"
- name: Remove badges
if: runner.os == 'Linux'
run: |
sed -i "/https:\/\/qlty\.sh\/gh/d" README.md
sed -i "/https:\/\/securityscorecards\.dev\/viewer/d" README.md
sed -i "/https:\/\/img.shields.io\//d" README.md
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ github.token }}
run: npm ci
- name: Build on Windows or macOS
if: runner.os != 'Linux'
run: npm run build:no-lint
- name: Build on Linux
if: runner.os == 'Linux'
run: npm run build
- name: Check Links
if: runner.os == 'Linux'
run: npm run check:links
- name: Check copyright
if: runner.os == 'Linux'
run: npm run copyright:check
- name: Test
run: npm run test
- name: Upload dist
if: runner.os == 'Linux'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: dist
path: |
./README.md
./CHANGELOG.md
./package.json
./dist
retention-days: 1
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
if: runner.os == 'Linux'
with:
name: test-coverage
path: ./coverage
- uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: test-report-${{ matrix.target }}
path: ./test-report.html
- name: Publish coverage report to QLTY
if: github.repository_owner == 'Open-CMSIS-Pack' && runner.os == 'Linux'
uses: qltysh/qlty-action/coverage@a19242102d17e497f437d7466aa01b528537e899 # v2.2.0
with:
token: ${{ secrets.QLTY_COVERAGE_TOKEN }}
files: coverage/lcov.info
package:
name: Package
runs-on: [ubuntu-latest]
needs: build
strategy:
fail-fast: true
matrix:
target:
- win32-x64
- win32-arm64
- linux-x64
- linux-arm64
- darwin-arm64
permissions:
packages: read
actions: read # For fetching workflow artifacts with 'download-tools --nightly'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Configure git settings
run: git config --global core.autocrlf false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
node-version-file: package.json
registry-url: https://npm.pkg.github.com
package-manager-cache: false
- name: Download dist
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: .
- name: Download tools (Nightly Builds)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm ci
npm run download-tools:nightly -- --target ${{ matrix.target }} --no-cache
- name: Create vsix package
run: |
npm run package -- --target ${{ matrix.target }}
- name: Upload package
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: vscode-cmsis-debugger-nightly-${{ matrix.target }}
path: ./*.vsix
retention-days: 1
validate:
name: Validate package (${{ matrix.target }})
runs-on: ${{ matrix.platform }}
needs: package
strategy:
fail-fast: false
matrix:
include:
- target: win32-x64
platform: windows-2022
- target: win32-arm64
platform: windows-2022
- target: linux-x64
platform: ubuntu-24.04
- target: linux-arm64
platform: ubuntu-24.04
- target: darwin-arm64
platform: macos-14
permissions:
packages: read
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Configure git settings
run: git config --global core.autocrlf false
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
node-version-file: package.json
registry-url: https://npm.pkg.github.com
package-manager-cache: false
- name: Install dependencies
run: npm ci
- name: Download vsix package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: vscode-cmsis-debugger-nightly-${{ matrix.target }}
- name: Validate VSIX contents
shell: bash
run: |
VSIX_FILE=$(ls *.vsix)
echo "Validating VSIX: $VSIX_FILE"
npm run validate-tools -- --target ${{ matrix.target }} --vsix "$VSIX_FILE"