mirror of https://github.com/coder/code-server.git
Update contributing docs
This commit is contained in:
parent
250281d071
commit
6514ba4bf3
|
@ -5,8 +5,6 @@
|
|||
|
||||
- [Requirements](#requirements)
|
||||
- [Linux-specific requirements](#linux-specific-requirements)
|
||||
- [Creating pull requests](#creating-pull-requests)
|
||||
- [Commits and commit history](#commits-and-commit-history)
|
||||
- [Development workflow](#development-workflow)
|
||||
- [Version updates to Code](#version-updates-to-code)
|
||||
- [Patching Code](#patching-code)
|
||||
|
@ -28,13 +26,10 @@
|
|||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
- [Detailed CI and build process docs](../ci)
|
||||
|
||||
## Requirements
|
||||
|
||||
The prerequisites for contributing to code-server are almost the same as those
|
||||
for [VS
|
||||
Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
|
||||
for [VS Code](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites).
|
||||
Here is what is needed:
|
||||
|
||||
- `node` v20.x
|
||||
|
@ -60,30 +55,15 @@ Here is what is needed:
|
|||
|
||||
### Linux-specific requirements
|
||||
|
||||
If you're developing code-server on Linux, make sure you have installed or install the following dependencies:
|
||||
If you're developing code-server on Linux, make sure you have installed or
|
||||
install the following dependencies:
|
||||
|
||||
```shell
|
||||
sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev libkrb5-dev python-is-python3
|
||||
```
|
||||
|
||||
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites) for more information.
|
||||
|
||||
## Creating pull requests
|
||||
|
||||
Please create a [GitHub Issue](https://github.com/coder/code-server/issues) that
|
||||
includes context for issues that you see. You can skip this if the proposed fix
|
||||
is minor.
|
||||
|
||||
In your pull requests (PR), link to the issue that the PR solves.
|
||||
|
||||
Please ensure that the base of your PR is the **main** branch.
|
||||
|
||||
### Commits and commit history
|
||||
|
||||
We prefer a clean commit history. This means you should squash all fixups and
|
||||
fixup-type commits before asking for a review (e.g., clean up, squash, then force
|
||||
push). If you need help with this, feel free to leave a comment in your PR, and
|
||||
we'll guide you.
|
||||
These are required by Code. See [their Wiki](https://github.com/microsoft/vscode/wiki/How-to-Contribute#prerequisites)
|
||||
for more information.
|
||||
|
||||
## Development workflow
|
||||
|
||||
|
@ -99,55 +79,62 @@ need to apply them with `quilt`. If you pull down changes that update the
|
|||
`vscode` submodule you will need to run `git submodule update --init` and
|
||||
re-apply the patches.
|
||||
|
||||
When you make a change that affects people deploying the marketplace please
|
||||
update the changelog as part of your PR.
|
||||
|
||||
Note that building code-server takes a very, very long time, and loading it in
|
||||
the browser in development mode also takes a very, very long time.
|
||||
|
||||
Display language (Spanish, etc) support only works in a full build; it will not
|
||||
work in development mode.
|
||||
|
||||
Generally we prefer that PRs be squashed into `main` but you can rebase or merge
|
||||
if it is important to keep the individual commits (make sure to clean up the
|
||||
commits first if you are doing this).
|
||||
|
||||
### Version updates to Code
|
||||
|
||||
1. Update the `lib/vscode` submodule to the desired upstream version branch.
|
||||
1. Remove any patches with `quilt pop -a`.
|
||||
2. Update the `lib/vscode` submodule to the desired upstream version branch.
|
||||
1. `cd lib/vscode && git checkout release/1.66 && cd ../..`
|
||||
2. `git add lib && git commit -m "chore: update Code"`
|
||||
2. Apply the patches (`quilt push -a`) or restore your stashed changes. At this
|
||||
stage you may need to resolve conflicts. For example use `quilt push -f`,
|
||||
manually apply the rejected portions, then `quilt refresh`.
|
||||
3. From the code-server **project root**, run `yarn install`.
|
||||
4. Test code-server locally to make sure everything works.
|
||||
2. `git add lib && git commit -m "chore: update to Code <version>"`
|
||||
3. Apply the patches one at a time (`quilt push`). If the application succeeds
|
||||
but the lines changed, update the patch with `quilt refresh`. If there are
|
||||
conflicts, then force apply with `quilt push -f`, manually add back the
|
||||
rejected code, then run `quilt refresh`.
|
||||
4. From the code-server **project root**, run `yarn install`.
|
||||
5. Check the Node.js version that's used by Electron (which is shipped with VS
|
||||
Code. If necessary, update your version of Node.js to match.
|
||||
6. Commit the updated submodule and patches to `code-server`.
|
||||
7. Open a PR.
|
||||
|
||||
Tip: if you're certain all patches are applied correctly and you simply need to
|
||||
refresh, you can use this trick:
|
||||
|
||||
```shell
|
||||
while quilt push; do quilt refresh; done
|
||||
```
|
||||
|
||||
[Source](https://raphaelhertzog.com/2012/08/08/how-to-use-quilt-to-manage-patches-in-debian-packages/)
|
||||
Code. If necessary, update our version of Node.js to match.
|
||||
|
||||
### Patching Code
|
||||
|
||||
0. You can go through the patch stack with `quilt push` and `quilt pop`.
|
||||
1. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
|
||||
1. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
|
||||
1. You can go through the patch stack with `quilt push` and `quilt pop`.
|
||||
2. Create a new patch (`quilt new {name}.diff`) or use an existing patch.
|
||||
3. Add the file(s) you are patching (`quilt add [-P patch] {file}`). A file
|
||||
**must** be added before you make changes to it.
|
||||
1. Make your changes. Patches do not need to be independent of each other but
|
||||
4. Make your changes. Patches do not need to be independent of each other but
|
||||
each patch must result in a working code-server without any broken in-between
|
||||
states otherwise they are difficult to test and modify.
|
||||
1. Add your changes to the patch (`quilt refresh`)
|
||||
1. Add a comment in the patch about the reason for the patch and how to
|
||||
5. Add your changes to the patch (`quilt refresh`)
|
||||
6. Add a comment in the patch about the reason for the patch and how to
|
||||
reproduce the behavior it fixes or adds. Every patch should have an e2e test
|
||||
as well.
|
||||
|
||||
### Build
|
||||
|
||||
You can build as follows:
|
||||
You can build a full production as follows:
|
||||
|
||||
```shell
|
||||
git submodule update --init
|
||||
quilt push -a
|
||||
yarn install
|
||||
yarn build
|
||||
yarn build:vscode
|
||||
VERSION=0.0.0 yarn build:vscode
|
||||
yarn release
|
||||
```
|
||||
|
||||
_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)_
|
||||
This does not keep `node_modules`. If you want them to be kept, use
|
||||
`KEEP_MODULES=1 yarn release`
|
||||
|
||||
Run your build:
|
||||
|
||||
|
@ -158,7 +145,7 @@ npm install --omit=dev # Skip if you used KEEP_MODULES=1
|
|||
node .
|
||||
```
|
||||
|
||||
Build the release packages (make sure that you run `yarn release` first):
|
||||
Then, to build the release package:
|
||||
|
||||
```shell
|
||||
yarn release:standalone
|
||||
|
@ -167,7 +154,7 @@ yarn package
|
|||
```
|
||||
|
||||
> On Linux, the currently running distro will become the minimum supported
|
||||
> version. In our GitHub Actions CI, we use CentOS 7 for maximum compatibility.
|
||||
> version. In our GitHub Actions CI, we use CentOS 8 for maximum compatibility.
|
||||
> If you need your builds to support older distros, run the build commands
|
||||
> inside a Docker container with all the build requirements installed.
|
||||
|
||||
|
@ -181,9 +168,9 @@ writing, we do this for the following platforms/architectures:
|
|||
- Linux arm7l (.tar.gz)
|
||||
- Linux armhf.deb
|
||||
- Linux armhf.rpm
|
||||
- macOS amd64 (Intel-based)
|
||||
- macOS arm64.tar.gz
|
||||
|
||||
Currently, these are compiled in CI using the `yarn release-standalone` command
|
||||
Currently, these are compiled in CI using the `yarn release:standalone` command
|
||||
in the `release.yaml` workflow. We then upload them to the draft release and
|
||||
distribute via GitHub Releases.
|
||||
|
||||
|
@ -191,17 +178,22 @@ distribute via GitHub Releases.
|
|||
|
||||
#### I see "Forbidden access" when I load code-server in the browser
|
||||
|
||||
This means your patches didn't apply correctly. We have a patch to remove the auth from vanilla Code because we use our own.
|
||||
This means your patches didn't apply correctly. We have a patch to remove the
|
||||
auth from vanilla Code because we use our own.
|
||||
|
||||
Try popping off the patches with `quilt pop -a` and reapplying with `quilt push -a`.
|
||||
Try popping off the patches with `quilt pop -a` and reapplying with `quilt push
|
||||
-a`.
|
||||
|
||||
#### "Can only have one anonymous define call per script"
|
||||
|
||||
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`.
|
||||
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`.
|
||||
|
||||
### Help
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
## Test
|
||||
|
||||
|
@ -219,7 +211,9 @@ Our unit tests are written in TypeScript and run using
|
|||
|
||||
These live under [test/unit](../test/unit).
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
### Script tests
|
||||
|
||||
|
@ -227,12 +221,14 @@ Our script tests are written in bash and run using [bats](https://github.com/bat
|
|||
|
||||
These tests live under `test/scripts`.
|
||||
|
||||
We use these to test anything related to our scripts (most of which live under `ci`).
|
||||
We use these to test anything related to our scripts (most of which live under
|
||||
`ci`).
|
||||
|
||||
### Integration tests
|
||||
|
||||
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
|
||||
platforms.
|
||||
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 platforms.
|
||||
|
||||
Our integration tests look at components that rely on one another. For example,
|
||||
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
|
|||
We also have a model where you can create helpers to use within tests. See
|
||||
[models/CodeServer.ts](../test/e2e/models/CodeServer.ts) for an example.
|
||||
|
||||
Generally speaking, e2e means testing code-server while running in the browser
|
||||
and interacting with it in a way that's similar to how a user would interact
|
||||
with it. When running these tests with `yarn test:e2e`, you must have
|
||||
code-server running locally. In CI, this is taken care of for you.
|
||||
|
||||
## Structure
|
||||
|
||||
The `code-server` script serves as an HTTP API for login and starting a remote
|
||||
Code process.
|
||||
code-server essentially serves as an HTTP API for logging in and starting a
|
||||
remote Code process.
|
||||
|
||||
The CLI code is in [src/node](../src/node) and the HTTP routes are implemented
|
||||
in [src/node/routes](../src/node/routes).
|
||||
|
|
|
@ -3,24 +3,13 @@
|
|||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
# Maintaining
|
||||
|
||||
- [Team](#team)
|
||||
- [Onboarding](#onboarding)
|
||||
- [Offboarding](#offboarding)
|
||||
- [Workflow](#workflow)
|
||||
- [Milestones](#milestones)
|
||||
- [Triage](#triage)
|
||||
- [Versioning](#versioning)
|
||||
- [Pull requests](#pull-requests)
|
||||
- [Merge strategies](#merge-strategies)
|
||||
- [Changelog](#changelog)
|
||||
- [Releases](#releases)
|
||||
- [Publishing a release](#publishing-a-release)
|
||||
- [Releasing](#releasing)
|
||||
- [Release Candidates](#release-candidates)
|
||||
- [AUR](#aur)
|
||||
- [Docker](#docker)
|
||||
- [Homebrew](#homebrew)
|
||||
- [nixpkgs](#nixpkgs)
|
||||
- [npm](#npm)
|
||||
- [Syncing with upstream Code](#syncing-with-upstream-code)
|
||||
- [Testing](#testing)
|
||||
- [Documentation](#documentation)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
|
@ -28,131 +17,30 @@
|
|||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
This document is meant to serve current and future maintainers of code-server,
|
||||
as well as share our workflow for maintaining the project.
|
||||
We keep code-server up to date with VS Code releases (there are usually two or
|
||||
three a month) but we are not generally actively developing code-server aside
|
||||
from fixing regressions.
|
||||
|
||||
## Team
|
||||
Most of the work is keeping on top of issues and discussions.
|
||||
|
||||
Current maintainers:
|
||||
## Releasing
|
||||
|
||||
- @code-asher
|
||||
- @jsjoeio
|
||||
|
||||
Occasionally, other Coder employees may step in time to time to assist with code-server.
|
||||
|
||||
### Onboarding
|
||||
|
||||
To onboard a new maintainer to the project, please make sure to do the following:
|
||||
|
||||
- [ ] Add to [coder/code-server](https://github.com/orgs/coder/teams/code-server)
|
||||
- [ ] Add as Admin under [Repository Settings > Access](https://github.com/coder/code-server/settings/access)
|
||||
- [ ] Add to [npm Coder org](https://www.npmjs.com/org/coder)
|
||||
- [ ] Add as [AUR maintainer](https://aur.archlinux.org/packages/code-server/) (talk to Colin)
|
||||
- [ ] Introduce to community via Discussion (see [example](https://github.com/coder/code-server/discussions/3955))
|
||||
|
||||
### Offboarding
|
||||
|
||||
Very similar to Onboarding but Remove maintainer from all teams and revoke access. Please also do the following:
|
||||
|
||||
- [ ] Write farewell post via Discussion (see [example](https://github.com/coder/code-server/discussions/3933))
|
||||
|
||||
## Workflow
|
||||
|
||||
The workflow used by code-server maintainers aims to be easy to understood by
|
||||
the community and easy enough for new maintainers to jump in and start
|
||||
contributing on day one.
|
||||
|
||||
### Milestones
|
||||
|
||||
We operate mainly using
|
||||
[milestones](https://github.com/coder/code-server/milestones). This was heavily
|
||||
inspired by our friends over at [vscode](https://github.com/microsoft/vscode).
|
||||
|
||||
Here are the milestones we use and how we use them:
|
||||
|
||||
- "Backlog" -> Work not yet planned for a specific release.
|
||||
- "On Deck" -> Work under consideration for upcoming milestones.
|
||||
- "Backlog Candidates" -> Work that is not yet accepted for the backlog. We wait
|
||||
for the community to weigh in.
|
||||
- "<Month>" -> Work to be done for said month.
|
||||
|
||||
With this flow, any un-assigned issues are essentially in triage state. Once
|
||||
triaged, issues are either "Backlog" or "Backlog Candidates". They will
|
||||
eventually move to "On Deck" (or be closed). Lastly, they will end up on a
|
||||
version milestone where they will be worked on.
|
||||
|
||||
### Triage
|
||||
|
||||
We use the following process for triaging GitHub issues:
|
||||
|
||||
1. Create an issue
|
||||
1. Add appropriate labels to the issue (including "needs-investigation" if we
|
||||
should look into it further)
|
||||
1. Add the issue to a milestone
|
||||
1. If it should be fixed soon, add to version milestone or "On Deck"
|
||||
2. If not urgent, add to "Backlog"
|
||||
3. Otherwise, add to "Backlog Candidate" for future consideration
|
||||
|
||||
## Versioning
|
||||
|
||||
`<major.minor.patch>`
|
||||
|
||||
The code-server project follows traditional [semantic
|
||||
versioning](https://semver.org/), with the objective of minimizing major changes
|
||||
that break backward compatibility. We increment the patch level for all
|
||||
releases, except when the upstream Visual Studio Code project increments its
|
||||
minor version or we change the plugin API in a backward-compatible manner. In
|
||||
those cases, we increment the minor version rather than the patch level.
|
||||
|
||||
## Pull requests
|
||||
|
||||
Ideally, every PR should fix an issue. If it doesn't, make sure it's associated
|
||||
with a version milestone.
|
||||
|
||||
If a PR does fix an issue, don't add it to the version milestone. Otherwise, the
|
||||
version milestone will have duplicate information: the issue and the PR fixing
|
||||
the issue.
|
||||
|
||||
### Merge strategies
|
||||
|
||||
For most things, we recommend the **squash and merge** strategy. There
|
||||
may be times where **creating a merge commit** makes sense as well. Use your
|
||||
best judgment. If you're unsure, you can always discuss in the PR with the team.
|
||||
|
||||
### Changelog
|
||||
|
||||
To save time when creating a new release for code-server, we keep a running
|
||||
changelog at `CHANGELOG.md`.
|
||||
|
||||
If either the author or reviewer of a PR believes the change should be mentioned
|
||||
in the changelog, then it should be added.
|
||||
|
||||
If there is not a **Next Version** when you modify `CHANGELOG.md`, please add it
|
||||
using the template you see near the top of the changelog.
|
||||
|
||||
When writing your changelog item, ask yourself:
|
||||
|
||||
1. How do these changes affect code-server users?
|
||||
2. What actions do they need to take (if any)?
|
||||
|
||||
If you need inspiration, we suggest looking at the [Emacs
|
||||
changelog](https://github.com/emacs-mirror/emacs/blob/master/etc/NEWS).
|
||||
|
||||
## Releases
|
||||
|
||||
### Publishing a release
|
||||
|
||||
1. Go to GitHub Actions > Draft release > Run workflow on the commit you want to
|
||||
1. Check that the changelog lists all the important changes.
|
||||
2. Make sure the changelog entry lists the current version of VS Code.
|
||||
3. Update the changelog with the release date.
|
||||
4. Go to GitHub Actions > Draft release > Run workflow on the commit you want to
|
||||
release. Make sure CI has finished the build workflow on that commit or this
|
||||
will fail.
|
||||
2. CI will automatically grab the build artifact on that commit, inject the
|
||||
version into the `package.json`, put together platform-specific packages, and
|
||||
upload those packages to a draft release.
|
||||
3. Summarize the major changes in the `CHANGELOG.md`.
|
||||
4. Copy the relevant changelog section to the release then publish it.
|
||||
5. CI will automatically publish the NPM package, Docker image, and update
|
||||
Homebrew using the published release assets.
|
||||
6. Bump the chart version in `Chart.yaml` and merge in the changelog updates.
|
||||
will fail. For the version we match VS Code's minor and patch version. The
|
||||
patch number may become temporarily out of sync if we need to put out a
|
||||
patch, but if we make our own minor change then we will not release it until
|
||||
the next minor VS Code release.
|
||||
5. CI will automatically grab the build artifact on that commit (which is why CI
|
||||
has to have completed), inject the provided version into the `package.json`,
|
||||
put together platform-specific packages, and upload those packages to a draft
|
||||
release.
|
||||
6. Update the resulting draft release with the changelog contents.
|
||||
7. Publish the draft release after validating it.
|
||||
8. Bump the Helm chart version once the Docker images have published.
|
||||
|
||||
#### Release Candidates
|
||||
|
||||
|
@ -186,37 +74,44 @@ This is currently automated with the release process (but may fail occasionally)
|
|||
brew bump-formula-pr --version="${VERSION}" code-server --no-browse --no-audit
|
||||
```
|
||||
|
||||
#### nixpkgs
|
||||
|
||||
We publish code-server in nixpkgs but it must be updated manually.
|
||||
|
||||
#### npm
|
||||
|
||||
We publish code-server as a npm package [here](https://www.npmjs.com/package/code-server/v/latest).
|
||||
|
||||
This is currently automated with the release process.
|
||||
|
||||
## Syncing with upstream Code
|
||||
|
||||
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.
|
||||
|
||||
## Testing
|
||||
|
||||
Our testing structure is laid out under our [Contributing docs](https://coder.com/docs/code-server/latest/CONTRIBUTING#test).
|
||||
|
||||
We hope to eventually hit 100% test coverage with our unit tests, and maybe one day our scripts (coverage not tracked currently).
|
||||
|
||||
If you're ever looking to add more tests, here are a few ways to get started:
|
||||
|
||||
- run `yarn test:unit` and look at the coverage chart. You'll see all the uncovered lines. This is a good place to start.
|
||||
- look at `test/scripts` to see which scripts are tested. We can always use more tests there.
|
||||
- run `yarn test:unit` and look at the coverage chart. You'll see all the
|
||||
uncovered lines. This is a good place to start.
|
||||
- look at `test/scripts` to see which scripts are tested. We can always use more
|
||||
tests there.
|
||||
- look at `test/e2e`. We can always use more end-to-end tests.
|
||||
|
||||
Otherwise, talk to a current maintainer and ask which part of the codebase is lacking most when it comes to tests.
|
||||
Otherwise, talk to a current maintainer and ask which part of the codebase is
|
||||
lacking most when it comes to tests.
|
||||
|
||||
## Documentation
|
||||
|
||||
### Troubleshooting
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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:
|
||||
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:
|
||||
|
||||
1. Go to https://vercel.com/codercom/codercom
|
||||
2. Click "View Function Logs"
|
||||
|
|
Loading…
Reference in New Issue