socketdev 3.3.0__tar.gz → 3.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/workflows/dependency-review.yml +3 -3
- socketdev-3.5.0/.github/workflows/package-check.yml +58 -0
- socketdev-3.5.0/.github/workflows/pr-preview.yml +198 -0
- socketdev-3.5.0/.github/workflows/release.yml +88 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/workflows/version-check.yml +1 -1
- {socketdev-3.3.0 → socketdev-3.5.0}/.hooks/sync_version.py +31 -0
- socketdev-3.5.0/CHANGELOG.md +487 -0
- socketdev-3.5.0/CONTRIBUTING.md +49 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/PKG-INFO +3 -3
- {socketdev-3.3.0 → socketdev-3.5.0}/pyproject.toml +6 -4
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/core/dedupe.py +12 -9
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/diffscans/__init__.py +38 -4
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/exceptions.py +28 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/fullscans/__init__.py +64 -5
- socketdev-3.5.0/socketdev/purl/__init__.py +176 -0
- socketdev-3.5.0/socketdev/version.py +1 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_all_endpoints_unit.py +239 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_exceptions.py +6 -0
- socketdev-3.5.0/tests/unit/test_socket_purl_type.py +141 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/uv.lock +26 -27
- socketdev-3.3.0/.github/workflows/pr-preview.yml +0 -141
- socketdev-3.3.0/.github/workflows/release.yml +0 -74
- socketdev-3.3.0/socketdev/purl/__init__.py +0 -55
- socketdev-3.3.0/socketdev/version.py +0 -1
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/CODEOWNERS +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/actions/setup-hatch/action.yml +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/actions/setup-sfw/action.yml +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.github/dependabot.yml +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.gitignore +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/.python-version +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/LICENSE +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/README.rst +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/scripts/build.sh +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/scripts/deploy-test-pypi.sh +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/alertfullscansearch/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/alerts/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/alerttypes/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/analytics/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/apitokens/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/auditlog/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/basics/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/core/api.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/core/classes.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/core/issues.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/dependencies/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/export/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/fixes/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/historical/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/labels/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/licensemetadata/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/log.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/npm/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/openapi/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/org/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/quota/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/report/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/repos/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/repositories/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/sbom/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/settings/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/supportedfiles/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/telemetry/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/threatfeed/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/tools/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/triage/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/uploadmanifests/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/utils/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/socketdev/webhooks/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/README.md +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/conftest.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/integration/test_all_endpoints.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/integration/test_comprehensive_integration.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/integration/test_diffscans_integration.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/integration/test_new_endpoints.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/run_tests.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/__init__.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_dedupe.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_issues_did_you_mean_props.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_socket_alert_category.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_socket_sdk_unit.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_upload_manifests.py +0 -0
- {socketdev-3.3.0 → socketdev-3.5.0}/tests/unit/test_working_endpoints_unit.py +0 -0
|
@@ -40,7 +40,7 @@ jobs:
|
|
|
40
40
|
workflow_or_action_changed: ${{ steps.diff.outputs.workflow_or_action_changed }}
|
|
41
41
|
is_trusted: ${{ steps.trust.outputs.is_trusted }}
|
|
42
42
|
steps:
|
|
43
|
-
- uses: actions/checkout@
|
|
43
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
44
44
|
with:
|
|
45
45
|
fetch-depth: 0
|
|
46
46
|
persist-credentials: false
|
|
@@ -124,7 +124,7 @@ jobs:
|
|
|
124
124
|
runs-on: ubuntu-latest
|
|
125
125
|
timeout-minutes: 15
|
|
126
126
|
steps:
|
|
127
|
-
- uses: actions/checkout@
|
|
127
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
128
128
|
with:
|
|
129
129
|
fetch-depth: 1
|
|
130
130
|
persist-credentials: false
|
|
@@ -197,7 +197,7 @@ jobs:
|
|
|
197
197
|
timeout-minutes: 15
|
|
198
198
|
environment: socket-firewall
|
|
199
199
|
steps:
|
|
200
|
-
- uses: actions/checkout@
|
|
200
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
201
201
|
with:
|
|
202
202
|
fetch-depth: 1
|
|
203
203
|
persist-credentials: false
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
name: Package Check
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
concurrency:
|
|
13
|
+
group: package-check-${{ github.event.pull_request.number || github.ref }}
|
|
14
|
+
cancel-in-progress: true
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
package-check:
|
|
18
|
+
runs-on: ubuntu-latest
|
|
19
|
+
timeout-minutes: 10
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
|
+
with:
|
|
23
|
+
fetch-depth: 1
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
|
|
26
|
+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
|
|
30
|
+
- name: Install build tooling
|
|
31
|
+
uses: ./.github/actions/setup-hatch
|
|
32
|
+
|
|
33
|
+
- name: Install test and distribution tooling
|
|
34
|
+
run: python -m pip install ".[test]" "twine>=4.0.0"
|
|
35
|
+
|
|
36
|
+
- name: Run unit tests
|
|
37
|
+
run: python -m pytest -q tests/unit
|
|
38
|
+
|
|
39
|
+
- name: Build distributions
|
|
40
|
+
run: hatch build
|
|
41
|
+
|
|
42
|
+
- name: Validate distributions
|
|
43
|
+
run: python -m twine check dist/*
|
|
44
|
+
|
|
45
|
+
- name: Install and smoke-test wheel
|
|
46
|
+
run: |
|
|
47
|
+
python -m venv "$RUNNER_TEMP/package-check"
|
|
48
|
+
"$RUNNER_TEMP/package-check/bin/pip" install --upgrade pip
|
|
49
|
+
"$RUNNER_TEMP/package-check/bin/pip" install dist/*.whl
|
|
50
|
+
"$RUNNER_TEMP/package-check/bin/python" -c "import socketdev; from socketdev.version import __version__; print('wheel smoke OK', __version__)"
|
|
51
|
+
|
|
52
|
+
- name: Upload distributions
|
|
53
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
54
|
+
with:
|
|
55
|
+
name: socketdev-${{ github.sha }}
|
|
56
|
+
path: dist/*
|
|
57
|
+
if-no-files-found: error
|
|
58
|
+
retention-days: 14
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
name: Publish PR Preview
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [labeled]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
pr_number:
|
|
9
|
+
description: Pull request number to publish
|
|
10
|
+
required: true
|
|
11
|
+
type: string
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: publish-pr-preview-${{ github.event.pull_request.number || github.run_id }}
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
context:
|
|
19
|
+
if: >-
|
|
20
|
+
github.event_name == 'workflow_dispatch' ||
|
|
21
|
+
(github.event.label.name == 'publish-preview' &&
|
|
22
|
+
github.event.pull_request.head.repo.full_name == github.repository)
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
timeout-minutes: 5
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
pull-requests: read
|
|
28
|
+
outputs:
|
|
29
|
+
pr_number: ${{ steps.context.outputs.pr_number }}
|
|
30
|
+
head_sha: ${{ steps.context.outputs.head_sha }}
|
|
31
|
+
steps:
|
|
32
|
+
- name: Validate pull request context
|
|
33
|
+
id: context
|
|
34
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
35
|
+
env:
|
|
36
|
+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
37
|
+
EVENT_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
38
|
+
INPUT_PR_NUMBER: ${{ inputs.pr_number }}
|
|
39
|
+
WORKFLOW_REF: ${{ github.ref }}
|
|
40
|
+
with:
|
|
41
|
+
script: |
|
|
42
|
+
const rawPrNumber = context.eventName === 'workflow_dispatch'
|
|
43
|
+
? process.env.INPUT_PR_NUMBER
|
|
44
|
+
: process.env.EVENT_PR_NUMBER;
|
|
45
|
+
if (!/^[1-9][0-9]*$/.test(rawPrNumber || '')) {
|
|
46
|
+
core.setFailed('Pull request number must contain ASCII digits only.');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (context.eventName === 'workflow_dispatch') {
|
|
51
|
+
const defaultRef = `refs/heads/${process.env.DEFAULT_BRANCH}`;
|
|
52
|
+
if (process.env.WORKFLOW_REF !== defaultRef) {
|
|
53
|
+
core.setFailed(`Run manual previews from ${defaultRef}.`);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const prNumber = Number(rawPrNumber);
|
|
59
|
+
if (!Number.isSafeInteger(prNumber)) {
|
|
60
|
+
core.setFailed('Pull request number is outside the supported range.');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
const {data: pullRequest} = await github.rest.pulls.get({
|
|
64
|
+
owner: context.repo.owner,
|
|
65
|
+
repo: context.repo.repo,
|
|
66
|
+
pull_number: prNumber,
|
|
67
|
+
});
|
|
68
|
+
if (pullRequest.state !== 'open') {
|
|
69
|
+
core.setFailed(`Pull request #${prNumber} is not open.`);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (pullRequest.head.repo?.full_name !== `${context.repo.owner}/${context.repo.repo}`) {
|
|
73
|
+
core.setFailed('Preview publication is limited to branches in this repository.');
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
core.setOutput('pr_number', String(prNumber));
|
|
78
|
+
core.setOutput('head_sha', pullRequest.head.sha);
|
|
79
|
+
|
|
80
|
+
build:
|
|
81
|
+
needs: context
|
|
82
|
+
runs-on: ubuntu-latest
|
|
83
|
+
timeout-minutes: 10
|
|
84
|
+
permissions:
|
|
85
|
+
contents: read
|
|
86
|
+
outputs:
|
|
87
|
+
preview_version: ${{ steps.version.outputs.preview_version }}
|
|
88
|
+
steps:
|
|
89
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
90
|
+
with:
|
|
91
|
+
ref: ${{ needs.context.outputs.head_sha }}
|
|
92
|
+
fetch-depth: 0
|
|
93
|
+
persist-credentials: false
|
|
94
|
+
|
|
95
|
+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
96
|
+
with:
|
|
97
|
+
python-version: "3.12"
|
|
98
|
+
|
|
99
|
+
- name: Install build tooling
|
|
100
|
+
uses: ./.github/actions/setup-hatch
|
|
101
|
+
|
|
102
|
+
- name: Install distribution validator
|
|
103
|
+
run: python -m pip install "twine>=4.0.0"
|
|
104
|
+
|
|
105
|
+
- name: Inject deterministic preview version
|
|
106
|
+
env:
|
|
107
|
+
PREVIEW_ID: ${{ github.run_id }}
|
|
108
|
+
RUN_ATTEMPT: ${{ github.run_attempt }}
|
|
109
|
+
run: |
|
|
110
|
+
PREVIEW_ID=$((PREVIEW_ID * 100 + RUN_ATTEMPT))
|
|
111
|
+
python .hooks/sync_version.py --dev --preview-id "$PREVIEW_ID" --skip-lock
|
|
112
|
+
|
|
113
|
+
- name: Read preview version
|
|
114
|
+
id: version
|
|
115
|
+
run: echo "preview_version=$(hatch version)" >> "$GITHUB_OUTPUT"
|
|
116
|
+
|
|
117
|
+
- name: Build and validate distributions
|
|
118
|
+
run: |
|
|
119
|
+
hatch build
|
|
120
|
+
python -m twine check dist/*
|
|
121
|
+
|
|
122
|
+
- name: Install and smoke-test wheel locally
|
|
123
|
+
run: |
|
|
124
|
+
python -m venv "$RUNNER_TEMP/preview-check"
|
|
125
|
+
"$RUNNER_TEMP/preview-check/bin/pip" install --upgrade pip
|
|
126
|
+
"$RUNNER_TEMP/preview-check/bin/pip" install dist/*.whl
|
|
127
|
+
"$RUNNER_TEMP/preview-check/bin/python" -c "import socketdev; from socketdev.version import __version__; print('preview wheel smoke OK', __version__)"
|
|
128
|
+
|
|
129
|
+
- name: Upload preview distributions
|
|
130
|
+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
131
|
+
with:
|
|
132
|
+
name: socketdev-preview-${{ github.run_id }}-${{ github.run_attempt }}
|
|
133
|
+
path: dist/*
|
|
134
|
+
if-no-files-found: error
|
|
135
|
+
retention-days: 14
|
|
136
|
+
|
|
137
|
+
publish:
|
|
138
|
+
needs: [context, build]
|
|
139
|
+
runs-on: ubuntu-latest
|
|
140
|
+
timeout-minutes: 10
|
|
141
|
+
permissions:
|
|
142
|
+
contents: read
|
|
143
|
+
id-token: write
|
|
144
|
+
pull-requests: write
|
|
145
|
+
steps:
|
|
146
|
+
- name: Download preview distributions
|
|
147
|
+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
148
|
+
with:
|
|
149
|
+
name: socketdev-preview-${{ github.run_id }}-${{ github.run_attempt }}
|
|
150
|
+
path: dist
|
|
151
|
+
|
|
152
|
+
- name: Publish to TestPyPI
|
|
153
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
154
|
+
with:
|
|
155
|
+
repository-url: https://test.pypi.org/legacy/
|
|
156
|
+
verbose: true
|
|
157
|
+
|
|
158
|
+
- name: Comment on pull request
|
|
159
|
+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
160
|
+
env:
|
|
161
|
+
PREVIEW_VERSION: ${{ needs.build.outputs.preview_version }}
|
|
162
|
+
PR_NUMBER: ${{ needs.context.outputs.pr_number }}
|
|
163
|
+
with:
|
|
164
|
+
script: |
|
|
165
|
+
const marker = '<!-- socketdev-pr-preview -->';
|
|
166
|
+
const prNumber = Number(process.env.PR_NUMBER);
|
|
167
|
+
const version = process.env.PREVIEW_VERSION;
|
|
168
|
+
const body = `${marker}
|
|
169
|
+
🚀 SDK preview published: \`socketdev==${version}\`
|
|
170
|
+
|
|
171
|
+
\`\`\`bash
|
|
172
|
+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketdev==${version}
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
TestPyPI's package index can take several minutes to expose a newly uploaded version.`;
|
|
176
|
+
const {data: comments} = await github.rest.issues.listComments({
|
|
177
|
+
owner: context.repo.owner,
|
|
178
|
+
repo: context.repo.repo,
|
|
179
|
+
issue_number: prNumber,
|
|
180
|
+
});
|
|
181
|
+
const existing = comments.find(comment =>
|
|
182
|
+
comment.user.type === 'Bot' && comment.body.includes(marker)
|
|
183
|
+
);
|
|
184
|
+
if (existing) {
|
|
185
|
+
await github.rest.issues.updateComment({
|
|
186
|
+
owner: context.repo.owner,
|
|
187
|
+
repo: context.repo.repo,
|
|
188
|
+
comment_id: existing.id,
|
|
189
|
+
body,
|
|
190
|
+
});
|
|
191
|
+
} else {
|
|
192
|
+
await github.rest.issues.createComment({
|
|
193
|
+
owner: context.repo.owner,
|
|
194
|
+
repo: context.repo.repo,
|
|
195
|
+
issue_number: prNumber,
|
|
196
|
+
body,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
|
|
6
|
+
jobs:
|
|
7
|
+
release:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
id-token: write
|
|
11
|
+
contents: read
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
14
|
+
with:
|
|
15
|
+
fetch-depth: 0
|
|
16
|
+
persist-credentials: false
|
|
17
|
+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
18
|
+
with:
|
|
19
|
+
python-version: '3.13'
|
|
20
|
+
|
|
21
|
+
- name: Install build tooling
|
|
22
|
+
uses: ./.github/actions/setup-hatch
|
|
23
|
+
|
|
24
|
+
- name: Get Version
|
|
25
|
+
id: version
|
|
26
|
+
env:
|
|
27
|
+
REF_NAME: ${{ github.ref_name }}
|
|
28
|
+
run: |
|
|
29
|
+
RAW_VERSION=$(hatch version)
|
|
30
|
+
echo "VERSION=$RAW_VERSION" >> "$GITHUB_ENV"
|
|
31
|
+
if [ "v$RAW_VERSION" != "$REF_NAME" ]; then
|
|
32
|
+
echo "Error: Git tag ($REF_NAME) does not match hatch version (v$RAW_VERSION)"
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
|
|
36
|
+
- name: Check if version exists on PyPI
|
|
37
|
+
id: version_check
|
|
38
|
+
env:
|
|
39
|
+
VERSION: ${{ env.VERSION }}
|
|
40
|
+
run: |
|
|
41
|
+
if curl -s -f "https://pypi.org/pypi/socketdev/$VERSION/json" > /dev/null; then
|
|
42
|
+
echo "Version ${VERSION} already exists on PyPI"
|
|
43
|
+
echo "pypi_exists=true" >> "$GITHUB_OUTPUT"
|
|
44
|
+
else
|
|
45
|
+
echo "Version ${VERSION} not found on PyPI - proceeding with PyPI deployment"
|
|
46
|
+
echo "pypi_exists=false" >> "$GITHUB_OUTPUT"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
- name: Build package
|
|
50
|
+
if: steps.version_check.outputs.pypi_exists != 'true'
|
|
51
|
+
run: |
|
|
52
|
+
hatch build
|
|
53
|
+
|
|
54
|
+
- name: Publish to PyPI
|
|
55
|
+
if: steps.version_check.outputs.pypi_exists != 'true'
|
|
56
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
57
|
+
|
|
58
|
+
- name: Verify package is installable
|
|
59
|
+
id: verify_package
|
|
60
|
+
env:
|
|
61
|
+
VERSION: ${{ env.VERSION }}
|
|
62
|
+
run: |
|
|
63
|
+
# The first lookup can race PyPI's Simple-index propagation, and a delayed
|
|
64
|
+
# CDN purge can leave the index stale well after a successful upload.
|
|
65
|
+
# pip caches HTTP responses by default, so without --no-cache-dir every
|
|
66
|
+
# retry can reuse that initial stale response instead of checking whether
|
|
67
|
+
# the release has appeared. Budget: 30 minutes.
|
|
68
|
+
MAX_ATTEMPTS=60
|
|
69
|
+
for i in $(seq 1 "$MAX_ATTEMPTS"); do
|
|
70
|
+
if python -m pip install \
|
|
71
|
+
--no-cache-dir \
|
|
72
|
+
--index-url https://pypi.org/simple/ \
|
|
73
|
+
"socketdev==${VERSION}"; then
|
|
74
|
+
echo "Package ${VERSION} is now available and installable on PyPI"
|
|
75
|
+
python -m pip uninstall -y socketdev
|
|
76
|
+
echo "success=true" >> "$GITHUB_OUTPUT"
|
|
77
|
+
exit 0
|
|
78
|
+
fi
|
|
79
|
+
if curl -s -f "https://pypi.org/pypi/socketdev/${VERSION}/json" > /dev/null; then
|
|
80
|
+
echo "Release ${VERSION} exists on PyPI (JSON API) but is not in the Simple index yet - CDN propagation delay"
|
|
81
|
+
fi
|
|
82
|
+
if [ "$i" -lt "$MAX_ATTEMPTS" ]; then
|
|
83
|
+
echo "Attempt $i: Package not yet installable, waiting 30s... (${i}/${MAX_ATTEMPTS})"
|
|
84
|
+
sleep 30
|
|
85
|
+
fi
|
|
86
|
+
done
|
|
87
|
+
echo "success=false" >> "$GITHUB_OUTPUT"
|
|
88
|
+
exit 1
|
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
if: github.event.pull_request.user.login != 'dependabot[bot]'
|
|
21
21
|
runs-on: ubuntu-latest
|
|
22
22
|
steps:
|
|
23
|
-
- uses: actions/checkout@
|
|
23
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
24
24
|
with:
|
|
25
25
|
fetch-depth: 0 # Fetch all history for all branches
|
|
26
26
|
persist-credentials: false
|
|
@@ -124,13 +124,44 @@ def run_uv_lock() -> bool:
|
|
|
124
124
|
return before != after
|
|
125
125
|
|
|
126
126
|
|
|
127
|
+
def read_preview_id():
|
|
128
|
+
if "--preview-id" not in sys.argv:
|
|
129
|
+
return None
|
|
130
|
+
|
|
131
|
+
option_index = sys.argv.index("--preview-id")
|
|
132
|
+
try:
|
|
133
|
+
preview_id = sys.argv[option_index + 1]
|
|
134
|
+
except IndexError:
|
|
135
|
+
print("❌ `--preview-id` requires a numeric value.")
|
|
136
|
+
sys.exit(1)
|
|
137
|
+
|
|
138
|
+
if not preview_id.isascii() or not preview_id.isdigit():
|
|
139
|
+
print("❌ `--preview-id` must contain ASCII digits only.")
|
|
140
|
+
sys.exit(1)
|
|
141
|
+
return preview_id
|
|
142
|
+
|
|
143
|
+
|
|
127
144
|
def main():
|
|
128
145
|
dev_mode = "--dev" in sys.argv
|
|
146
|
+
skip_lock = "--skip-lock" in sys.argv
|
|
147
|
+
preview_id = read_preview_id()
|
|
129
148
|
current_version = read_version_from_version_file(VERSION_FILE)
|
|
130
149
|
previous_version = read_version_from_git("socketdev/version.py")
|
|
131
150
|
|
|
132
151
|
print(f"Current: {current_version}, Previous: {previous_version}")
|
|
133
152
|
|
|
153
|
+
if preview_id is not None:
|
|
154
|
+
if not dev_mode:
|
|
155
|
+
print("❌ `--preview-id` can only be used with `--dev`.")
|
|
156
|
+
sys.exit(1)
|
|
157
|
+
base_version = current_version.split(".dev")[0]
|
|
158
|
+
new_version = f"{base_version}.dev{preview_id}"
|
|
159
|
+
inject_version(new_version)
|
|
160
|
+
if not skip_lock:
|
|
161
|
+
run_uv_lock()
|
|
162
|
+
print(f"✅ Prepared deterministic preview version {new_version}.")
|
|
163
|
+
sys.exit(0)
|
|
164
|
+
|
|
134
165
|
if current_version == previous_version:
|
|
135
166
|
if dev_mode:
|
|
136
167
|
base_version = current_version.split(".dev")[0] if ".dev" in current_version else current_version
|