Skip to content

Commit d005ee1

Browse files
Merge pull request #8 from Infinitode/arena/d9aff8eb-deepdefend
fix: restore PyPI token publish and limit non-main CI
2 parents 392f646 + 506d115 commit d005ee1

5 files changed

Lines changed: 22 additions & 11 deletions

File tree

‎.github/workflows/build_and_publish.yml‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
tags:
66
- "v*"
77

8-
# Least privilege at the workflow level; the publish job widens `id-token` only.
8+
# Least privilege at the workflow level.
99
permissions:
1010
contents: read
1111

@@ -54,12 +54,18 @@ jobs:
5454
environment:
5555
name: pypi
5656
url: https://pypi.org/project/deepdefend/
57-
permissions:
58-
# Trusted Publishing (OIDC). No long-lived API token is stored.
59-
id-token: write
6057
steps:
6158
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
6259
with:
6360
name: dist
6461
path: dist/
62+
# Trusted Publishing (OIDC) is not registered for this project on PyPI,
63+
# so uploads use the existing PYPI_API_TOKEN secret (as 0.1.x releases did).
64+
# Attestations require OIDC, so they stay off.
6565
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
66+
with:
67+
user: __token__
68+
password: ${{ secrets.PYPI_API_TOKEN }}
69+
packages-dir: dist
70+
skip-existing: true
71+
attestations: false

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches: [master, main]
66
pull_request:
7+
branches: [master, main]
78
workflow_dispatch:
89

910
permissions:
@@ -35,7 +36,9 @@ jobs:
3536
strategy:
3637
fail-fast: false
3738
matrix:
38-
python-version: ["3.10", "3.11", "3.12"]
39+
# Full interpreter matrix only on master/main. PRs and other refs
40+
# run 3.12 so each branch does not spawn three test jobs.
41+
python-version: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && fromJSON('["3.10", "3.11", "3.12"]') || fromJSON('["3.12"]') }}
3942
steps:
4043
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4144
with:
@@ -55,6 +58,8 @@ jobs:
5558
name: Build distribution
5659
runs-on: ubuntu-latest
5760
needs: [lint, test]
61+
# Packaging is verified on the default branches; PRs already lint and test.
62+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
5863
steps:
5964
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
6065
with:

‎CHANGELOG.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ attacks and defenses changes, the minor version was bumped.
112112
probe directions, `delta=epsilon/5`.
113113
- `median_smoothing` is documented as an alias of `spatial_smoothing`.
114114
- The publish workflow uses SHA-pinned actions, a tag/version consistency check,
115-
a test gate, `python -m build`, `twine check`, PyPI Trusted Publishing (OIDC)
116-
and a protected `pypi` environment.
115+
a test gate, `python -m build`, `twine check`, the `PYPI_API_TOKEN` secret and
116+
a `pypi` environment. CI runs the full Python matrix only on `master`/`main`.
117117

118118
### Removed
119119

‎CONTRIBUTING.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ Thank you for considering contributing to **DeepDefend**! Contributions, whether
2222
ruff check . # lint
2323
```
2424

25-
Both run in CI on every pull request (Python 3.10 – 3.12). New behaviour
26-
should come with a test; bug fixes should come with a test that fails
27-
before the fix.
25+
Pull requests run lint and the Python 3.12 test job. The full 3.10 – 3.12
26+
matrix runs on `master`/`main`. New behaviour should come with a test; bug
27+
fixes should come with a test that fails before the fix.
2828

2929
> [!TIP]
3030
> The test-suite uses a tiny synthetic dataset and a small CNN, so the whole

‎readme.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ either crashed on every call or returned silently wrong results. See
3434
- Fixed `randomized_smoothing`, `pixel_deflection` and the text helpers being non-reproducible and destroying whitespace/newlines.
3535
- Fixed silent `NaN`s from invalid parameters such as `bit_depth=0` or `num_bins=0`.
3636
- Fixed `pip install .` from a checkout, which failed because the version was a placeholder.
37-
- Fixed the release pipeline: SHA-pinned actions, a tag/version check, a test gate, and PyPI Trusted Publishing instead of a long-lived API token.
37+
- Fixed the release pipeline: SHA-pinned actions, a tag/version check, a test gate, and PyPI upload via `PYPI_API_TOKEN`.
3838

3939
**Added** — `deepdefend.__version__`, lazy imports, `smooth_predict()` with a
4040
certified-radius estimate, a 170-test suite, CI, `SECURITY.md`,

0 commit comments

Comments
 (0)