Skip to content

Switch eccodes python to wheelchains #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 53 additions & 140 deletions .github/workflows/build-wheel-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,156 +7,69 @@
# nor does it submit to any jurisdiction.


name: Build Linux
name: Build Python Wheel for Linux

on:
# Trigger the workflow manually
workflow_dispatch: ~

# Allow to be called from another workflow
workflow_call: ~

# repository_dispatch:
# types: [eccodes-updated]

push:
tags-ignore:
- '**'
paths:
- 'scripts/common.sh'
- 'scripts/select-python-linux.sh'
- 'scripts/wheel-linux.sh'
- 'scripts/build-linux.sh'
- 'scripts/test-linux.sh'
- 'scripts/copy-licences.py'
- '.github/workflows/build-wheel-linux.yml'

# to allow the action to run on the manylinux docker image based on CentOS 7
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
workflow_dispatch:
inputs:
use_test_pypi:
description: Use test pypi instead of the regular one
required: false
type: boolean
default: false

# Allow to be called from another workflow -- eg `cd.yml`
workflow_call:
inputs:
use_test_pypi:
description: Use test pypi instead of the regular one
required: false
type: boolean
default: false

jobs:

build:

# if: false # for temporarily disabling for debugging

runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]
container:
image: dockcross/manylinux_2_28-x64:20250109-7bf589c
#options: --pull always

name: Build manylinux_2_28-x64

steps:
- uses: actions/checkout@v4

- run: ./scripts/build-linux.sh

################################################################
- run: ./scripts/wheel-linux.sh 3.8
- uses: actions/upload-artifact@v4
name: Upload wheel 3.8
with:
name: wheel-manylinux2014-3.8
path: wheelhouse/*.whl

# ################################################################
- run: ./scripts/wheel-linux.sh 3.9
- uses: actions/upload-artifact@v4
name: Upload wheel 3.9
with:
name: wheel-manylinux2014-3.9
path: wheelhouse/*.whl

# ################################################################
- run: ./scripts/wheel-linux.sh 3.10
- uses: actions/upload-artifact@v4
name: Upload wheel 3.10
with:
name: wheel-manylinux2014-3.10
path: wheelhouse/*.whl

# ################################################################
- run: ./scripts/wheel-linux.sh 3.11
- uses: actions/upload-artifact@v4
name: Upload wheel 3.11
with:
name: wheel-manylinux2014-3.11
path: wheelhouse/*.whl

# ################################################################
- run: ./scripts/wheel-linux.sh 3.12
- uses: actions/upload-artifact@v4
name: Upload wheel 3.12
with:
name: wheel-manylinux2014-3.12
path: wheelhouse/*.whl

# ################################################################
- run: ./scripts/wheel-linux.sh 3.13
- uses: actions/upload-artifact@v4
name: Upload wheel 3.13
with:
name: wheel-manylinux2014-3.13
path: wheelhouse/*.whl

test:

needs: build

name: Build manylinux_2_28
strategy:
fail-fast: false
matrix: # We don't test 3.6, as it is not supported anymore by github actions
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]

name: Test with ${{ matrix.python-version }}

steps:

- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: wheel-manylinux2014-${{ matrix.python-version }}

- run: ./scripts/test-linux.sh ${{ matrix.python-version }}


deploy:

if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }}

strategy:
fail-fast: false
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

needs: [test, build]

name: Deploy wheel ${{ matrix.python-version }}

python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]


container:
image: eccr.ecmwf.int/wheelmaker/2_28:1.latest
credentials:
username: ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }}
steps:

- run: mkdir artifact-${{ matrix.python-version }}

- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: wheel-manylinux2014-${{ matrix.python-version }}
path: artifact-${{ matrix.python-version }}

- run: |
source ./scripts/select-python-linux.sh 3.10
pip3 install twine
ls -l artifact-${{ matrix.python-version }}/*.whl
twine upload artifact-${{ matrix.python-version }}/*.whl
set -euo pipefail
git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /src/eccodes-python
cd /src/eccodes-python
if [ "$GITHUB_REF_NAME" != "main" -a "$GITHUB_REF_NAME" != "master" -a "$GITHUB_REF_TYPE" != "tag" ] ; then
export UV_CACHE_DIR="/tmp/reallynocache"
rm -rf $UV_CACHE_DIR && mkdir $UV_CACHE_DIR
EXTRA_PIP="--refresh --no-cache --prerelease=allow"
else
EXTRA_PIP=""
fi

VENV_ROOT=/venv/build"${{ matrix.python_version }}"
source $VENV_ROOT/bin/activate
uv pip install $EXTRA_PIP eccodeslib
EL_ROOT=$VENV_ROOT/lib/python"${{ matrix.python_version }}"/site-packages/eccodeslib
export LIBDIR=$EL_ROOT/lib64
export INCDIR=$EL_ROOT/include
python -m build --no-isolation .

uv pip install $EXTRA_PIP ./dist/*whl pytest
cd tests
ECCODES_PYTHON_TRACE_LIB_SEARCH=1 pytest -v -s
cd ..

if [ "${{ inputs.use_test_pypi }}" = "true" ] ; then UPLOAD_TO=test ; else UPLOAD_TO=prod ; fi
PYTHONPATH=/buildscripts /buildscripts/upload-pypi.sh $UPLOAD_TO ./dist
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_PASSWORD_PROD: ${{ secrets.PYPI_API_TOKEN }}
TWINE_PASSWORD_TEST: ${{ secrets.PYPI_TEST_API_TOKEN }}
Loading