Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
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
57 changes: 36 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,37 @@ jobs:
- name: Set version
if: runner.os == 'Linux' && github.repository_owner == 'Open-CMSIS-Pack'
run: |
DESCRIBE=$(git describe --tags --long --match 'v[0-9]*.[0-9]*.[0-9]*' 2>/dev/null || true)
echo "DESCRIBE: ${DESCRIBE}"
if [ -z "${DESCRIBE}" ]; then
echo "No semver tag matching vX.Y.Z found."
exit 1
fi
BASE_TAG=$(printf '%s\n' "${DESCRIBE}" | grep -Eo '^v[0-9]+\.[0-9]+\.[0-9]+')
PR_QUALIFIER=$(printf '%s\n' "${DESCRIBE}" | grep -Eo '\-g[0-9a-f]+$' || true)
BRANCH_QUALIFIER=$(printf '%s\n' "${DESCRIBE}" | grep -Eo '[0-9]+\-g[0-9a-f]+$' || true)
SAFE_REF_NAME="${{ github.ref_name }}"
SAFE_REF_NAME="${SAFE_REF_NAME//[^0-9A-Za-z-]/-}"

case ${{ github.event_name }} in
release)
TAG="${{ github.event.release.tag_name }}"
yarn version --no-git-tag-version --new-version "${TAG#v}"
npm version --allow-same-version --no-git-tag-version --new-version "${TAG#v}"
;;
pull_request)
DESCRIBE=$(git describe --tags | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')
QUALIFIER=$(git describe --tags | grep -Eo '\-g[0-9a-f]+$' || true)
yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}"
yarn version --no-git-tag-version --prepatch --preid "pr${{ github.event.number }}${QUALIFIER}"
npm version -s --allow-same-version --no-git-tag-version --new-version "${BASE_TAG#v}"
PRERELEASE_VERSION="${BASE_TAG#v}-pr${{ github.event.number }}${PR_QUALIFIER}"
Comment thread
jreineckearm marked this conversation as resolved.
Outdated
npm version --no-git-tag-version --new-version "${PRERELEASE_VERSION}" && echo "Prerelease version set succeeded" || echo "Prerelease version set FAILED with exit code $?"
;;
*)
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)
yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}"
yarn version --no-git-tag-version --prepatch --preid "${{ github.ref_name }}${QUALIFIER}"
npm version -s --allow-same-version --no-git-tag-version --new-version "${BASE_TAG#v}"
PRERELEASE_VERSION="${BASE_TAG#v}-${SAFE_REF_NAME}${BRANCH_QUALIFIER}"
npm version --no-git-tag-version --new-version "${PRERELEASE_VERSION}" && echo "Prerelease version set succeeded" || echo "Prerelease version set FAILED with exit code $?"
;;
esac
VERSION="$(jq -r ".version" < package.json)"
sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
echo "Version is ${VERSION}"
echo "Updated CHANGELOG with version ${VERSION}"

- name: Remove badges
if: runner.os == 'Linux'
Expand All @@ -105,21 +115,21 @@ jobs:
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ github.token }}
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts
run: npm ci

- name: Build on Windows or macOS
if: runner.os != 'Linux'
run: yarn build:no-lint
run: npm run build:no-lint

- name: Build on Linux
if: runner.os == 'Linux'
run: yarn build
run: npm run build

- name: Check copyright
run: yarn copyright:check
run: npm run copyright:check

- name: Test
run: yarn test
run: npm run test

- name: Upload dist
if: runner.os == 'Linux'
Expand Down Expand Up @@ -183,6 +193,9 @@ jobs:
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
Expand All @@ -201,12 +214,12 @@ jobs:

- name: Download tools
run: |
yarn --frozen-lockfile --ignore-scripts --prefer-offline
yarn download-tools --target ${{ matrix.target }} --no-cache
npm ci
npm run download-tools -- --target ${{ matrix.target }} --no-cache

- name: Create vsix package
run: |
yarn run package --target ${{ matrix.target }} --yarn
npm run package -- --target ${{ matrix.target }}

- name: Upload package
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
Expand Down Expand Up @@ -241,6 +254,9 @@ jobs:
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
Expand All @@ -252,8 +268,7 @@ jobs:
package-manager-cache: false

- name: Install dependencies
run: |
yarn --frozen-lockfile --ignore-scripts --prefer-offline
run: npm ci

- name: Download vsix package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand All @@ -265,7 +280,7 @@ jobs:
run: |
VSIX_FILE=$(ls *.vsix)
echo "Validating VSIX: $VSIX_FILE"
yarn validate-tools --target ${{ matrix.target }} --vsix "$VSIX_FILE"
npm run validate-tools -- --target ${{ matrix.target }} --vsix "$VSIX_FILE"

publish:
name: Publish release
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permissions:
jobs:
dependency-review:
runs-on: ubuntu-latest
if: github.repository_owner == 'Open-CMSIS-Pack'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
Expand Down
33 changes: 20 additions & 13 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ jobs:
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')
yarn version -s --no-git-tag-version --new-version "${DESCRIBE#v}"
yarn version -s --no-git-tag-version --prepatch --preid "${BRANCH}${QUALIFIER:+-${QUALIFIER}}"
BASE="${DESCRIBE#v}"
IFS='.' read -r MAJ MIN PAT <<< "$BASE"
PRERELEASE_VERSION="${MAJ}.${MIN}.$((PAT + 1))-${BRANCH}${QUALIFIER:+-${QUALIFIER}}"
npm version --no-git-tag-version --new-version "${PRERELEASE_VERSION}"
VERSION="$(jq -r ".version" < package.json)"
sed -i "s/## Unreleased/## ${VERSION}/" CHANGELOG.md
echo "Version is ${VERSION}"
Expand All @@ -72,21 +74,21 @@ jobs:
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ github.token }}
run: yarn --frozen-lockfile --prefer-offline --ignore-scripts
run: npm ci

- name: Build on Windows or macOS
if: runner.os != 'Linux'
run: yarn build:no-lint
run: npm run build:no-lint

- name: Build on Linux
if: runner.os == 'Linux'
run: yarn build
run: npm run build

- name: Check copyright
run: yarn copyright:check
run: npm run copyright:check

- name: Test
run: yarn test
run: npm run test

- name: Upload dist
if: runner.os == 'Linux'
Expand Down Expand Up @@ -140,6 +142,9 @@ jobs:
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
Expand All @@ -160,12 +165,12 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn --frozen-lockfile --ignore-scripts --prefer-offline
yarn download-tools:nightly --target ${{ matrix.target }} --no-cache
npm ci
npm run download-tools:nightly -- --target ${{ matrix.target }} --no-cache

- name: Create vsix package
run: |
yarn run package --target ${{ matrix.target }} --yarn
npm run package -- --target ${{ matrix.target }}

- name: Upload package
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
Expand Down Expand Up @@ -200,6 +205,9 @@ jobs:
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
Expand All @@ -211,8 +219,7 @@ jobs:
package-manager-cache: false

- name: Install dependencies
run: |
yarn --frozen-lockfile --ignore-scripts --prefer-offline
run: npm ci

- name: Download vsix package
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
Expand All @@ -224,4 +231,4 @@ jobs:
run: |
VSIX_FILE=$(ls *.vsix)
echo "Validating VSIX: $VSIX_FILE"
yarn validate-tools --target ${{ matrix.target }} --vsix "$VSIX_FILE"
npm run validate-tools -- --target ${{ matrix.target }} --vsix "$VSIX_FILE"
4 changes: 2 additions & 2 deletions .github/workflows/tpip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ jobs:
package-manager-cache: false

- name: Install dependencies
run: yarn --frozen-lockfile --prefer-offline
run: npm ci

- name: Generate third-party licenses report
run: yarn run tpip:report
run: npm run tpip:report

- name: Commit changes
if: false
Expand Down
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@open-cmsis-pack:registry=https://npm.pkg.github.com
omit-lockfile-registry-resolved=true
30 changes: 12 additions & 18 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
- Install **Visual Studio Code®**.
- Install **Node.js®** on your machine and ensure it is on your path.
- The currently minimum required version is 20.19.x (LTS).
- Install **Yarn** which is used to build and execute scripts in this repository:

```sh
> npm install -g yarn
```

- Point npm to GitHub Package registry via `~/npmrc`:

```txt
Expand Down Expand Up @@ -39,23 +33,23 @@ Supported `<target>`s are:
to build the TypeScript code:

```sh
> yarn
> npm install
```

2. Download binary tools

```sh
> yarn download-tools [--target <target>] [--no-cache]
> npm run download-tools [--target <target>] [--no-cache]
```

If no `<target>` is specified the local system's architecture is used by default.
By default, tool downloads are cached in the yarn cache (see `yarn cache dir`) to prevent
By default, tool downloads are cached in the npm cache (see `npm cache dir`) to prevent
recurring downloads of exact same archives on clean builds.

3. Package the extension as a locally installable VSIX file:

```sh
> yarn package [--target <target>]
> npm run package [--target <target>]
```

## Release versioning
Expand All @@ -73,7 +67,7 @@ To enforce this consistently, both packaging and publishing use `scripts/vsce-re
Use the following commands:

```sh
> yarn run package [--target <target>]
> npm run package [--target <target>]
```

## Developing
Expand All @@ -82,10 +76,10 @@ Use the following commands:
after an initial build:

```sh
> yarn watch
> npm run watch
```

While just calling `yarn` creates a production build of the extension, running the above
While just calling `npm install` creates a production build of the extension, running the above
creates a build dedicated for debug. Additionally, it sets up a watch which detects code
changes and rebuilds them incrementally.

Expand All @@ -98,7 +92,7 @@ Use the following commands:
1. Run the following command to execute all test locally:

```sh
> yarn test
> npm run test
```

**Note**: At this point, no tests have been added to this repository.
Expand All @@ -109,7 +103,7 @@ To simplify setup of you environment, an `all` script exists which runs build, t
and unit tests. Run:

```sh
> yarn all
> npm run all
```

## Updating tool dependencies
Expand All @@ -132,7 +126,7 @@ Markdown linter to ensure consistency and adherence to the project's formatting
Run the following command from the project root:

```bash
yarn lint:md
npm run lint:md
````

This command checks Markdown files against the linting rules defined in the
Expand All @@ -144,14 +138,14 @@ maintain high-quality, readable, and standardized documentation across the proje
> Tip: Simple rule violations can be fixed by the linter itself. Try running the following before manually going through all warnings/errors:
>
> ```bash
> yarn lint:md --fix
> npm run lint:md --fix
> ````

Additionally, if your changes involve updating or adding links within the documentation, you can verify the validity
of all links by running:

```bash
yarn check:links
npm run check:links
````

This will check each link to ensure it is reachable (i.e., returns a 200 OK status). Identifying and correcting broken
Expand Down
Loading
Loading