Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6514ba4

Browse files
committedJul 3, 2024··
Update contributing docs
1 parent 250281d commit 6514ba4

File tree

2 files changed

+103
-217
lines changed

2 files changed

+103
-217
lines changed
 

‎docs/CONTRIBUTING.md

Lines changed: 63 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
- [Requirements](#requirements)
77
- [Linux-specific requirements](#linux-specific-requirements)
8-
- [Creating pull requests](#creating-pull-requests)
9-
- [Commits and commit history](#commits-and-commit-history)
108
- [Development workflow](#development-workflow)
119
- [Version updates to Code](#version-updates-to-code)
1210
- [Patching Code](#patching-code)
@@ -28,13 +26,10 @@
2826
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2927
<!-- prettier-ignore-end -->
3028

31-
- [Detailed CI and build process docs](../ci)
32-
3329
## Requirements
3430

3531
The prerequisites for contributing to code-server are almost the same as those
36-
for [VS
37-
Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
32+
for [VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
3833
Here is what is needed:
3934

4035
- `node` v20.x
@@ -60,30 +55,15 @@ Here is what is needed:
6055

6156
### Linux-specific requirements
6257

63-
If you're developing code-server on Linux, make sure you have installed or install the following dependencies:
58+
If you're developing code-server on Linux, make sure you have installed or
59+
install the following dependencies:
6460

6561
```shell
6662
sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3
6763
```
6864

69-
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for more information.
70-
71-
## Creating pull requests
72-
73-
Please create a [GitHub Issue](https://github.com/coder/code-server/issues) that
74-
includes context for issues that you see. You can skip this if the proposed fix
75-
is minor.
76-
77-
In your pull requests (PR), link to the issue that the PR solves.
78-
79-
Please ensure that the base of your PR is the **main** branch.
80-
81-
### Commits and commit history
82-
83-
We prefer a clean commit history. This means you should squash all fixups and
84-
fixup-type commits before asking for a review (e.g., clean up, squash, then force
85-
push). If you need help with this, feel free to leave a comment in your PR, and
86-
we'll guide you.
65+
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)
66+
for more information.
8767

8868
## Development workflow
8969

@@ -99,55 +79,62 @@ need to apply them with `quilt`. If you pull down changes that update the
9979
`vscode` submodule you will need to run `git submodule update --init` and
10080
re-apply the patches.
10181

102-
### Version updates to Code
82+
When you make a change that affects people deploying the marketplace please
83+
update the changelog as part of your PR.
10384

104-
1. Update the `lib/vscode` submodule to the desired upstream version branch.
105-
1. `cd lib/vscode && git checkout release/1.66 && cd ../..`
106-
2. `git add lib && git commit -m "chore: update Code"`
107-
2. Apply the patches (`quilt push -a`) or restore your stashed changes. At this
108-
stage you may need to resolve conflicts. For example use `quilt push -f`,
109-
manually apply the rejected portions, then `quilt refresh`.
110-
3. From the code-server **project root**, run `yarn install`.
111-
4. Test code-server locally to make sure everything works.
112-
5. Check the Node.js version that's used by Electron (which is shipped with VS
113-
Code. If necessary, update your version of Node.js to match.
114-
6. Commit the updated submodule and patches to `code-server`.
115-
7. Open a PR.
85+
Note that building code-server takes a very, very long time, and loading it in
86+
the browser in development mode also takes a very, very long time.
11687

117-
Tip: if you're certain all patches are applied correctly and you simply need to
118-
refresh, you can use this trick:
88+
Display language (Spanish, etc) support only works in a full build; it will not
89+
work in development mode.
11990

120-
```shell
121-
while quilt push; do quilt refresh; done
122-
```
91+
Generally we prefer that PRs be squashed into `main` but you can rebase or merge
92+
if it is important to keep the individual commits (make sure to clean up the
93+
commits first if you are doing this).
94+
95+
### Version updates to Code
12396

124-
[Source](https://raphaelhertzog.com/2012/08/08/how-to-use-quilt-to-manage-patches-in-debian-packages/)
97+
1. Remove any patches with `quilt pop -a`.
98+
2. Update the `lib/vscode` submodule to the desired upstream version branch.
99+
1. `cd lib/vscode && git checkout release/1.66 && cd ../..`
100+
2. `git add lib && git commit -m "chore: update to Code <version>"`
101+
3. Apply the patches one at a time (`quilt push`). If the application succeeds
102+
but the lines changed, update the patch with `quilt refresh`. If there are
103+
conflicts, then force apply with `quilt push -f`, manually add back the
104+
rejected code, then run `quilt refresh`.
105+
4. From the code-server **project root**, run `yarn install`.
106+
5. Check the Node.js version that's used by Electron (which is shipped with VS
107+
Code. If necessary, update our version of Node.js to match.
125108

126109
### Patching Code
127110

128-
0. You can go through the patch stack with `quilt push` and `quilt pop`.
129-
1. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
130-
1. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
111+
1. You can go through the patch stack with `quilt push` and `quilt pop`.
112+
2. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
113+
3. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
131114
**must** be added before you make changes to it.
132-
1. Make your changes. Patches do not need to be independent of each other but
115+
4. Make your changes. Patches do not need to be independent of each other but
133116
each patch must result in a working code-server without any broken in-between
134117
states otherwise they are difficult to test and modify.
135-
1. Add your changes to the patch (`quilt refresh`)
136-
1. Add a comment in the patch about the reason for the patch and how to
118+
5. Add your changes to the patch (`quilt refresh`)
119+
6. Add a comment in the patch about the reason for the patch and how to
137120
reproduce the behavior it fixes or adds. Every patch should have an e2e test
138121
as well.
139122

140123
### Build
141124

142-
You can build as follows:
125+
You can build a full production as follows:
143126

144127
```shell
128+
git submodule update --init
129+
quilt push -a
130+
yarn install
145131
yarn build
146-
yarn build:vscode
132+
VERSION=0.0.0 yarn build:vscode
147133
yarn release
148134
```
149135

150-
_NOTE: this does not keep `node_modules`. If you want them to be kept, use `KEEP_MODULES=1 yarn release` (if you're testing in Coder, you'll want to do this)_
136+
This does not keep `node_modules`. If you want them to be kept, use
137+
`KEEP_MODULES=1 yarn release`
151138

152139
Run your build:
153140

@@ -158,7 +145,7 @@ npm install --omit=dev # Skip if you used KEEP_MODULES=1
158145
node .
159146
```
160147

161-
Build the release packages (make sure that you run `yarn release` first):
148+
Then, to build the release package:
162149

163150
```shell
164151
yarn release:standalone
@@ -167,7 +154,7 @@ yarn package
167154
```
168155

169156
> On Linux, the currently running distro will become the minimum supported
170-
> version. In our GitHub Actions CI, we use CentOS 7 for maximum compatibility.
157+
> version. In our GitHub Actions CI, we use CentOS 8 for maximum compatibility.
171158
> If you need your builds to support older distros, run the build commands
172159
> inside a Docker container with all the build requirements installed.
173160
@@ -181,27 +168,32 @@ writing, we do this for the following platforms/architectures:
181168
- Linux arm7l (.tar.gz)
182169
- Linux armhf.deb
183170
- Linux armhf.rpm
184-
- macOS amd64 (Intel-based)
171+
- macOS arm64.tar.gz
185172

186-
Currently, these are compiled in CI using the `yarn release-standalone` command
173+
Currently, these are compiled in CI using the `yarn release:standalone` command
187174
in the `release.yaml` workflow. We then upload them to the draft release and
188175
distribute via GitHub Releases.
189176

190177
### Troubleshooting
191178

192179
#### I see "Forbidden access" when I load code-server in the browser
193180

194-
This means your patches didn't apply correctly. We have a patch to remove the auth from vanilla Code because we use our own.
181+
This means your patches didn't apply correctly. We have a patch to remove the
182+
auth from vanilla Code because we use our own.
195183

196-
Try popping off the patches with `quilt pop -a` and reapplying with `quilt push -a`.
184+
Try popping off the patches with `quilt pop -a` and reapplying with `quilt push
185+
-a`.
197186

198187
#### "Can only have one anonymous define call per script"
199188

200-
Code might be trying to use a dev or prod HTML in the wrong context. You can try re-running code-server and setting `VSCODE_DEV=1`.
189+
Code might be trying to use a dev or prod HTML in the wrong context. You can try
190+
re-running code-server and setting `VSCODE_DEV=1`.
201191

202192
### Help
203193

204-
If you get stuck or need help, you can always start a new GitHub Discussion [here](https://github.com/coder/code-server/discussions). One of the maintainers will respond and help you out.
194+
If you get stuck or need help, you can always start a new GitHub Discussion
195+
[here](https://github.com/coder/code-server/discussions). One of the maintainers
196+
will respond and help you out.
205197

206198
## Test
207199

@@ -219,20 +211,24 @@ Our unit tests are written in TypeScript and run using
219211

220212
These live under [test/unit](../test/unit).
221213

222-
We use unit tests for functions and things that can be tested in isolation. The file structure is modeled closely after `/src` so it's easy for people to know where test files should live.
214+
We use unit tests for functions and things that can be tested in isolation. The
215+
file structure is modeled closely after `/src` so it's easy for people to know
216+
where test files should live.
223217

224218
### Script tests
225219

226220
Our script tests are written in bash and run using [bats](https://github.com/bats-core/bats-core).
227221

228222
These tests live under `test/scripts`.
229223

230-
We use these to test anything related to our scripts (most of which live under `ci`).
224+
We use these to test anything related to our scripts (most of which live under
225+
`ci`).
231226

232227
### Integration tests
233228

234-
These are a work in progress. We build code-server and run tests with `yarn test:integration`, which ensures that code-server builds work on their respective
235-
platforms.
229+
These are a work in progress. We build code-server and run tests with `yarn
230+
test:integration`, which ensures that code-server builds work on their
231+
respective platforms.
236232

237233
Our integration tests look at components that rely on one another. For example,
238234
testing the CLI requires us to build and package code-server.
@@ -253,15 +249,10 @@ Take a look at `codeServer.test.ts` to see how you would use it (see
253249
We also have a model where you can create helpers to use within tests. See
254250
[models/CodeServer.ts](../test/e2e/models/CodeServer.ts) for an example.
255251

256-
Generally speaking, e2e means testing code-server while running in the browser
257-
and interacting with it in a way that's similar to how a user would interact
258-
with it. When running these tests with `yarn test:e2e`, you must have
259-
code-server running locally. In CI, this is taken care of for you.
260-
261252
## Structure
262253

263-
The `code-server` script serves as an HTTP API for login and starting a remote
264-
Code process.
254+
code-server essentially serves as an HTTP API for logging in and starting a
255+
remote Code process.
265256

266257
The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
267258
in [src/node/routes](../src/node/routes).

‎docs/MAINTAINING.md

Lines changed: 40 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -3,156 +3,44 @@
33
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
44
# Maintaining
55

6-
- [Team](#team)
7-
- [Onboarding](#onboarding)
8-
- [Offboarding](#offboarding)
9-
- [Workflow](#workflow)
10-
- [Milestones](#milestones)
11-
- [Triage](#triage)
12-
- [Versioning](#versioning)
13-
- [Pull requests](#pull-requests)
14-
- [Merge strategies](#merge-strategies)
15-
- [Changelog](#changelog)
16-
- [Releases](#releases)
17-
- [Publishing a release](#publishing-a-release)
6+
- [Releasing](#releasing)
187
- [Release Candidates](#release-candidates)
198
- [AUR](#aur)
209
- [Docker](#docker)
2110
- [Homebrew](#homebrew)
11+
- [nixpkgs](#nixpkgs)
2212
- [npm](#npm)
23-
- [Syncing with upstream Code](#syncing-with-upstream-code)
2413
- [Testing](#testing)
2514
- [Documentation](#documentation)
2615
- [Troubleshooting](#troubleshooting)
2716

2817
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2918
<!-- prettier-ignore-end -->
3019

31-
This document is meant to serve current and future maintainers of code-server,
32-
as well as share our workflow for maintaining the project.
20+
We keep code-server up to date with VS Code releases (there are usually two or
21+
three a month) but we are not generally actively developing code-server aside
22+
from fixing regressions.
3323

34-
## Team
24+
Most of the work is keeping on top of issues and discussions.
3525

36-
Current maintainers:
26+
## Releasing
3727

38-
- @code-asher
39-
- @jsjoeio
40-
41-
Occasionally, other Coder employees may step in time to time to assist with code-server.
42-
43-
### Onboarding
44-
45-
To onboard a new maintainer to the project, please make sure to do the following:
46-
47-
- [ ] Add to [coder/code-server](https://github.com/orgs/coder/teams/code-server)
48-
- [ ] Add as Admin under [Repository Settings > Access](https://github.com/coder/code-server/settings/access)
49-
- [ ] Add to [npm Coder org](https://www.npmjs.com/org/coder)
50-
- [ ] Add as [AUR maintainer](https://aur.archlinux.org/packages/code-server/) (talk to Colin)
51-
- [ ] Introduce to community via Discussion (see [example](https://github.com/coder/code-server/discussions/3955))
52-
53-
### Offboarding
54-
55-
Very similar to Onboarding but Remove maintainer from all teams and revoke access. Please also do the following:
56-
57-
- [ ] Write farewell post via Discussion (see [example](https://github.com/coder/code-server/discussions/3933))
58-
59-
## Workflow
60-
61-
The workflow used by code-server maintainers aims to be easy to understood by
62-
the community and easy enough for new maintainers to jump in and start
63-
contributing on day one.
64-
65-
### Milestones
66-
67-
We operate mainly using
68-
[milestones](https://github.com/coder/code-server/milestones). This was heavily
69-
inspired by our friends over at [vscode](https://github.com/microsoft/vscode).
70-
71-
Here are the milestones we use and how we use them:
72-
73-
- "Backlog" -> Work not yet planned for a specific release.
74-
- "On Deck" -> Work under consideration for upcoming milestones.
75-
- "Backlog Candidates" -> Work that is not yet accepted for the backlog. We wait
76-
for the community to weigh in.
77-
- "<Month>" -> Work to be done for said month.
78-
79-
With this flow, any un-assigned issues are essentially in triage state. Once
80-
triaged, issues are either "Backlog" or "Backlog Candidates". They will
81-
eventually move to "On Deck" (or be closed). Lastly, they will end up on a
82-
version milestone where they will be worked on.
83-
84-
### Triage
85-
86-
We use the following process for triaging GitHub issues:
87-
88-
1. Create an issue
89-
1. Add appropriate labels to the issue (including "needs-investigation" if we
90-
should look into it further)
91-
1. Add the issue to a milestone
92-
1. If it should be fixed soon, add to version milestone or "On Deck"
93-
2. If not urgent, add to "Backlog"
94-
3. Otherwise, add to "Backlog Candidate" for future consideration
95-
96-
## Versioning
97-
98-
`<major.minor.patch>`
99-
100-
The code-server project follows traditional [semantic
101-
versioning](https://semver.org/), with the objective of minimizing major changes
102-
that break backward compatibility. We increment the patch level for all
103-
releases, except when the upstream Visual Studio Code project increments its
104-
minor version or we change the plugin API in a backward-compatible manner. In
105-
those cases, we increment the minor version rather than the patch level.
106-
107-
## Pull requests
108-
109-
Ideally, every PR should fix an issue. If it doesn't, make sure it's associated
110-
with a version milestone.
111-
112-
If a PR does fix an issue, don't add it to the version milestone. Otherwise, the
113-
version milestone will have duplicate information: the issue and the PR fixing
114-
the issue.
115-
116-
### Merge strategies
117-
118-
For most things, we recommend the **squash and merge** strategy. There
119-
may be times where **creating a merge commit** makes sense as well. Use your
120-
best judgment. If you're unsure, you can always discuss in the PR with the team.
121-
122-
### Changelog
123-
124-
To save time when creating a new release for code-server, we keep a running
125-
changelog at `CHANGELOG.md`.
126-
127-
If either the author or reviewer of a PR believes the change should be mentioned
128-
in the changelog, then it should be added.
129-
130-
If there is not a **Next Version** when you modify `CHANGELOG.md`, please add it
131-
using the template you see near the top of the changelog.
132-
133-
When writing your changelog item, ask yourself:
134-
135-
1. How do these changes affect code-server users?
136-
2. What actions do they need to take (if any)?
137-
138-
If you need inspiration, we suggest looking at the [Emacs
139-
changelog](https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS).
140-
141-
## Releases
142-
143-
### Publishing a release
144-
145-
1. Go to GitHub Actions > Draft release > Run workflow on the commit you want to
28+
1. Check that the changelog lists all the important changes.
29+
2. Make sure the changelog entry lists the current version of VS Code.
30+
3. Update the changelog with the release date.
31+
4. Go to GitHub Actions > Draft release > Run workflow on the commit you want to
14632
release. Make sure CI has finished the build workflow on that commit or this
147-
will fail.
148-
2. CI will automatically grab the build artifact on that commit, inject the
149-
version into the `package.json`, put together platform-specific packages, and
150-
upload those packages to a draft release.
151-
3. Summarize the major changes in the `CHANGELOG.md`.
152-
4. Copy the relevant changelog section to the release then publish it.
153-
5. CI will automatically publish the NPM package, Docker image, and update
154-
Homebrew using the published release assets.
155-
6. Bump the chart version in `Chart.yaml` and merge in the changelog updates.
33+
will fail. For the version we match VS Code's minor and patch version. The
34+
patch number may become temporarily out of sync if we need to put out a
35+
patch, but if we make our own minor change then we will not release it until
36+
the next minor VS Code release.
37+
5. CI will automatically grab the build artifact on that commit (which is why CI
38+
has to have completed), inject the provided version into the `package.json`,
39+
put together platform-specific packages, and upload those packages to a draft
40+
release.
41+
6. Update the resulting draft release with the changelog contents.
42+
7. Publish the draft release after validating it.
43+
8. Bump the Helm chart version once the Docker images have published.
15644

15745
#### Release Candidates
15846

@@ -186,37 +74,44 @@ This is currently automated with the release process (but may fail occasionally)
18674
brew bump-formula-pr --version="${VERSION}" code-server --no-browse --no-audit
18775
```
18876

77+
#### nixpkgs
78+
79+
We publish code-server in nixpkgs but it must be updated manually.
80+
18981
#### npm
19082

19183
We publish code-server as a npm package [here](https://www.npmjs.com/package/code-server/v/latest).
19284

19385
This is currently automated with the release process.
19486

195-
## Syncing with upstream Code
196-
197-
Refer to the [contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#version-updates-to-code) for information on how to update Code within code-server.
198-
19987
## Testing
20088

20189
Our testing structure is laid out under our [Contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#test).
20290

203-
We hope to eventually hit 100% test coverage with our unit tests, and maybe one day our scripts (coverage not tracked currently).
204-
20591
If you're ever looking to add more tests, here are a few ways to get started:
20692

207-
- run `yarn test:unit` and look at the coverage chart. You'll see all the uncovered lines. This is a good place to start.
208-
- look at `test/scripts` to see which scripts are tested. We can always use more tests there.
93+
- run `yarn test:unit` and look at the coverage chart. You'll see all the
94+
uncovered lines. This is a good place to start.
95+
- look at `test/scripts` to see which scripts are tested. We can always use more
96+
tests there.
20997
- look at `test/e2e`. We can always use more end-to-end tests.
21098

211-
Otherwise, talk to a current maintainer and ask which part of the codebase is lacking most when it comes to tests.
99+
Otherwise, talk to a current maintainer and ask which part of the codebase is
100+
lacking most when it comes to tests.
212101

213102
## Documentation
214103

215104
### Troubleshooting
216105

217-
Our docs are hosted on [Vercel](https://vercel.com/). Vercel only shows logs in realtime, which means you need to have the logs open in one tab and reproduce your error in another tab. Since our logs are private to Coder the organization, you can only follow these steps if you're a Coder employee. Ask a maintainer for help if you need it.
106+
Our docs are hosted on [Vercel](https://vercel.com/). Vercel only shows logs in
107+
realtime, which means you need to have the logs open in one tab and reproduce
108+
your error in another tab. Since our logs are private to Coder the organization,
109+
you can only follow these steps if you're a Coder employee. Ask a maintainer for
110+
help if you need it.
218111

219-
Taking a real scenario, let's say you wanted to troubleshoot [this docs change](https://github.com/coder/code-server/pull/4042). Here is how you would do it:
112+
Taking a real scenario, let's say you wanted to troubleshoot [this docs
113+
change](https://github.com/coder/code-server/pull/4042). Here is how you would
114+
do it:
220115

221116
1. Go to https://vercel.com/codercom/codercom
222117
2. Click "View Function Logs"

0 commit comments

Comments
 (0)
Please sign in to comment.