Skip to content

Commit 73504a6

Browse files
committed
Document contributing and preview workflows
1 parent 714de44 commit 73504a6

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributing
2+
3+
## Development setup
4+
5+
Use Python 3.11 or newer and install
6+
[`uv`](https://docs.astral.sh/uv/getting-started/installation/). From the
7+
repository root, create the environment and install all development
8+
dependencies:
9+
10+
```bash
11+
uv sync --all-extras
12+
```
13+
14+
Before opening a pull request, run:
15+
16+
```bash
17+
make test
18+
make lint
19+
uv run hatch build
20+
uv run python -m twine check dist/*
21+
```
22+
23+
To develop against a local SDK checkout, set `SOCKET_SDK_PATH` if it is not at
24+
`../socketdev`, then run `make first-time-local-setup`.
25+
26+
## Pull request validation
27+
28+
The `Package Check` workflow runs automatically for pull requests. It builds
29+
and validates the distributions, smoke-tests the wheel, and uploads the
30+
distributions as workflow artifacts. It does not publish a package or Docker
31+
image.
32+
33+
## Publishing pull request previews
34+
35+
Preview publication is intentionally opt-in. Only request previews for code
36+
that is trusted to run with the repository's publishing permissions.
37+
38+
For a pull request from this repository, apply the label for the artifact that
39+
needs testing:
40+
41+
- `publish-preview` publishes a uniquely versioned `socketsecurity` prerelease
42+
to TestPyPI and adds or updates a pull request comment with the exact version
43+
and installation command.
44+
- `publish-docker-preview` publishes the mutable
45+
`socketdev/cli:pr-<pull-request-number>` image to Docker Hub and adds or
46+
updates a pull request comment with the image tag.
47+
48+
Label-triggered publication is skipped for pull requests from forks. Each label
49+
is handled as a separate event, so applying both labels starts two workflow
50+
runs. Use manual dispatch instead when both artifacts should be published in a
51+
single run.
52+
53+
The workflow reacts when a label is added; pushing another commit while the
54+
label remains on the pull request does not publish a new preview. To publish the
55+
new pull request head or retry a failed publication, remove the relevant label
56+
and apply it again.
57+
58+
Maintainers can also open **Actions > Publish PR Preview > Run workflow**, enter
59+
the pull request number, and choose whether to publish to TestPyPI, Docker Hub,
60+
or both. When testing the CLI against an SDK preview, enter the exact TestPyPI
61+
`socketdev` prerelease in `sdk_preview_version`; publish the SDK preview first
62+
and allow time for TestPyPI to expose it before starting the CLI Docker preview.

0 commit comments

Comments
 (0)