-
Notifications
You must be signed in to change notification settings - Fork 4
115 lines (102 loc) · 3.51 KB
/
build-release.yaml
File metadata and controls
115 lines (102 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
name: flux-python
on:
pull_request: {}
workflow_dispatch:
inputs:
version:
description: 'Pypi version'
release_version:
description: 'Version of flux to build'
default: "0.68.0"
rc:
description: 'Release candidate to build (for wheel)'
default: "0"
branch:
description: 'Branch to build from'
default: "master"
repo:
description: 'Repository to build from'
default: "https://github.com/flux-framework/flux-core"
jobs:
build:
name: ${{ matrix.os }} Python ${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# The matrix now includes both os and python
os: [ubuntu-latest, macos-latest]
python: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Setup Python
env:
python_version: ${{ matrix.python }}
run: /bin/bash ./docker/install-mamba.sh ${{ matrix.python }}
# The login shell ensures the mamba env is active
- name: Build Flux Core Branch
env:
FLUX_RELEASE_VERSION: ${{ inputs.release_version }}
FLUX_VERSION: ${{ inputs.version }}
run: /bin/bash .github/scripts/setup.sh
- name: Build Python Bindings
shell: bash -l {0}
env:
FLUX_BRANCH: ${{ inputs.branch }}
FLUX_REPO: ${{ inputs.repo }}
run: |
echo "Flux Repo: ${{ inputs.repo }}"
echo "Flux Branch: ${{ inputs.branch }}"
# Use default values if inputs are empty
FLUX_REPO_URL=${FLUX_REPO:-"https://github.com/flux-framework/flux-core"}
FLUX_BRANCH_NAME=${FLUX_BRANCH:-"master"}
git clone -b ${FLUX_BRANCH_NAME} ${FLUX_REPO_URL} /tmp/flux-core
mv /tmp/flux-core/src/bindings/python/flux ./flux
python setup.py sdist
# I think ldconfig is Linux-specific
if [[ "${{ runner.os }}" == "Linux" ]]; then
sudo ldconfig
fi
- name: Build Python Wheels
shell: bash -l {0}
env:
build_number: ${{ inputs.rc }}
python_version: ${{ matrix.python }}
run: |
/bin/bash ./docker/build-wheels.sh ${{ env.build_number }} ${{ env.python_version }}
ls ./dist
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
# The artifact name must be unique for each job in the matrix
name: dist-${{ matrix.python }}-${{ matrix.os }}
path: ./dist
upload:
runs-on: ubuntu-latest
# This job now needs the entire build matrix to complete successfully
needs: [build]
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
# Download all artifacts created by the build jobs
path: artifacts
- name: Show and Organize Files
run: |
ls -R artifacts
mkdir -p ./dist
# This command finds all wheel and tar.gz files in all subdirectories
# and moves them into a single ./dist directory for upload.
find artifacts -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec mv {} ./dist/ \;
echo
echo "Files to distribute:"
ls ./dist
- name: Build and publish
# Ensure this only runs on pushes to a main branch, not PRs
if: (github.event_name != 'pull_request')
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
run: |
python3 -m pip install --upgrade twine
twine upload --skip-existing dist/*