-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from eclipse-cdt-cloud/publish
Add infrastructure to release/publish as part of CI
- Loading branch information
Showing
9 changed files
with
278 additions
and
170 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: CI/CD | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
|
||
build-test: | ||
name: Build and Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node-version: [16] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: yarn --frozen-lockfile | ||
- name: Run tests | ||
uses: coactions/setup-xvfb@v1 | ||
with: | ||
run: yarn test | ||
- name: Package as VSCode Extension | ||
run: yarn vsce:package | ||
# Save the extension .vsix file for potential publishing | ||
# in later step (if appropriate) | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: extension | ||
path: vscode-trace-server-*.vsix | ||
|
||
code-lint: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node-version: [16] | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
# ESLint and Prettier must be in `package.json` | ||
- run: yarn --frozen-lockfile --ignore-scripts | ||
- name: Run lint | ||
run: yarn lint | ||
- name: Run format check | ||
run: yarn format:check | ||
|
||
publish: | ||
name: Publish extension to openvsx.org | ||
runs-on: ${{ matrix.os }} | ||
needs: | ||
- build-test | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node-version: [16] | ||
# Only execute when the trigger was a tag (new release) | ||
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v') | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
# restore extension from the built-test job | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: extension | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install dependencies | ||
run: yarn --frozen-lockfile --ignore-scripts | ||
- name: Publish extension | ||
run: | | ||
ls -al vscode-trace-server-*.vsix | ||
npx ovsx publish vscode-trace-server-*.vsix | ||
env: | ||
# have ovsx consume the PAT from environment - if it's not handled explicitly | ||
# in the workflow, less risk to leak it | ||
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Create or prepare GitHub release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'RELEASE' | ||
pull_request: | ||
types: [opened, synchronize] | ||
branches: | ||
- main | ||
paths: | ||
- 'RELEASE' | ||
|
||
jobs: | ||
gh-release: | ||
name: GitHub release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: pipe-cd/actions-gh-release@v2.6.0 | ||
with: | ||
release_file: 'RELEASE' | ||
# Actions that run using the auto-generated GitHub token are | ||
# not allowed to trigger a new workflow run. In this case we want | ||
# the tag created by actions-gh-release to trigger the main workflow | ||
# and result in publishing the extension to open-vsx. | ||
# The following scopes are required when creating the committer token: | ||
# - repo:status, repo_deployment, public_repo, read:org | ||
# See here for more details: | ||
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow | ||
token: ${{ secrets.GH_COMMITTER_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# VSCode Trace Server extension | ||
|
||
This file contains information that could be interesting to developers, that want to modify, build, test, and debug this extension. | ||
|
||
For general information, see the main [README.md](README.md) | ||
|
||
|
||
* This is a TypeScript extension, officially named `vscode-trace-server`. | ||
* It is meant as companion to the [vscode-trace-extension][vscode-trace-extension]. | ||
* It registers `Trace Server:` start/stop commands, for a default instance locally. | ||
* It depends on the [tsp-typescript-client][client] for server health check purposes. | ||
|
||
This extension was started from Code's [guide][guide] and related [sample][sample]. | ||
|
||
## Documentation | ||
|
||
This README is the usual entry point for documenting this extension. | ||
|
||
* One may refer to the [contribution guide](CONTRIBUTING.md) for how to contribute. | ||
* Please also refer to the [security policy](SECURITY.md) on a need basis. | ||
* The usual [license description](LICENSE.md) file accompanies these too. | ||
|
||
## Build | ||
|
||
Run `yarn`, which should automatically include `yarn install`. | ||
|
||
* This extension is bundled using `webpack`, originally based on [the guide][guide]. | ||
* There is only a modest automated CI test suite being run on GitHub | ||
|
||
## Test | ||
|
||
Run `yarn test` on a need basis. | ||
|
||
Alternatively, launch `Extension Tests` under `Run and Debug`. | ||
|
||
## Installation | ||
|
||
1. After [having built](#build) at least once, run `yarn vsce:package` ([more][vsce]) at will. | ||
1. [Install][install] the hereby generated `vscode-trace-server-*.vsix` file. | ||
1. Alternatively, simply launch the packaged extension using `Run Extension`. | ||
1. Through `Command Palette`, the `Trace Server:` start/stop commands should be available. | ||
|
||
This extension can be installed in either one (or many) of: | ||
|
||
* [VS Code][code] or [Codium][codium]/Code-OSS, or | ||
* a [Theia][theia] application such as [Blueprint][blueprint]. | ||
|
||
The dependent [Trace Viewer for VSCode][vscode-trace-extension] extension renders a `Trace Server` | ||
[status bar item][item]. A note: | ||
|
||
Reinstalling an amended extension that has the same version requires removing the unpacked extension, found under one of the following folders: | ||
|
||
* [Theia Blueprint][blueprint]: extracts installed extensions under `/tmp/vscode-unpacked/`. | ||
* VSCode: extracts the installed extensions under the user's home, in folder `.vscode/extensions/`. | ||
|
||
Alternatively, you may step the extension's version to avoid this issue. | ||
|
||
## Debugging | ||
|
||
* One may launch the extension using `Run Extension`, to debug it with breakpoints, as usual. | ||
* The same can be done for tests, launching `Extension Tests` to debug them. | ||
* The enabled breakpoints get bound only upon exercising the extension. | ||
|
||
## Development | ||
|
||
The usual [Prettier][prettier] and [ESLint][eslint] combo in VS Code or Codium OSS is used. | ||
|
||
* [This matcher][matcher] is also used, since the originally generated extension per [guide]. | ||
* Markdown gets linted with the (usual) [vscode-markdownlint][markdownlint] extension. | ||
* [SonarLint][sonarlint] is also assumed while further developing this extension. | ||
|
||
These are actual [recommended extensions herein](.vscode/extensions.json). | ||
|
||
* Beside using [the extension][prettier], one may run `prettier` from the CLI: | ||
|
||
```bash | ||
# confirm formatting is ok: | ||
yarn format:check | ||
# correct the formatting: | ||
yarn format:write | ||
|
||
``` | ||
|
||
|
||
[backlog]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension/issues/15 | ||
[blueprint]: https://theia-ide.org/docs/blueprint_download | ||
[client]: https://github.com/eclipse-cdt-cloud/tsp-typescript-client | ||
[code]: https://code.visualstudio.com | ||
[codium]: https://vscodium.com | ||
[eslint]: https://open-vsx.org/extension/dbaeumer/vscode-eslint | ||
[guide]: https://code.visualstudio.com/api/get-started/your-first-extension | ||
[install]: https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix | ||
[item]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension/pull/120 | ||
[markdownlint]: https://open-vsx.org/extension/DavidAnson/vscode-markdownlint | ||
[matcher]: https://open-vsx.org/extension/amodio/tsl-problem-matcher | ||
[prettier]: https://open-vsx.org/extension/esbenp/prettier-vscode | ||
[sample]: https://github.com/microsoft/vscode-extension-samples/blob/main/helloworld-sample | ||
[server]: https://git.eclipse.org/r/plugins/gitiles/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/refs/heads/master/trace-server/#running-the-server | ||
[sonarlint]: https://open-vsx.org/extension/SonarSource/sonarlint-vscode | ||
[theia]: https://theia-ide.org | ||
[tsp]: https://github.com/eclipse-cdt-cloud/trace-server-protocol | ||
[vsce]: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#vsce | ||
[vscode-trace-extension]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension |
Oops, something went wrong.