Skip to content

Commit e064194

Browse files
committed
ci: test updated main build script to add macOS
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
1 parent db430f2 commit e064194

1 file changed

Lines changed: 59 additions & 36 deletions

File tree

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: build flux-python
1+
name: flux-python
22

33
on:
44
pull_request: {}
@@ -20,90 +20,113 @@ on:
2020
default: "https://github.com/flux-framework/flux-core"
2121

2222
jobs:
23-
build-manual:
24-
runs-on: ubuntu-latest
23+
build:
24+
name: ${{ matrix.os }} Python ${{ matrix.python }}
25+
runs-on: ${{ matrix.os }}
2526
strategy:
2627
fail-fast: false
2728
matrix:
29+
# The matrix now includes both os and python
30+
os: [ubuntu-latest, macos-latest]
2831
python: ["3.8", "3.9", "3.10", "3.11"]
29-
container:
30-
image: fluxrm/testenv:jammy
32+
3133
steps:
3234
- uses: actions/checkout@v4
33-
- name: Setup Python
35+
36+
# Allow linux (gnu) style sed patterns for Mac.
37+
- name: Install GNU sed (macOS)
38+
if: runner.os == 'macOS'
39+
run: brew install gnu-sed
40+
41+
# Only run original script on the Linux runner
42+
- name: Setup Python (Linux)
43+
if: runner.os == 'Linux'
3444
env:
3545
python_version: ${{ matrix.python }}
36-
# Installs to /opt/conda/envs/build/bin/python3
37-
run: /bin/bash ./docker/install-mamba.sh ${python_version}
46+
run: /bin/bash ./docker/install-mamba.sh ${{ matrix.python }}
47+
48+
# Use micromamba for MacOS and hope someone else figured this out :)
49+
- name: Setup Python (macOS)
50+
if: runner.os == 'macOS'
51+
uses: mamba-org/setup-micromamba@v1
52+
with:
53+
environment-name: build-env
54+
create-args: python=${{ matrix.python }}
3855

56+
# The login shell ensures the mamba env is active
3957
- name: Build Flux Core Branch
58+
shell: bash -l {0}
4059
env:
4160
FLUX_RELEASE_VERSION: ${{ inputs.release_version }}
4261
FLUX_VERSION: ${{ inputs.version }}
4362
run: /bin/bash .github/scripts/setup.sh
4463

4564
- name: Build Python Bindings
65+
shell: bash -l {0}
4666
env:
4767
FLUX_BRANCH: ${{ inputs.branch }}
4868
FLUX_REPO: ${{ inputs.repo }}
49-
shell: bash
5069
run: |
51-
echo "Flux Repo: ${FLUX_REPO}"
52-
echo "Flux Branch: ${FLUX_BRANCH}"
53-
if [[ "${FLUX_REPO}" == "" ]]; then
54-
FLUX_REPO="https://github.com/flux-framework/flux-core"
55-
fi
56-
if [[ "${FLUX_BRANCH}" == "" ]]; then
57-
FLUX_BRANCH="master"
70+
echo "Flux Repo: ${{ inputs.repo }}"
71+
echo "Flux Branch: ${{ inputs.branch }}"
72+
73+
# Use default values if inputs are empty
74+
FLUX_REPO_URL=${FLUX_REPO:-"https://github.com/flux-framework/flux-core"}
75+
FLUX_BRANCH_NAME=${FLUX_BRANCH:-"master"}
76+
77+
git clone -b ${FLUX_BRANCH_NAME} ${FLUX_REPO_URL} /tmp/flux-core
78+
mv /tmp/flux-core/src/bindings/python/flux ./flux
79+
python setup.py sdist
80+
81+
# I think ldconfig is Linux-specific
82+
if [[ "${{ runner.os }}" == "Linux" ]]; then
83+
sudo ldconfig
5884
fi
59-
git clone -b ${FLUX_BRANCH} ${FLUX_REPO} /tmp/flux-core
60-
mv /tmp/flux-core/src/bindings/python/flux ./flux
61-
/opt/conda/envs/build/bin/python3 setup.py sdist
62-
sudo ldconfig
6385
6486
- name: Build Python Wheels
87+
shell: bash -l {0}
6588
env:
6689
build_number: ${{ inputs.rc }}
6790
python_version: ${{ matrix.python }}
6891
run: |
69-
/bin/bash ./docker/build-wheels.sh ${build_number} ${python_version}
92+
/bin/bash ./docker/build-wheels.sh ${{ env.build_number }} ${{ env.python_version }}
7093
ls ./dist
7194
7295
- name: Upload distributions
73-
if: success()
7496
uses: actions/upload-artifact@v4
7597
with:
76-
name: ${{ matrix.python }}
98+
# The artifact name must be unique for each job in the matrix
99+
name: dist-${{ matrix.python }}-${{ matrix.os }}
77100
path: ./dist
78101

79102
upload:
80103
runs-on: ubuntu-latest
81-
needs: [build-manual]
104+
# This job now needs the entire build matrix to complete successfully
105+
needs: [build]
82106
steps:
83107
- name: Download Artifacts
84108
uses: actions/download-artifact@v4
85-
# If name unspecified, all artifacts download for run
109+
with:
110+
# Download all artifacts created by the build jobs
111+
path: artifacts
86112

87-
- name: Show Files
113+
- name: Show and Organize Files
88114
run: |
89-
ls */
90-
# We just need one of these
91-
first_dir=$(ls . | head -n 1)
115+
ls -R artifacts
92116
mkdir -p ./dist
93-
mv */*.whl ./dist/
94-
cp ${first_dir}/*.tar.gz ./dist/
117+
# This command finds all wheel and tar.gz files in all subdirectories
118+
# and moves them into a single ./dist directory for upload.
119+
find artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec mv {} ./dist/ \;
95120
echo
96121
echo "Files to distribute:"
97122
ls ./dist
98123
99124
- name: Build and publish
125+
# Ensure this only runs on pushes to a main branch, not PRs
100126
if: (github.event_name != 'pull_request')
101127
env:
102128
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
103129
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
104130
run: |
105-
ls dist/
106-
python3 -m pip install setuptools wheel
107-
python3 -m pip install twine==6.0.1
108-
python3 -m pip install --upgrade pkginfo
109-
twine upload --skip-existing dist/flux_python*
131+
python3 -m pip install --upgrade twine
132+
twine upload --skip-existing dist/*

0 commit comments

Comments
 (0)