@@ -11,153 +11,65 @@ name: Build Python Wheel for Linux
1111
1212on :
1313 # Trigger the workflow manually
14- workflow_dispatch : ~
15-
16- # Allow to be called from another workflow
17- workflow_call : ~
18-
19- # TODO automation trigger
20- # repository_dispatch:
21- # types: [eccodes-updated]
14+ workflow_dispatch :
15+ inputs :
16+ use_test_pypi :
17+ description : Use test pypi instead of the regular one
18+ required : false
19+ type : boolean
20+ default : false
21+
22+ # Allow to be called from another workflow -- eg `cd.yml`
23+ workflow_call :
24+ inputs :
25+ use_test_pypi :
26+ description : Use test pypi instead of the regular one
27+ required : false
28+ type : boolean
29+ default : false
2230
2331jobs :
24- build-python-wheel :
32+ build :
2533 name : Build manylinux_2_28
26- runs-on : [self-hosted, Linux, platform-builder-Rocky-8.6]
27- container :
28- image : dockcross/manylinux_2_28-x64:20250109-7bf589c
29- # options: --pull always
30-
31- name : Build manylinux_2_28-x64
32-
33- steps :
34- - uses : actions/checkout@v4
35-
36- - run : ./scripts/build-linux.sh
37-
38- # ###############################################################
39- - run : ./scripts/wheel-linux.sh 3.8
40- - uses : actions/upload-artifact@v4
41- name : Upload wheel 3.8
42- with :
43- name : wheel-manylinux2014-3.8
44- path : wheelhouse/*.whl
45-
46- # ################################################################
47- - run : ./scripts/wheel-linux.sh 3.9
48- - uses : actions/upload-artifact@v4
49- name : Upload wheel 3.9
50- with :
51- name : wheel-manylinux2014-3.9
52- path : wheelhouse/*.whl
53-
54- # ################################################################
55- - run : ./scripts/wheel-linux.sh 3.10
56- - uses : actions/upload-artifact@v4
57- name : Upload wheel 3.10
58- with :
59- name : wheel-manylinux2014-3.10
60- path : wheelhouse/*.whl
61-
62- # ################################################################
63- - run : ./scripts/wheel-linux.sh 3.11
64- - uses : actions/upload-artifact@v4
65- name : Upload wheel 3.11
66- with :
67- name : wheel-manylinux2014-3.11
68- path : wheelhouse/*.whl
69-
70- # ################################################################
71- - run : ./scripts/wheel-linux.sh 3.12
72- - uses : actions/upload-artifact@v4
73- name : Upload wheel 3.12
74- with :
75- name : wheel-manylinux2014-3.12
76- path : wheelhouse/*.whl
77-
78- # ################################################################
79- - run : ./scripts/wheel-linux.sh 3.13
80- - uses : actions/upload-artifact@v4
81- name : Upload wheel 3.13
82- with :
83- name : wheel-manylinux2014-3.13
84- path : wheelhouse/*.whl
85-
86- test :
87-
88- needs : build
89-
9034 strategy :
91- fail-fast : false
92- matrix : # We don't test 3.6, as it is not supported anymore by github actions
93- python-version : ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
94-
95- runs-on : [self-hosted, Linux, platform-builder-Rocky-8.6]
96-
97- name : Test with ${{ matrix.python-version }}
98-
99- steps :
100-
101- - uses : actions/checkout@v4
102-
103- - uses : actions/download-artifact@v4
104- with :
105- name : wheel-manylinux2014-${{ matrix.python-version }}
106-
107- - run : ./scripts/test-linux.sh ${{ matrix.python-version }}
108-
109-
110- deploy :
111-
112- if : ${{ github.ref_type == 'tag' || github.event_name == 'release' }}
113-
114- strategy :
115- fail-fast : false
35+ fail-fast : true
11636 matrix :
117- python-version : ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
118-
119- needs : [test, build]
120-
121- name : Deploy wheel ${{ matrix.python-version }}
122-
123- runs-on : [self-hosted, Linux, platform-builder-Rocky-8.6]
124-
125-
126- steps :
127-
128- - run : mkdir artifact-${{ matrix.python-version }}
129-
130- - uses : actions/checkout@v4
131-
132- - uses : actions/download-artifact@v4
133- with :
134- name : wheel-manylinux2014-${{ matrix.python-version }}
135- path : artifact-${{ matrix.python-version }}
136-
137- build-wrapper-wheel :
138- name : Build manylinux_2_28
37+ python_version : ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
13938 runs-on : [self-hosted, Linux, platform-builder-Rocky-8.6]
14039 container :
141- image : eccr.ecmwf.int/wheelmaker/2_28:latest
40+ image : eccr.ecmwf.int/wheelmaker/2_28:1. latest
14241 credentials :
14342 username : ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }}
14443 password : ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }}
14544 steps :
146- # TODO convert this to be matrix-friendly. Note it's a bit tricky since
147- # we'd ideally not reexecute the compile step multiple times, but it
148- # (non-essentially) depends on a matrix-based step
149- # NOTE we dont use action checkout because it doesnt cleanup after itself correctly
150- - run : git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /proj
151- - run : cd /proj && /buildscripts/prepare_deps.sh ./buildconfig 3.11
15245 - run : |
153- cd /proj
154- export PYTHONPATH=/buildscripts/; export LIBDIR=/tmp/prereqs/eccodeslib/lib64; export INCDIR=/tmp/prereqs/eccodeslib/include
155- uv run --python python3.11 python -m build --installer uv --wheel .
156- - run : mkdir -p /build/wheel && mv /proj/dist/*whl /build/wheel
157- - run : cd /proj && /buildscripts/test-wheel.sh ./python_wrapper/buildconfig 3.11 /build/wheel/*whl
158- - run : cd /proj && /buildscripts/upload-pypi.sh /build/wheel/*whl
46+ set -euo pipefail
47+ git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /src/eccodes-python
48+ cd /src/eccodes-python
49+ if [ "$GITHUB_REF_NAME" != "main" -a "$GITHUB_REF_NAME" != "master" -a "$GITHUB_REF_TYPE" != "tag" ] ; then
50+ export UV_CACHE_DIR="/tmp/reallynocache"
51+ rm -rf $UV_CACHE_DIR && mkdir $UV_CACHE_DIR
52+ EXTRA_PIP="--refresh --no-cache --prerelease=allow"
53+ else
54+ EXTRA_PIP=""
55+ fi
56+
57+ VENV_ROOT=/venv/build"${{ matrix.python_version }}"
58+ source $VENV_ROOT/bin/activate
59+ uv pip install $EXTRA_PIP eccodeslib
60+ EL_ROOT=$VENV_ROOT/lib/python"${{ matrix.python_version }}"/site-packages/eccodeslib
61+ export LIBDIR=$EL_ROOT/lib64
62+ export INCDIR=$EL_ROOT/include
63+ python -m build --no-isolation .
64+
65+ uv pip install $EXTRA_PIP ./dist/*whl pytest
66+ cd tests
67+ ECCODES_PYTHON_TRACE_LIB_SEARCH=1 pytest -v -s
68+ cd ..
69+
70+ if [ "${{ inputs.use_test_pypi }}" = "true" ] ; then UPLOAD_TO=test ; else UPLOAD_TO=prod ; fi
71+ PYTHONPATH=/buildscripts /buildscripts/upload-pypi.sh $UPLOAD_TO ./dist
15972 env:
16073 TWINE_USERNAME: __token__
161- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
162- # NOTE temporary thing until all the mess gets cleared
163- - run : rm -rf ./* ./.git ./.github
74+ TWINE_PASSWORD_PROD: ${{ secrets.PYPI_API_TOKEN }}
75+ TWINE_PASSWORD_TEST: ${{ secrets.PYPI_TEST_API_TOKEN }}
0 commit comments