Skip to content

Commit 08e17dc

Browse files
Merge pull request #22 from eclipse-cdt-cloud/publish
Add infrastructure to release/publish as part of CI
2 parents bd538d7 + 46ebcc9 commit 08e17dc

File tree

9 files changed

+278
-170
lines changed

9 files changed

+278
-170
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: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# VSCode Trace Server extension
2+
3+
This file contains information that could be interesting to developers, that want to modify, 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+
85+
[backlog]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension/issues/15
86+
[blueprint]: https://theia-ide.org/docs/blueprint_download
87+
[client]: https://github.com/eclipse-cdt-cloud/tsp-typescript-client
88+
[code]: https://code.visualstudio.com
89+
[codium]: https://vscodium.com
90+
[eslint]: https://open-vsx.org/extension/dbaeumer/vscode-eslint
91+
[guide]: https://code.visualstudio.com/api/get-started/your-first-extension
92+
[install]: https://code.visualstudio.com/docs/editor/extension-marketplace#_install-from-a-vsix
93+
[item]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension/pull/120
94+
[markdownlint]: https://open-vsx.org/extension/DavidAnson/vscode-markdownlint
95+
[matcher]: https://open-vsx.org/extension/amodio/tsl-problem-matcher
96+
[prettier]: https://open-vsx.org/extension/esbenp/prettier-vscode
97+
[sample]: https://github.com/microsoft/vscode-extension-samples/blob/main/helloworld-sample
98+
[server]: https://git.eclipse.org/r/plugins/gitiles/tracecompass.incubator/org.eclipse.tracecompass.incubator/+/refs/heads/master/trace-server/#running-the-server
99+
[sonarlint]: https://open-vsx.org/extension/SonarSource/sonarlint-vscode
100+
[theia]: https://theia-ide.org
101+
[tsp]: https://github.com/eclipse-cdt-cloud/trace-server-protocol
102+
[vsce]: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#vsce
103+
[vscode-trace-extension]: https://github.com/eclipse-cdt-cloud/vscode-trace-extension

0 commit comments

Comments
 (0)