Skip to content

Commit f183ad3

Browse files
Add infrastructure to release/publish as part of CI
The added infrastructure is similar to what we recently added in the vscode-trace-extension repo. The idea is to automate creating a GitHub release and corresponding git tag, as well as the publishing to vscode extension registries (open-vsx.org to start-with). To achieve that, a new GitHub workflow was created: "release", that uses action "pipe-cd/actions-gh-release" to automatically create a GitHub release containing release notes generated from commits and a git tag. The trigger for that to happen is the modification of root file "RELEASE" to include a new release tag. We also renamed workflow "build" to "ci-cd" and updated it. It now has a publish job, that triggers upon a new release being created, and publishes the extension in "vsix" format to open-vsx.org. To prepare for the first release/publish, we also updated the extension's README, factoring-out the developer-centric information to its own file and keeping a minimal first draft of the README that will be shown to the end-users on the extension registry and in the extensions view. Also updated the extension's package.json to have the necessary fields and information, for a published extension. Once this is merged, if everything works as expected, all that will be needed for a first release will be to update the tag in file RELEASE to the release version and update the extension's version in package.json to the same. See below for some more info about the changes made, that were squashed into this single commit. add release workflow Add initial RELEASE file It's used by action pipe-cd/actions-gh-release . It will also require the initial tag in the git repo, which I will add separately. massage package.json add icon for extension For now reusing the same one as vscode-trace-extension Add format check scripts and run in workflow yarn format:check runs prettier on the sources and makes sure it's presentable README update Split the README into README-dev.md for developers and README.md for users. The later will be included and shown on the extension registry and in the extensions view, when the extension is selected. Signed-off-by: Marc Dumais <[email protected]>
1 parent bd538d7 commit f183ad3

File tree

9 files changed

+275
-175
lines changed

9 files changed

+275
-175
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 76 deletions
This file was deleted.

.github/workflows/ci-cd.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
release:
9+
types:
10+
- published
11+
12+
jobs:
13+
14+
build-test:
15+
name: Build and Test
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
matrix:
19+
os: [ubuntu-latest]
20+
node-version: [16]
21+
22+
steps:
23+
- uses: actions/checkout@v3
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
- run: yarn --frozen-lockfile
29+
- name: Run tests
30+
uses: coactions/setup-xvfb@v1
31+
with:
32+
run: yarn test
33+
- name: Package as VSCode Extension
34+
run: yarn vsce:package
35+
# Save the extension .vsix file for potential publishing
36+
# in later step (if appropriate)
37+
- uses: actions/upload-artifact@v4
38+
with:
39+
name: extension
40+
path: vscode-trace-server-*.vsix
41+
42+
code-lint:
43+
runs-on: ${{ matrix.os }}
44+
strategy:
45+
matrix:
46+
os: [ubuntu-latest]
47+
node-version: [16]
48+
49+
steps:
50+
- name: Check out Git repository
51+
uses: actions/checkout@v3
52+
- uses: actions/setup-node@v3
53+
with:
54+
node-version: ${{ matrix.node-version }}
55+
# ESLint and Prettier must be in `package.json`
56+
- run: yarn --frozen-lockfile --ignore-scripts
57+
- name: Run lint
58+
run: yarn lint
59+
- name: Run format check
60+
run: yarn format:check
61+
62+
publish:
63+
name: Publish extension to openvsx.org
64+
runs-on: ${{ matrix.os }}
65+
needs:
66+
- build-test
67+
strategy:
68+
matrix:
69+
os: [ubuntu-latest]
70+
node-version: [16]
71+
# Only execute when the trigger was a tag (new release)
72+
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
73+
74+
steps:
75+
- uses: actions/checkout@v3
76+
# restore extension from the built-test job
77+
- uses: actions/download-artifact@v4
78+
with:
79+
name: extension
80+
- uses: actions/setup-node@v3
81+
with:
82+
node-version: ${{ matrix.node-version }}
83+
- name: Install dependencies
84+
run: yarn --frozen-lockfile --ignore-scripts
85+
- name: Publish extension
86+
run: |
87+
ls -al vscode-trace-server-*.vsix
88+
npx ovsx publish vscode-trace-server-*.vsix
89+
env:
90+
# have ovsx consume the PAT from environment - if it's not handled explicitly
91+
# in the workflow, less risk to leak it
92+
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}
93+

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Create or prepare GitHub release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'RELEASE'
9+
pull_request:
10+
types: [opened, synchronize]
11+
branches:
12+
- main
13+
paths:
14+
- 'RELEASE'
15+
16+
jobs:
17+
gh-release:
18+
name: GitHub release
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 0
25+
- uses: pipe-cd/[email protected]
26+
with:
27+
release_file: 'RELEASE'
28+
# Actions that run using the auto-generated GitHub token are
29+
# not allowed to trigger a new workflow run. In this case we want
30+
# the tag created by actions-gh-release to trigger the main workflow
31+
# and result in publishing the extension to open-vsx.
32+
# The following scopes are required when creating the committer token:
33+
# - repo:status, repo_deployment, public_repo, read:org
34+
# See here for more details:
35+
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
36+
token: ${{ secrets.GH_COMMITTER_TOKEN }}
37+

README-dev.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# VSCode Trace Server extension
2+
3+
This file contains information that could be interesting to developers, that want to mnodify, build, test, and debug this extension.
4+
5+
For general information, see the main [README.md](README.md)
6+
7+
8+
* This is a TypeScript extension, officially named `vscode-trace-server`.
9+
* It is meant as companion to the [vscode-trace-extension][vscode-trace-extension].
10+
* It registers `Trace Server:` start/stop commands, for a default instance locally.
11+
* It depends on the [tsp-typescript-client][client] for server health check purposes.
12+
13+
This extension was started from Code's [guide][guide] and related [sample][sample].
14+
15+
## Documentation
16+
17+
This README is the usual entry point for documenting this extension.
18+
19+
* One may refer to the [contribution guide](CONTRIBUTING.md) for how to contribute.
20+
* Please also refer to the [security policy](SECURITY.md) on a need basis.
21+
* The usual [license description](LICENSE.md) file accompanies these too.
22+
23+
## Build
24+
25+
Run `yarn`, which should automatically include `yarn install`.
26+
27+
* This extension is bundled using `webpack`, originally based on [the guide][guide].
28+
* There is only a modest automated CI test suite being run on GitHub
29+
30+
## Test
31+
32+
Run `yarn test` on a need basis.
33+
34+
Alternatively, launch `Extension Tests` under `Run and Debug`.
35+
36+
## Installation
37+
38+
1. After [having built](#build) at least once, run `yarn vsce:package` ([more][vsce]) at will.
39+
1. [Install][install] the hereby generated `vscode-trace-server-*.vsix` file.
40+
1. Alternatively, simply launch the packaged extension using `Run Extension`.
41+
1. Through `Command Palette`, the `Trace Server:` start/stop commands should be available.
42+
43+
This extension can be installed in either one (or many) of:
44+
45+
* [VS Code][code] or [Codium][codium]/Code-OSS, or
46+
* a [Theia][theia] application such as [Blueprint][blueprint].
47+
48+
The dependent [Trace Viewer for VSCode][vscode-trace-extension] extension renders a `Trace Server`
49+
[status bar item][item]. A note:
50+
51+
Reinstalling an amended extension that has the same version requires removing the unpacked extension, found under one of the following folders:
52+
53+
* [Theia Blueprint][blueprint]: extracts installed extensions under `/tmp/vscode-unpacked/`.
54+
* VSCode: extracts the installed extensions under the user's home, in folder `.vscode/extensions/`.
55+
56+
Alternatively, you may step the extension's version to avoid this issue.
57+
58+
## Debugging
59+
60+
* One may launch the extension using `Run Extension`, to debug it with breakpoints, as usual.
61+
* The same can be done for tests, launching `Extension Tests` to debug them.
62+
* The enabled breakpoints get bound only upon exercising the extension.
63+
64+
## Development
65+
66+
The usual [Prettier][prettier] and [ESLint][eslint] combo in VS Code or Codium OSS is used.
67+
68+
* [This matcher][matcher] is also used, since the originally generated extension per [guide].
69+
* Markdown gets linted with the (usual) [vscode-markdownlint][markdownlint] extension.
70+
* [SonarLint][sonarlint] is also assumed while further developing this extension.
71+
72+
These are actual [recommended extensions herein](.vscode/extensions.json).
73+
74+
* Beside using [the extension][prettier], one may run `prettier` from the CLI:
75+
76+
```bash
77+
# confirm formatting is ok:
78+
yarn format:check
79+
# correct the formatting:
80+
yarn format:write
81+
82+
```
83+
84+
## Status
85+
86+
This extension is currently under [initial development][backlog].
87+
88+
[backlog]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension/issues/15
89+
[blueprint]: https://theia-ide.org/docs/blueprint_download
90+
[client]: https://github.com/eclipse-cdt-cloud/tsp-typescript-client
91+
[code]: https://code.visualstudio.com
92+
[codium]: https://vscodium.com
93+
[eslint]: https://open-vsx.org/extension/dbaeumer/vscode-eslint
94+
[guide]: https://code.visualstudio.com/api/get-started/your-first-extension
95+
[install]: https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix
96+
[item]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension/pull/120
97+
[markdownlint]: https://open-vsx.org/extension/DavidAnson/vscode-markdownlint
98+
[matcher]: https://open-vsx.org/extension/amodio/tsl-problem-matcher
99+
[prettier]: https://open-vsx.org/extension/esbenp/prettier-vscode
100+
[sample]: https://github.com/microsoft/vscode-extension-samples/blob/main/helloworld-sample
101+
[server]: https://git.eclipse.org/r/plugins/gitiles/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/refs/heads/master/trace-server/#running-the-server
102+
[sonarlint]: https://open-vsx.org/extension/SonarSource/sonarlint-vscode
103+
[theia]: https://theia-ide.org
104+
[tsp]: https://github.com/eclipse-cdt-cloud/trace-server-protocol
105+
[vsce]: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#vsce
106+
[vscode-trace-extension]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension

0 commit comments

Comments
 (0)