Skip to content

Commit c7d828f

Browse files
apply template
1 parent 1e989bb commit c7d828f

26 files changed

Lines changed: 1295 additions & 247 deletions

.cruft.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"template": "https://github.com/zacharyburnett/stsci-package-template",
3+
"commit": "d6b6a4304821a9cdbc462ffac106eac75087d513",
4+
"checkout": null,
5+
"context": {
6+
"cookiecutter": {
7+
"project_name": "stpipe",
8+
"package_name": "stpipe",
9+
"repository_url": "https://github.com/spacetelescope/stpipe",
10+
"project_description": "Provides base classes and command-line tools for implementing calibration pipeline software.",
11+
"manage_changelog_with_towncrier": true,
12+
"publish_docs_to": "readthedocs.io",
13+
"task_runner": "tox",
14+
"python_version": ">=3.10",
15+
"python_c_extensions": false,
16+
"python_build_backend": "setuptools",
17+
"crds_observatory": "none",
18+
"_template": "https://github.com/zacharyburnett/stsci-package-template",
19+
"_commit": "d6b6a4304821a9cdbc462ffac106eac75087d513"
20+
}
21+
},
22+
"directory": "python-package"
23+
}

.github/dependabot.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
version: 2
2-
updates:
32

4-
# Maintain dependencies for GitHub Actions
3+
updates:
54
- package-ecosystem: "github-actions"
6-
directory: "/"
5+
directory: ".github/workflows"
6+
labels:
7+
- no-changelog-entry-needed
78
target-branch: "main"
89
schedule:
9-
interval: "weekly"
10-
reviewers:
11-
- "zacharyburnett"
10+
interval: "monthly"
11+
cooldown:
12+
default-days: 7
13+
groups:
14+
actions:
15+
patterns:
16+
- "*"
1217

13-
# Maintain dependencies for pip
1418
- package-ecosystem: "pip"
1519
directory: "/"
20+
labels:
21+
- no-changelog-entry-needed
1622
target-branch: "main"
1723
schedule:
18-
interval: "weekly"
19-
reviewers:
20-
- "zacharyburnett"
24+
interval: "monthly"
25+
cooldown:
26+
default-days: 7
27+
groups:
28+
actions:
29+
patterns:
30+
- "*"

.github/labeler.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
breaking-change:
2+
- changed-files:
3+
- any-glob-to-any-file:
4+
- 'changes/*.breaking.rst'
5+
6+
feature:
7+
- changed-files:
8+
- any-glob-to-any-file:
9+
- 'changes/*.feature.rst'
10+
11+
fix:
12+
- changed-files:
13+
- any-glob-to-any-file:
14+
- 'changes/*.fix.rst'
15+
16+
documentation:
17+
- changed-files:
18+
- all-globs-to-any-file: ['*.rst', '!CHANGES.rst', '!changes/*']
19+
- any-glob-to-any-file:
20+
- 'docs/**/*'
21+
- '*.md'
22+
- '.readthedocs.yaml'
23+
- 'LICENSE'
24+
- 'changes/*.docs.rst'
25+
26+
packaging:
27+
- changed-files:
28+
- any-glob-to-any-file:
29+
- 'pyproject.toml'
30+
31+
# --------------------------------------- testing ---------------------------------------
32+
33+
automation:
34+
- changed-files:
35+
- any-glob-to-any-file:
36+
- '.github/**'
37+
38+
testing:
39+
- changed-files:
40+
- any-glob-to-any-file:
41+
- '**/tests/**'
42+
- '**/regtest/**'
43+
- '.github/workflows/test*.yml'
44+
- '**/conftest.py'

.github/pull_request_template.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1-
<!-- If this PR closes a JIRA ticket, make sure the title starts with the JIRA issue number,
2-
for example JP-1234: <Fix a bug> -->
3-
Resolves [JP-nnnn](https://jira.stsci.edu/browse/JP-nnnn)
4-
Resolves [RCAL-nnnn](https://jira.stsci.edu/browse/RCAL-nnnn)
1+
<!-- If this PR addresses a JIRA ticket: -->
2+
<!-- Resolves [JP-nnnn](https://jira.stsci.edu/browse/JP-nnnn) -->
53

6-
<!-- If this PR closes a GitHub issue, reference it here by its number -->
7-
Closes #
4+
<!-- If this PR will close an existing GitHub issue (that is not already attached to a JIRA ticket): -->
5+
<!-- Closes # -->
86

9-
<!-- describe the changes comprising this PR here -->
10-
This PR addresses ...
7+
<!-- Describe your changes here: -->
8+
## Description
9+
This change ...
1110

12-
<!-- if you can't perform these tasks due to permissions, please ask a maintainer to do them -->
11+
<!-- If you can't perform these tasks due to permissions, reach out to a maintainer. -->
1312
## Tasks
13+
14+
- [ ] If this change affects user-facing code or public API, add news fragment file(s) to `changes/` (see [the changelog instructions](https://github.com/spacetelescope/stpipe/blob/main/changes/README.md)).
15+
Otherwise, add the `no-changelog-entry-needed` label.
16+
1417
- [ ] update or add relevant tests
1518
- [ ] update relevant docstrings and / or `docs/` page
16-
- [ ] Does this PR change any API used downstream? (if not, label with `no-changelog-entry-needed`)
17-
- [ ] write news fragment(s) in `changes/`: `echo "changed something" > changes/<PR#>.<changetype>.rst` (see [changelog readme](https://github.com/spacetelescope/stpipe/blob/main/changes/README.rst) for instructions)
18-
- [ ] run regression tests with this branch installed (`stpipe@git+https://github.com/<fork>/stpipe.git@<branch>`)
19-
- [ ] [`jwst` regression test](https://github.com/spacetelescope/RegressionTests/actions/workflows/jwst.yml)
20-
- [ ] [`romancal` regression test](https://github.com/spacetelescope/RegressionTests/actions/workflows/romancal.yml)

.github/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
changelog:
2+
categories:
3+
- title: Breaking Changes
4+
labels:
5+
- breaking-change
6+
- title: New Features
7+
labels:
8+
- feature
9+
- title: Fixes
10+
labels:
11+
- fix
12+
- title: Documentation Changes
13+
labels:
14+
- documentation
15+
- title: Other Changes
16+
labels:
17+
- "*"

.github/workflows/build.yml

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,52 @@
11
name: build
22

33
on:
4+
pull_request:
45
release:
56
types: [released]
6-
pull_request:
77
workflow_dispatch:
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
913
jobs:
1014
build:
11-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/publish_pure_python.yml@v2
12-
with:
13-
upload_to_pypi: ${{ (github.event_name == 'release') && (github.event.action == 'released') }}
14-
secrets:
15-
pypi_token: ${{ secrets.PYPI_PASSWORD_STSCI_MAINTAINER }}
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
18+
with:
19+
fetch-tags: true
20+
persist-credentials: false
21+
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
22+
with:
23+
# Cache disabled to prevent cache-poisoning attacks on release artifacts.
24+
enable-cache: false
25+
- run: uv build --sdist --wheel
26+
- uses: actions/upload-artifact@v4
27+
with:
28+
name: dist
29+
path: ./dist/
30+
publish:
31+
if: (github.event_name == 'release') && (github.event.action == 'released')
32+
needs: [build]
33+
runs-on: ubuntu-latest
34+
permissions:
35+
id-token: write
36+
attestations: write
37+
# Requires environment protection rules in GitHub Settings:
38+
# Settings > Environments > pypi > Add required reviewers
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/stpipe
42+
steps:
43+
- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
44+
with:
45+
pattern: dist*
46+
path: dist/
47+
merge-multiple: true
48+
- uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0
49+
with:
50+
subject-path: "dist/*"
51+
# To upload to PyPI without a token, add this workflow file as a Trusted Publisher in the project settings on the PyPI website
52+
- uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0

.github/workflows/changelog.yml

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
name: changelog
2-
31
on:
4-
pull_request:
2+
pull_request_target:
53
types:
64
- labeled
75
- unlabeled
@@ -10,30 +8,18 @@ on:
108
- reopened
119

1210
concurrency:
13-
group: ${{ github.workflow }}-${{ github.ref }}
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
1412
cancel-in-progress: true
1513

1614
jobs:
17-
changelog-check:
15+
check:
1816
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog-entry-needed') }}
1917
runs-on: ubuntu-latest
2018
steps:
21-
- uses: actions/setup-python@v6
22-
with:
23-
python-version: 3.12
24-
- uses: actions/checkout@v6
25-
with:
26-
fetch-depth: 0
27-
- run: pip install .
28-
- run: pip install towncrier
29-
- run: towncrier check
30-
- run: towncrier build --draft | grep -P '#${{ github.event.number }}'
31-
changelog-prevent-manual-edit:
32-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'allow-manual-changelog-edit') }}
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3620
with:
37-
fetch-depth: 0
38-
- name: prevent direct changes to `CHANGES.rst` (write a towncrier fragment in `changes/` instead; you can override this with the `allow-manual-changelog-edit` label)
39-
run: git diff HEAD ${{ github.event.pull_request.base.sha }} --no-patch --exit-code CHANGES.rst
21+
persist-credentials: false
22+
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
23+
- run: uv run towncrier check
24+
- name: search for news fragment matching pull request number
25+
run: uv run towncrier build --draft | grep -P '#${{ github.event.number }}'

.github/workflows/label.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
on:
2+
pull_request_target:
3+
4+
concurrency:
5+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
6+
cancel-in-progress: true
7+
8+
jobs:
9+
label:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
13+
if: github.event_name == 'pull_request_target' || github.event_name == 'pull_request'
14+
with:
15+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

.github/workflows/tests.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,31 @@ concurrency:
1818
cancel-in-progress: true
1919

2020
jobs:
21+
format:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+
with:
26+
persist-credentials: false
27+
- uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
28+
- run: uvx ruff format --check .
29+
- run: uvx ruff check .
2130
test:
22-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
31+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@ccd2f9f4a24f34ea1165a717af125260d93bb5c1 # v2.6.1
2332
with:
33+
fill: true
34+
fill_platforms: linux
35+
fill_factors: xdist
2436
envs: |
2537
- linux: py310-oldestdeps-cov-xdist
26-
- linux: py310-xdist
27-
- linux: py311-xdist
2838
- linux: py311-downstreamdeps-cov-xdist
2939
coverage: 'codecov'
3040
- linux: py312-xdist-nolegacypath
31-
- linux: py313-xdist
32-
- linux: py314-cov-xdist
41+
- linux: py3-cov-xdist
3342
coverage: 'codecov'
34-
- macos: py314-xdist
43+
- macos: py3-xdist
3544
test_downstream:
36-
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@v2
45+
uses: OpenAstronomy/github-actions-workflows/.github/workflows/tox.yml@ccd2f9f4a24f34ea1165a717af125260d93bb5c1 # v2.6.1
3746
with:
3847
setenv: |
3948
CRDS_PATH: /tmp/data/crds_cache

.github/workflows/update.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
on:
2+
schedule:
3+
- cron: "0 2 * * 1"
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
14+
jobs:
15+
update:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
19+
- uses: actions/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # 7.6.0
20+
with:
21+
enable-cache: false
22+
- name: Check for updates to upstream template
23+
id: upstream-updates
24+
run: |
25+
CHANGES=0
26+
if [ -f .cruft.json ]; then
27+
if ! cruft check; then
28+
CHANGES=1
29+
fi
30+
else
31+
echo "No .cruft.json file"
32+
fi
33+
34+
echo "available=$CHANGES" >> "$GITHUB_OUTPUT"
35+
- if: steps.upstream-updates.outputs.available
36+
name: Apply updates from upstream template
37+
run: |
38+
uvx cruft update --skip-apply-ask --refresh-private-variables
39+
git restore --staged .
40+
- if: steps.upstream-updates.outputs.available
41+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
42+
with:
43+
token: ${{ secrets.GITHUB_TOKEN }}
44+
add-paths: .
45+
commit-message: "chore: use Cruft to apply changes from the upstream template"
46+
branch: cruft/update
47+
delete-branch: true
48+
branch-suffix: timestamp
49+
title: |
50+
[CRUFT] Apply updates from upstream template
51+
body: |
52+
[Cruft](https://cruft.github.io/cruft/) has detected updates to the upstream Cookiecutter template.
53+
54+
> [!TIP]
55+
> To skip these updates, modify this PR to increment `.cruft.json` only.

0 commit comments

Comments
 (0)