Debian Codegraph @

.github/workflows/build-dist.yaml

raw
1 name: Build distributions
2 on:
3 # Validate packaging on PRs and master; also called by the Release workflow.
4 pull_request:
5 paths:
6 - '.github/workflows/build-dist.yaml'
7 - 'devtools/source-dist.sh'
8 - 'pyproject.toml'
9 - 'cffi_build.py'
10 push:
11 branches: [master]
12 paths:
13 - '.github/workflows/build-dist.yaml'
14 - 'devtools/source-dist.sh'
15 - 'pyproject.toml'
16 - 'cffi_build.py'
17 workflow_dispatch:
18 workflow_call:
19 inputs:
20 ref:
21 # Ref to build; empty (PR/push) checks out the event ref.
22 type: string
23 default: ''
24 jobs:
25 build:
26 name: Build
27 if: github.repository == 'libmbd/libmbd' || github.event_name == 'pull_request'
28 runs-on: ubuntu-latest
29 steps:
30 - uses: actions/checkout@v6
31 with:
32 ref: ${{ inputs.ref }}
33 # Both poetry-dynamic-versioning and devtools/source-dist.sh derive
34 # the version from Git tags, so the full history (and tags) must be
35 # available.
36 fetch-depth: 0
37 - uses: actions/setup-python@v6
38 with:
39 python-version: '3.x'
40 - name: Install build tooling
41 run: python -m pip install --upgrade build twine
42 # pyMBD's C extension is built against an external libMBD at install time,
43 # so PyPI only carries the source distribution -- a binary wheel would
44 # bake in one libMBD build and break for everyone else.
45 - name: Build pyMBD sdist
46 run: python -m build --sdist --outdir pymbd-dist
47 - name: Check pyMBD metadata
48 run: twine check --strict pymbd-dist/*
49 # The libMBD source archive (Fortran/C sources + CMake) is what gets
50 # built into the `libmbd` conda package and downloaded by people who
51 # build the library by hand. It is bundled with the GitHub Release only,
52 # never uploaded to PyPI.
53 - name: Build libMBD source archive
54 run: |
55 bash devtools/source-dist.sh
56 mv dist/libmbd-*.tar.gz .
57 - name: Upload pyMBD sdist
58 uses: actions/upload-artifact@v4
59 with:
60 name: pymbd-sdist
61 path: pymbd-dist/*.tar.gz
62 - name: Upload libMBD source archive
63 uses: actions/upload-artifact@v4
64 with:
65 name: libmbd-sdist
66 path: libmbd-*.tar.gz