Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/build_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
tags:
- "v*"

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

Expand Down Expand Up @@ -54,12 +54,18 @@ jobs:
environment:
name: pypi
url: https://pypi.org/project/deepdefend/
permissions:
# Trusted Publishing (OIDC). No long-lived API token is stored.
id-token: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist/
# Trusted Publishing (OIDC) is not registered for this project on PyPI,
# so uploads use the existing PYPI_API_TOKEN secret (as 0.1.x releases did).
# Attestations require OIDC, so they stay off.
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist
skip-existing: true
attestations: false
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -35,7 +36,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
# Full interpreter matrix only on master/main. PRs and other refs
# run 3.12 so each branch does not spawn three test jobs.
python-version: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && fromJSON('["3.10", "3.11", "3.12"]') || fromJSON('["3.12"]') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand All @@ -55,6 +58,8 @@ jobs:
name: Build distribution
runs-on: ubuntu-latest
needs: [lint, test]
# Packaging is verified on the default branches; PRs already lint and test.
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ attacks and defenses changes, the minor version was bumped.
probe directions, `delta=epsilon/5`.
- `median_smoothing` is documented as an alias of `spatial_smoothing`.
- The publish workflow uses SHA-pinned actions, a tag/version consistency check,
a test gate, `python -m build`, `twine check`, PyPI Trusted Publishing (OIDC)
and a protected `pypi` environment.
a test gate, `python -m build`, `twine check`, the `PYPI_API_TOKEN` secret and
a `pypi` environment. CI runs the full Python matrix only on `master`/`main`.

### Removed

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Thank you for considering contributing to **DeepDefend**! Contributions, whether
ruff check . # lint
```

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

> [!TIP]
> The test-suite uses a tiny synthetic dataset and a small CNN, so the whole
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ either crashed on every call or returned silently wrong results. See
- Fixed `randomized_smoothing`, `pixel_deflection` and the text helpers being non-reproducible and destroying whitespace/newlines.
- Fixed silent `NaN`s from invalid parameters such as `bit_depth=0` or `num_bins=0`.
- Fixed `pip install .` from a checkout, which failed because the version was a placeholder.
- 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.
- Fixed the release pipeline: SHA-pinned actions, a tag/version check, a test gate, and PyPI upload via `PYPI_API_TOKEN`.

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