Skip to content

Commit 1feefdd

Browse files
committed
Make it so that the compilation yaml can be used
while publishing to pypi.
1 parent e427593 commit 1feefdd

2 files changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/compile_madng.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Make a MAD-NG Binary
33
on:
44
push:
55
workflow_dispatch:
6+
# Allow release workflows to build and consume these exact binaries.
7+
workflow_call:
68

79
jobs:
810
build-linux:

.github/workflows/python-publish.yml

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ permissions:
1616
contents: read
1717

1818
jobs:
19+
# Set the repository variable PYMADNG_BUILD_MADNG_FROM_SOURCE to "false"
20+
# to temporarily restore the legacy pre-built binary download path below.
21+
compile-madng:
22+
if: ${{ vars.PYMADNG_BUILD_MADNG_FROM_SOURCE != 'false' }}
23+
uses: ./.github/workflows/compile_madng.yml
24+
1925
deploy:
26+
needs: compile-madng
27+
if: ${{ always() && (needs.compile-madng.result == 'success' || needs.compile-madng.result == 'skipped') }}
2028
runs-on: ubuntu-latest
2129
# Specifying a GitHub environment is optional, but strongly encouraged
2230
environment: release
@@ -34,11 +42,30 @@ jobs:
3442
run: |
3543
python -m pip install --upgrade pip
3644
pip install build
37-
- name: Get MAD Binaries
45+
- name: Download compiled Linux MAD-NG
46+
if: ${{ vars.PYMADNG_BUILD_MADNG_FROM_SOURCE != 'false' }}
47+
uses: actions/download-artifact@v5
48+
with:
49+
name: mad-Linux
50+
path: build/mad-Linux
51+
- name: Download compiled macOS MAD-NG
52+
if: ${{ vars.PYMADNG_BUILD_MADNG_FROM_SOURCE != 'false' }}
53+
uses: actions/download-artifact@v5
54+
with:
55+
name: mad-macOS-x86_64
56+
path: build/mad-Darwin
57+
- name: Add compiled MAD-NG binaries to the package
58+
if: ${{ vars.PYMADNG_BUILD_MADNG_FROM_SOURCE != 'false' }}
59+
run: |
60+
mkdir -p src/pymadng/bin
61+
install -m 755 build/mad-Linux/mad src/pymadng/bin/mad_Linux
62+
install -m 755 build/mad-Darwin/mad src/pymadng/bin/mad_Darwin
63+
- name: Download pre-built MAD-NG binaries (legacy fallback)
64+
if: ${{ vars.PYMADNG_BUILD_MADNG_FROM_SOURCE == 'false' }}
3865
run: |
39-
mkdir src/pymadng/bin
40-
curl https://madx.web.cern.ch/releases/madng/1.1/mad-linux-1.1.13 -o src/pymadng/bin/mad_Linux
41-
curl https://madx.web.cern.ch/releases/madng/1.1/mad-macos-1.1.13 -o src/pymadng/bin/mad_Darwin
66+
mkdir -p src/pymadng/bin
67+
curl --fail --location https://madx.web.cern.ch/releases/madng/1.1/mad-linux-1.1.13 -o src/pymadng/bin/mad_Linux
68+
curl --fail --location https://madx.web.cern.ch/releases/madng/1.1/mad-macos-1.1.13 -o src/pymadng/bin/mad_Darwin
4269
chmod +x src/pymadng/bin/mad_Linux src/pymadng/bin/mad_Darwin
4370
- name: Build package
4471
run: python -m build

0 commit comments

Comments
 (0)