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.
just
On success, a publisher
executable will exist in the ./bin
directory.
Invoke the following Just command to run the built executable.
just run
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 test
Coverage reporting is captured by the cover standard library. To capture coverage, run the following Just command:
just cover
Once complete, a coverage report will open in your default browser.
The Bats framework is used to perform integration tests. For this project we use Bats to assert integrations with native machines via the Bash shell.
just bats
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.json
orposit-publishing-record-schema-v3.json
for the Configuration or Deployment schemas, respectively) - Update the corresponding example file (
config.toml
orrecord.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
$schema
field in your TOML files. - Verify that the unit tests pass. They load the example files and validate them against the schemas.
- The
draft
folder 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.
As Pull Requests are merged into main, we update (or create in the case of a new schema) the file on the CDN (in S3). Currently, this is a manual process:
- Log into the AWS console (https://rstudio.awsapps.com/start/#/)
- Select
Posit Connect Production
, thenPower User
. - Select
View all services
, thenS3
. - Open the
Posit Publisher
bucket, then thepublisher
folder. - Click
Upload
, thenAdd Folder
. - Select your local
schemas
folder (internal/schema/schemas
). - Click the
Upload
button to complete the upload. - Verify availability of the updated schema(s) on the CDN. There may be a delay due to caching.
The Posit Publisher VSCode extension releases follow guidelines from the VSCode Publishing Extensions docs.
SemVer versioning is used , but the
VSCode Marketplace will only support 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.
- Ensure that all relevant changes are documented in:
- the CHANGELOG.md for the repository
- the VSCode Extension CHANGELOG.md that is bundled with the extension
- Update the Installation instructions in installation.md
for the new release, using the links to the
.vsix
files uploaded to the CDN. - Update the release / latest version string in the
install-publisher.bash
script.
- Update the license docs in case any new dependencies have been added, by running
just docs/licenses
and committing any changes.
Step 1
Create a proper SemVer and extension version compatible tag using the guidelines above.
Use an even minor version for releases, or an odd minor version for pre-releases.
For this example, we will use the tag v1.1.0
to create a pre-release. This
tag already exists, so you will not be able run the following commands
verbatim.
git tag v1.1.0
Step 2
Push the tag GitHub.
git push origin v1.1.0
This command will trigger the Release GitHub Action.
Step 3
Once complete the action has completed, the release will be available on the Releases page, and published to the VSCode Marketplace.
After a release has gone out we take the opportunity to update dependencies.
Dependencies can be 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.