- Contributing
These instructions will give you a copy of the project up and running on your local machine for development and testing purposes.
To get your development environment up and running, invoke the default Just command.
justThis installs dependencies, builds and packages the Go binary and the VS Code extension.
See the Posit Publisher VS Code Extension CONTRIBUTING guide next for setting up your development workflow.
The repo utilizes git hooks (through husky) to implement some standard formatting and linting.
The tools invoked are expected to be installed as packages within the root of the repo, as well as within the subdirectory test/e2e.
To commit one or more files, you must have first installed the npm package dependencies within both locations. This can be done from the root of the repo by:
npm install
npm install --prefix="test/e2e"This project follows the guidance written by Ham Vocke in the The Practical Test Pyramid. Please read the article for a detailed overview of different test types and how they are utilized.
Unit tests are written in Go and utilize the Testify framework for assertions and mocking.
just testCoverage reporting is captured by the cover standard library. To capture coverage, run the following Just command:
just coverOnce complete, a coverage report will open in your default browser.
End-to-end tests use Cypress to test the Publisher extension in a real VS Code environment with a Posit Connect server. Tests run automatically in GitHub Actions CI after unit tests pass.
See the E2E Testing Guide for setup and usage instructions.
The build tooling entrypoint is just. See the installation instructions for your operating system to install Just.
Execute just -l for a list of available commands and documentation.
When executing commands the following variables are accepted to change behavior.
| Variable | Default | Type | Description |
|---|---|---|---|
| CI | false | bool | Enable CI mode. When set to true, multi-platform builds are enabled. |
| DEBUG | false | bool | Enable DEBUG mode. When set to true, set +x is enabled for all Justfile targets. |
| MODE | dev | enum | When set to dev, development is enabled. All other values disable development mode. |
When running in GitHub Actions, the env variable CI is set to true by GitHub. When CI=true, the defaults for the following values are adjusted.
This mode can be reproduced on your local machine by setting CI=true.
| Variable | Default |
|---|---|
| MODE | prod |
A launch.json can be found at the root in the .vscode directory for
debugging the Go API code.
The "Launch API" configuration will start the API at port 9001.
To change the directory that the API is started in, update the cwd property
to the directory you want the API to be launched at.
When debugging alongside the
VS Code Extension the cwd
will frequently be the workspace folder of the extension host development
window.
See the Contribution Guide for the VSCode Extension.
Schemas can be found in the internal/schema/schemas directory.
Non-breaking or additive changes to the schema do not require a version bump. Breaking changes to the schema require a version bump.
To update the schema:
- Update the jsonschema file (
posit-publishing-schema-v3.jsonorposit-publishing-record-schema-v3.jsonfor the Configuration or Deployment schemas, respectively) - Update the corresponding example file (
config.tomlorrecord.toml). - If you're using VSCode with the Even Better TOML extension, you can use the in-editor validation by putting the full local path to your updated schema in the
$schemafield in your TOML files. - Verify that the unit tests pass. They load the example files and validate them against the schemas.
- The
draftfolder contains schemas that are a superset of the main schemas, and have ideas for the other settings we have considered adding. Usually we have added any new fields to those schemas and example files as well.
When Pull Requests that modify schema files are merged into main, a GitHub Actions workflow automatically uploads the updated schemas to S3, making them available on the CDN.
The Even Better TOML extension caches schemas. To force it to update remove the cached schemas from the extension's cache directory.
On macOS this can be done with the following command, replacing $USERNAME with
your username:
rm /Users/$USERNAME/Library/Application\ Support/Code/User/globalStorage/tamasfe.even-better-toml/*
The Posit Publisher VSCode extension releases follow guidelines from the VSCode Publishing Extensions docs.
SemVer versioning is used, but the
VSCode Marketplace only supports major.minor.patch for extension versions;
semver pre-release tags are not supported.
The recommendation is releases use major.EVEN_NUMBER.patch for release
versions and major.ODD_NUMBER.patch for pre-release versions.
CI facilitates this and will automatically publish as a pre-release if the minor version number is odd.
- Merge any "Update licenses" PRs to
main - Merge any Dependabot PRs to
main - Wait for the
main.yamlworkflows to complete
The release process is automated via GitHub Actions workflows.
- Go to Actions > Prepare Release
- Click "Run workflow"
- Enter the version number (e.g.,
1.34.0)- Must use even minor version for production releases
- Do not include the
vprefix
- Click "Run workflow"
This workflow will:
- Create a
release/v{version}branch - Run the prepare-release script to update changelog files
- Create a pull request for review
- Review the PR to verify changelog entries are complete and accurate
- Ensure all PRs with user-facing changes since the last release have changelog entries
- Merge the PR when ready
When the release PR is merged, automation takes over:
- The
tag-on-release-mergeworkflow automatically creates the version tag - The tag triggers the
releaseworkflow which:- Builds release artifacts for all platforms
- Creates a GitHub release
- Publishes to VS Code Marketplace and Open VSX
- Sends a Slack notification to announce the release
Once the workflows complete, verify:
- The release appears on the Releases page
- The new version shows up in Visual Studio Marketplace and Open VSX
- All expected target platforms are supported (Linux x64, Linux ARM64, Windows x64, macOS Intel, macOS Apple Silicon)
It may take some time after the workflows complete for the new version to appear in the marketplaces.
Dependencies can be updated through two approaches:
- Automated (Preferred): Via Dependabot PRs that are automatically created
- Manual: For cases where Dependabot cannot handle the update or special handling is needed
Dependabot is GitHub's automated dependency management tool that helps keep your project's dependencies up to date. It scans your repository for dependency files and automatically creates pull requests when newer versions of your dependencies are available.
Each PR includes release notes, changelog entries, and compatibility information to help you assess the impact of the update.
After review and approval, Dependabot PRs can be merged like regular code changes.
- Configuration is maintained in
.github/dependabot.yml - Multiple ecosystems are monitored:
- npm packages (root, VSCode extension, and test directories)
- Go modules
- Python dependencies
- Docker images
- GitHub Actions
- Test data dependencies
Dependencies can be manually adjusted at any time; the process of updating after a release keeps us proactive.
This includes our JavaScript packages, Go version/packages, and tooling dependencies.
Any significantly difficult dependency updates should have an issue created to track the work and can be triaged alongside our other issues.
Updates to dependencies should be done in a separate PR.
-
Run
go get <dependency>@<version>to update the dependency. This will update thego.modfile with the new version.go gethas a-uoption that will update all child dependencies as well. This is generally not recommended as it can cause unexpected problems. Use it with caution.go getwill do the right thing on its own without-u.- It is best to specify the version with the
@<version>suffix. This may be a semver string, a branch name, or a commit hash.
-
Update any import statements for the new version of the dependency.
-
Run
go mod vendorto update thevendordirectory with the new version of the dependency. -
Make sure all files under vendor are included in the git commit.