Skip to content

Commit c4a27fd

Browse files
committed
Use new way to prebuild w heels
1 parent 4803427 commit c4a27fd

1 file changed

Lines changed: 17 additions & 110 deletions

File tree

.github/workflows/mega-linter.yml

Lines changed: 17 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -60,118 +60,25 @@ jobs:
6060
key: ${{ runner.os }}-alpine-wheels-${{ hashFiles('requirements-dev.txt') }}
6161
restore-keys: |
6262
${{ runner.os }}-alpine-wheels-${{ hashFiles('requirements-dev.txt') }}
63-
- name: Set up Alpine Linux
64-
if: steps.cache-wheels.outputs.cache-hit != 'true'
65-
uses: jirutka/setup-alpine@v1
66-
with: # cfitsio, py3-pkgconfig, curl-dev, and zlib for healpy
67-
branch: v3.21
68-
packages: >
69-
build-base
70-
python3-dev
71-
py3-pip
72-
jupyter-notebook
73-
gfortran
74-
fftw-dev
75-
git
76-
openblas-dev
77-
cmake
78-
geos-dev
79-
cfitsio
80-
py3-pkgconfig
81-
curl-dev
82-
zlib-dev
83-
llvm15-dev
84-
clang15
85-
- name: List workspace
86-
run: ls -l .
87-
88-
- name: Create Python virtual environment
89-
if: steps.cache-wheels.outputs.cache-hit != 'true'
90-
run: |
91-
python -m venv "${{ github.workspace }}/venv"
92-
echo "VENV_PATH=${{ github.workspace }}/venv" >> "$GITHUB_ENV"
93-
shell: alpine.sh {0}
9463
95-
- name: Upgrade pip and install requirements for building
64+
- name: Build cp313 musllinux wheels
9665
if: steps.cache-wheels.outputs.cache-hit != 'true'
97-
run: |
98-
source "$VENV_PATH/bin/activate"
99-
python -m ensurepip
100-
python -m pip install --upgrade pip
101-
python -m pip install --upgrade meson-python meson ninja wheel build
102-
shell: alpine.sh {0}
103-
104-
- name: Remove version settings
105-
if: steps.cache-wheels.outputs.cache-hit != 'true'
106-
run: |
107-
sed 's/==.*//' requirements-dev.txt > requirements-dev_no_version.txt
108-
109-
- name: Remove torch, triton, jax, intel-openmp, nvidia, tbb, and mkl entries (unsupported by alpine)
110-
if: steps.cache-wheels.outputs.cache-hit != 'true'
111-
run: |
112-
sed -i '/^torch/d' requirements-dev_no_version.txt
113-
sed -i '/^nvidia/d' requirements-dev_no_version.txt
114-
sed -i '/^triton/d' requirements-dev_no_version.txt
115-
sed -i '/^jax/d' requirements-dev_no_version.txt
116-
sed -i '/^intel-openmp/d' requirements-dev_no_version.txt
117-
sed -i '/^tbb/d' requirements-dev_no_version.txt
118-
sed -i '/^mkl/d' requirements-dev_no_version.txt
119-
120-
- name: Install Packages Sequentially
121-
if: steps.cache-wheels.outputs.cache-hit != 'true'
122-
run: |
123-
source "$VENV_PATH/bin/activate"
124-
cat requirements-dev_no_version.txt
125-
export "LLVM_CONFIG=/usr/lib/llvm15/bin/llvm-config"
126-
while read requirement; do
127-
echo "Installing $requirement..."
128-
pip install "$requirement" --find-links=./alpine-wheels
129-
done < requirements-dev_no_version.txt
130-
131-
shell: alpine.sh {0}
132-
133-
- name: Freeze requirements
134-
if: steps.cache-wheels.outputs.cache-hit != 'true'
135-
run: |
136-
source "$VENV_PATH/bin/activate"
137-
python -m pip freeze > requirements-tmp.txt
138-
shell: alpine.sh {0}
139-
140-
- name: Download compatible packages
141-
if: steps.cache-wheels.outputs.cache-hit != 'true'
142-
run: |
143-
source "$VENV_PATH/bin/activate"
144-
python -m pip download --find-links=./alpine-wheels -r requirements-tmp.txt -d ./alpine-wheels
145-
shell: alpine.sh {0}
146-
147-
- name: Build wheels
148-
if: steps.cache-wheels.outputs.cache-hit != 'true'
149-
run: |
150-
export "LLVM_CONFIG=/usr/lib/llvm15/bin/llvm-config"
151-
source "$VENV_PATH/bin/activate"
152-
cd ./alpine-wheels
153-
154-
# Set a flag to indicate if any .tar.gz files are found
155-
found=0
156-
157-
# Loop through all .tar.gz files
158-
for src in *.tar.gz; do
159-
# Check if the glob gets expanded to existing files.
160-
# If not, src will be exactly '*.tar.gz'.
161-
[ -e "$src" ] || continue
162-
# If we reach this point, at least one file exists
163-
found=1
164-
python -m pip wheel "$src" --no-deps --wheel-dir=./
165-
rm "$src"
166-
done
167-
168-
# Check if no files were found
169-
if [ "$found" -eq 0 ]; then
170-
echo "No .tar.gz files found."
171-
fi
172-
173-
cd ..
174-
shell: alpine.sh {0}
66+
uses: docker://python:3.13-alpine3.21
67+
with:
68+
args: |
69+
/bin/sh -lc 'set -eux
70+
apk add --no-cache \
71+
build-base musl-dev gcc g++ make \
72+
openblas-dev fftw-dev geos-dev cfitsio-dev \
73+
curl-dev zlib-dev llvm15-dev clang15 \
74+
git cmake
75+
python -m pip install --upgrade pip wheel
76+
mkdir -p /github/workspace/alpine-wheels
77+
cd /github/workspace
78+
sed "s/==.*//" requirements-dev.txt > requirements-dev_no_version.txt
79+
sed -i "/^\(torch\|triton\|jax\|nvidia\|intel-openmp\|tbb\|mkl\)/d" requirements-dev_no_version.txt
80+
python -m pip wheel --no-deps -r requirements-dev_no_version.txt -w alpine-wheels
81+
'
17582
17683
- name: Clean up temporary files (in case they are generated)
17784
if: steps.cache-wheels.outputs.cache-hit != 'true'

0 commit comments

Comments
 (0)