Skip to content

Commit 19c7afe

Browse files
authored
Merge pull request #2117 from musicinmybrain/gitignore
[MISC] In bidsschematools, exclude .gitignore files from sdists
2 parents 9ea926c + 6ef804e commit 19c7afe

File tree

2 files changed

+29
-33
lines changed

2 files changed

+29
-33
lines changed

.github/workflows/schemacode_ci.yml

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,29 @@ defaults:
2323

2424
jobs:
2525
build:
26-
runs-on: ${{ matrix.os }}
27-
strategy:
28-
matrix:
29-
os: ["ubuntu-latest"]
30-
python-version: ["3.11"]
26+
name: Build & verify package
27+
runs-on: ubuntu-latest
28+
permissions:
29+
attestations: write
30+
id-token: write
3131
steps:
3232
- uses: actions/checkout@v4
33-
- uses: actions/setup-python@v5
3433
with:
35-
python-version: ${{ matrix.python-version }}
36-
- name: "Install build dependencies"
37-
run: pip install --upgrade build twine
38-
- name: "Install test dependencies on tag"
39-
run: pip install --upgrade tools/schemacode[all]
34+
fetch-depth: 0
35+
- name: Install the latest version of uv
36+
uses: astral-sh/setup-uv@v6
4037
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
4138
- name: "Build archive on tag"
4239
run: |
43-
python -m pytest -k make_archive
40+
uv run --extra=tests pytest -k make_archive
4441
working-directory: tools/schemacode
4542
env:
4643
BIDSSCHEMATOOLS_RELEASE: 1
4744
if: ${{ startsWith(github.ref, 'refs/tags/schema-') }}
48-
- name: "Build source distribution and wheel"
49-
run: python -m build tools/schemacode
50-
- name: "Check distribution metadata"
51-
run: twine check tools/schemacode/dist/*
52-
- uses: actions/upload-artifact@v4
45+
- uses: hynek/build-and-inspect-python-package@v2
5346
with:
54-
name: dist
55-
path: tools/schemacode/dist/
47+
path: tools/schemacode
48+
attest-build-provenance-github: ${{ github.event_name != 'pull_request' }}
5649

5750
test:
5851
runs-on: ${{ matrix.os }}
@@ -83,8 +76,8 @@ jobs:
8376
- name: "Fetch packages"
8477
uses: actions/download-artifact@v4
8578
with:
86-
name: dist
87-
path: dist/
79+
name: Packages
80+
path: dist
8881

8982
- name: "Install package"
9083
run: |
@@ -104,20 +97,20 @@ jobs:
10497
if: success()
10598

10699
publish:
107-
runs-on: ${{ matrix.os }}
108100
name: Publish Python Package
109-
needs: [test]
110101
if: github.event_name == 'push'
111-
strategy:
112-
matrix:
113-
os: ["ubuntu-latest"]
114-
python-version: ["3.11"]
102+
runs-on: ubuntu-latest
103+
needs: [test]
104+
permissions:
105+
attestations: write
106+
id-token: write
107+
115108
steps:
116-
- name: "Fetch packages"
109+
- name: Download packages built by build-and-inspect-python-package
117110
uses: actions/download-artifact@v4
118111
with:
119-
name: dist
120-
path: dist/
112+
name: Packages
113+
path: dist
121114
- name: "Test PyPI upload"
122115
uses: pypa/gh-action-pypi-publish@release/v1
123116
with:
@@ -128,9 +121,6 @@ jobs:
128121
- name: "Upload to PyPI (on tags)"
129122
if: startsWith(github.ref, 'refs/tags/schema-')
130123
uses: pypa/gh-action-pypi-publish@release/v1
131-
with:
132-
user: __token__
133-
password: ${{ secrets.PYPI_API_TOKEN }}
134124

135125
validate_schema:
136126
runs-on: ubuntu-latest

tools/schemacode/pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ bst = "bidsschematools.__main__:cli"
6363
[project.urls]
6464
Homepage = "https://github.com/bids-standard/bids-specification"
6565

66+
[tool.pdm.build]
67+
excludes = [
68+
".gitignore",
69+
"**/.gitignore",
70+
]
71+
6672
[tool.black]
6773
exclude = "*"
6874

0 commit comments

Comments
 (0)