Skip to content

Commit 169000d

Browse files
Merge pull request #191 from eclipse-cdt-cloud/publish-ovsx
Prepare for first release to OpenVSX
2 parents ac4d706 + d5083dd commit 169000d

15 files changed

Lines changed: 277 additions & 130 deletions

File tree

.github/workflows/build.yml

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

.github/workflows/ci-cd.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [ master ]
10+
11+
jobs:
12+
13+
build-test:
14+
name: Build and run UI Tests
15+
timeout-minutes: 60
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+
- uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
- uses: actions/setup-java@v3
28+
with:
29+
distribution: 'temurin'
30+
java-version: '17'
31+
- name: Install npm dependencies and build
32+
run: yarn --frozen-lockfile
33+
- name: Package as VSCode Extension
34+
run: yarn vsce:package
35+
- name: Download sample traces
36+
run: yarn download:sample-traces
37+
- name: Download trace server
38+
run: yarn download:server
39+
- name: Start trace server
40+
run: yarn start:server &
41+
- name: Download openvscode-server
42+
run: yarn download:openvscode-server
43+
- name: Configure openvscode-server
44+
run: yarn configure:openvscode-server
45+
- name: Start openvscode-server
46+
run: yarn start:openvscode-server &
47+
- name: Install Playwright Browsers
48+
run: yarn playwright install --with-deps
49+
- name: Run Playwright tests
50+
run: yarn playwright test
51+
- uses: actions/upload-artifact@v3
52+
if: always()
53+
with:
54+
name: playwright-report
55+
path: playwright-report/
56+
retention-days: 30
57+
# Save the extension .vsix file for potential publishing
58+
# in later step (if appropriate)
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
name: extension
62+
path: vscode-trace-extension/*.vsix
63+
64+
code-lint:
65+
name: Run linter
66+
runs-on: ${{ matrix.os }}
67+
strategy:
68+
matrix:
69+
os: [ubuntu-latest]
70+
node-version: [16]
71+
72+
steps:
73+
- name: Check out Git repository
74+
uses: actions/checkout@v3
75+
- uses: actions/setup-node@v3
76+
with:
77+
node-version: ${{ matrix.node-version }}
78+
# ESLint and Prettier must be in `package.json`
79+
- name: Install dependencies
80+
run: yarn --frozen-lockfile --ignore-scripts
81+
- name: Run lint
82+
run: yarn lint
83+
- name: Run format check
84+
run: yarn format:check
85+
86+
publish:
87+
name: Publish extension to openvsx.org
88+
runs-on: ${{ matrix.os }}
89+
needs:
90+
- build-test
91+
strategy:
92+
matrix:
93+
os: [ubuntu-latest]
94+
node-version: [16]
95+
# Only execute when the trigger was a tag (new release)
96+
if: startsWith(github.ref, 'refs/tags/')
97+
98+
steps:
99+
- uses: actions/checkout@v3
100+
- uses: actions/download-artifact@v4
101+
with:
102+
name: extension
103+
path: vscode-trace-extension
104+
- uses: actions/setup-node@v3
105+
with:
106+
node-version: ${{ matrix.node-version }}
107+
- name: Install dependencies
108+
run: yarn --frozen-lockfile --ignore-scripts
109+
- name: Publish extension
110+
run: |
111+
ls -al vscode-trace-extension/*.vsix
112+
npx ovsx publish vscode-trace-extension/*.vsix
113+
env:
114+
# have ovsx consume the PAT from environment - if it's not handled explicitly
115+
# in the workflow, less risk to leak it
116+
OVSX_PAT: ${{ secrets.OPEN_VSX_TOKEN }}

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Create or prepare GitHub release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'RELEASE'
9+
pull_request:
10+
types: [opened, synchronize]
11+
branches:
12+
- master
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/actions-gh-release@v2.3.4
26+
with:
27+
release_file: 'RELEASE'
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+

CONTRIBUTING.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ file. Adding the SHA-1 of a commit to this file will make `git-blame` ignore tha
8282

8383
* For GitHub, this file is automatically detected and will ignore all the commits that are included in the file.
8484
* With Git CLI, run `git blame --ignore-revs-file=.git-blame-ignore-revs <pathToSomeFile>` to ignore the commits.
85-
<<<<<<< HEAD
8685
* `git config --global blame.ignoreRevsFile .git-blame-ignore-revs` will automatically detect these files for every repository.
87-
=======
88-
>>>>>>> d126837 (Repository formatted with prettier)
8986

9087
## Contact
9188

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# VSCode Trace Extension
22

3-
This project started from the [vscode webview react project][vscode-webview-react]. It works this way, with the extension itself being in the `vscode-trace-extension` directory and the react application being in the `vscode-trace-webapps` directory.
3+
This document contains information that may be useful for developers that want to build, modify, enhance and/or debug this extension. If you only intend to consume the extension, it might be easier to get it from the [public OpenVSX registry](https://www.open-vsx.org/extension/eclipse-cdt/vscode-trace-extension),
4+
5+
This project started from the [VSCode webview react project][vscode-webview-react]. It works this way, with the extension itself being in the `vscode-trace-extension` directory and the react application being in the `vscode-trace-webapps` directory.
46

57
**👋 Want to help?** Read our [contributor guide](CONTRIBUTING.md) and follow the instructions to contribute code.
68

7-
## Installation instructions
9+
## Installation Instructions
810

911
The code was migrated from the [PR in theia-trace-extension][init-contrib].
1012

@@ -15,37 +17,37 @@ It depends on the trace viewer plugins from the [theia trace extension package][
1517
- traceviewer-react-components
1618
- tsp-typescript-client
1719

18-
To build the vscode extension, run the `yarn` command:
20+
To build the VSCode extension, run the `yarn` command:
1921

2022
``` bash
2123
yarn
2224
```
2325

2426
## Running the extension
2527

26-
Then from vscode, press `f5` to run the extension. The trace server needs to be started separately as described [here](#run-the-trace-server).
28+
Then from VSCode, press `f5` to run the extension. The trace server needs to be started separately as described [here](#run-the-trace-server).
2729

2830
To open a trace use the VSCode file explorer to navigate to the trace directory. Then right mouse click on the trace and select menu option `Open with Trace Viewer`. See [here](#get-sample-traces) to get some sample traces.
2931

3032
Open the `Trace Viewer` view (`View` -> `Open view...`).
3133

3234
![open-trace][open-trace]
3335

34-
2 tabs will be visible: `Traces` and `Views`. The `Traces` tab will show all available traces on the trace server.
36+
Two tabs will be visible: `Traces` and `Views`. The `Traces` tab will show all available traces on the trace server.
3537

3638
The `Views` tab shows all the available views for the selected trace. Click on a view to open the view under the timeline.
3739

3840
![open-output][open-output]
3941

40-
## Package as VsCode extension
42+
## Package as a VSCode extension (.vsix)
4143

42-
To package it as VsCode extension, run the command `yarn vsce:package`. If you get errors about case-sensitive files, just delete the node_modules folder and run `yarn` again.
44+
To package it as VSCode extension, run the command `yarn vsce:package`. If you get errors about case-sensitive files, just delete the node_modules folder and run `yarn` again.
4345

4446
The packaging will produce a `vscode-trace-extension-x.x.x.vsix` file in the subdirectory `vscode-trace-extension` of the repository.
4547

46-
## Running the extension in VsCode, VsCodium or Theia application
48+
## Running the extension in VSCode, VsCodium or Theia application
4749

48-
The packaged VSIX file can be installed in an existing `VsCode`, `VsCodium` or `Theia` application by using [Install from a vsix][install].
50+
The packaged VSIX file can be installed in an existing `VSCode`, `VSCodium` or `Theia` application by using [Install from a vsix][install].
4951

5052
The trace server needs to be started separately as described [here](#run-the-trace-server).
5153

@@ -62,15 +64,15 @@ ln -s <vscode-trace-extension root>/vscode-trace-extension-x.x.x.vsix ./
6264

6365
From the root directory execute `yarn run watch`. This will watch and bundle `vscode-trace-common`, `vscode-trace-extension`, and `vscode-trace-webviews`. All outputs will be in one terminal. Changes can be observed and tested in the `Extension Development Host` by pressing `F5`.
6466

65-
For more information about `VsCode WebView API` see [here][vscode-webview].
67+
For more information about `VSCode WebView API` see [here][vscode-webview].
6668

6769
### Communication between components
6870

69-
To communicate between VsCode extension and webviews use the [VsCode message API][vscode-messages]. When using `vscode.postMessage(data)` data structure `data` will be serialized to JSON before being propagated. Be aware that it cannot include data structures like `BigInt`. Proper handling of such data structures need to be implemented when sending and receiving messages.
71+
To communicate between VSCode extension and webviews use the [VSCode message API][vscode-messages]. When using `vscode.postMessage(data)` data structure `data` will be serialized to JSON before being propagated. Be aware that it cannot include data structures like `BigInt`. Proper handling of such data structures need to be implemented when sending and receiving messages.
7072

7173
Inside a webview or inside the extension signals can be used where data structures can be passed on.
7274

73-
The following sequence diagram shows how the `experiment-selected` signal (with payload `Experiment`) is propagated inside the application. The webview `Opened Traces WebView App` is sending the signal to the`VsCode extension` which is forwarding the signal to the `Available Views WebView App`.
75+
The following sequence diagram shows how the `experiment-selected` signal (with payload `Experiment`) is propagated inside the application. The webview `Opened Traces WebView App` is sending the signal to the`VSCode extension` which is forwarding the signal to the `Available Views WebView App`.
7476

7577
```mermaid
7678
sequenceDiagram
@@ -98,9 +100,9 @@ sequenceDiagram
98100

99101
### Debugging the extension
100102

101-
It is straightforward to debug the code of the vscode extension itself (the code in `vscode-trace-extension`) by just putting breakpoints in vscode and running the extension with `f5`.
103+
It is straightforward to debug the code of the VSCode extension itself (the code in `vscode-trace-extension`) by just putting breakpoints in VSCode and running the extension with `f5`.
102104

103-
The react-app is another matter. The panel is a webview that is running in its own context, so current vscode does not have access to it. _(Patches welcome!)_
105+
The react-app is another matter. The panel is a webview that is running in its own context, so current VSCode does not have access to it. _(Patches welcome!)_
104106

105107
Each panel is its own small web application, so to debug, while in the context of the webview, press `ctrl-shift-p` and enter the command `Developer: Open Webview Developer Tools`. This will open the developer tools. The code is in the `Sources` tab of the developer tools window that opens.
106108

@@ -230,7 +232,7 @@ onWebviewPanelCreated(listener: (data: vscode.WebviewPanel) => void): void
230232

231233
```javascript
232234
//The following retrieves the API object from the vscode-trace-extension
233-
const ext = vscode.extensions.getExtension("tracecompass-community.vscode-trace-extension");
235+
const ext = vscode.extensions.getExtension("eclipse-cdt.vscode-trace-extension");
234236
const importedApi = ext.exports;
235237
```
236238

RELEASE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Release file - see documentation: https://github.com/pipe-cd/actions-gh-release#usage

doc/Publishing.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Releasing/Publishing the Trace Viewer Extension
2+
3+
The Github workflows are setup to make this relatively simple.
4+
5+
When it's desired to have a new release:
6+
7+
- open a Pull Request that steps the version of the extension in `vscode-trace-extension/package.json`
8+
- As part of the PR, update file RELEASE \[1\] in the repo root. Add or modify it to reflect the new version-to-be-released.
9+
e.g.
10+
> tag: v0.1.0 # The tag number will be created. Required.
11+
12+
- The PR should be automatically updated, and automatically generated release noted added to it
13+
- Upon merging the PR, the GH release will automatically be created, and the release notes added to document it. A release tag, for the new relase will also be created in the repo.
14+
- The release tag should trigger a publish workflow that will build and release a new version of the extension to openvsx.org
15+
16+
\[1\]: Here is the action that we use. For more details see its documentation: https://github.com/pipe-cd/actions-gh-release#actions-gh-release

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"copy-webpack-plugin": "^11.0.0",
2323
"eslint-config-prettier": "^9.0.0",
2424
"lerna": "^7.0.0",
25+
"ovsx": "latest",
2526
"prettier": "^3.0.2"
2627
},
2728
"workspaces": [

vscode-trace-common/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "vscode-trace-common",
33
"private": "true",
44
"version": "0.0.0",
5-
"publisher": "tracecompass-community",
65
"categories": [
76
"Other"
87
],

0 commit comments

Comments
 (0)