Skip to content

Commit 840d49b

Browse files
authored
Merge pull request #2 from ecmwf/act/pyWrapWheel/dockerUser
PyWrapWheel: docker user
2 parents 4be0046 + 4a61990 commit 840d49b

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

.github/workflows/python-wrapper-wheel.yml

+27-25
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# runs the compilation and bundles all artifacts (libs, includes, ...) into
33
# a binary wheel (manylinux/macos) along with findlibs-compatible instructions
44
# about dependencies
5-
# Assumes that the project has the `python_wrapper` directory which configures
6-
# this action
5+
# Accepts `wheel_directory` parameter, by default `python_wrapper`, with files
6+
# that configure this action -- `buildconfig`, `pyproject.toml`, `setup.py`, and
7+
# a few optional bash scripts such as `pre-compile.sh`
78

89
on:
910
workflow_call:
@@ -13,7 +14,11 @@ on:
1314
required: false
1415
type: boolean
1516
default: false # TODO actually use this
16-
17+
wheel_directory:
18+
description: Path to the directory with buildconfig and pyproject
19+
required: false
20+
type: string
21+
default: python_wrapper
1722
jobs:
1823
linux-wheel:
1924
name: Build manylinux_2_28
@@ -28,25 +33,24 @@ jobs:
2833
runs-on: [self-hosted, Linux, platform-builder-Rocky-8.6]
2934
container:
3035
image: eccr.ecmwf.int/wheelmaker/2_28:latest
36+
options: --user github-actions
3137
credentials:
3238
username: ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }}
3339
password: ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }}
3440
steps:
3541
# NOTE we dont use action checkout because it doesnt cleanup after itself correctly
36-
- run: git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /proj
37-
- run: cd /proj && /buildscripts/prepare_deps.sh ./python_wrapper/buildconfig "${{ matrix.python_version }}"
38-
- run: cd /proj && if [[ -f ./python_wrapper/pre-compile.sh ]] ; then ./python_wrapper/pre-compile.sh ; fi
39-
- run: cd /proj && /buildscripts/compile.sh ./python_wrapper/buildconfig
40-
- run: cd /proj && if [[ -f ./python_wrapper/post-compile.sh ]] ; then ./python_wrapper/post-compile.sh ; fi
41-
- run: cd /proj && GITHUB_BRANCH="${GITHUB_REF}" PYTHONPATH=/buildscripts /buildscripts/wheel-linux.sh ./python_wrapper/buildconfig "${{ matrix.python_version }}"
42-
- run: cd /proj && if [[ -f ./python_wrapper/post-build.sh ]] ; then ./python_wrapper/post-build.sh ; fi
43-
- run: cd /proj && /buildscripts/test-wheel.sh ./python_wrapper/buildconfig "${{ matrix.python_version }}"
44-
- run: cd /proj && PYTHONPATH=/buildscripts /buildscripts/upload-pypi.sh ./python_wrapper/buildconfig
42+
- run: git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY /src/proj
43+
- run: cd /src/proj && /buildscripts/prepare_deps.sh ./${{ inputs.wheel_directory }}/buildconfig "${{ matrix.python_version }}"
44+
- run: cd /src/proj && if [[ -f ./${{ inputs.wheel_directory }}/pre-compile.sh ]] ; then ./${{ inputs.wheel_directory }}/pre-compile.sh ; fi
45+
- run: cd /src/proj && /buildscripts/compile.sh ./${{ inputs.wheel_directory }}/buildconfig
46+
- run: cd /src/proj && if [[ -f ./${{ inputs.wheel_directory }}/post-compile.sh ]] ; then ./${{ inputs.wheel_directory }}/post-compile.sh ; fi
47+
- run: cd /src/proj && GITHUB_BRANCH="${GITHUB_REF}" PYTHONPATH=/buildscripts /buildscripts/wheel-linux.sh ./${{ inputs.wheel_directory }}/buildconfig "${{ matrix.python_version }}"
48+
- run: cd /src/proj && if [[ -f ./${{ inputs.wheel_directory }}/post-build.sh ]] ; then ./${{ inputs.wheel_directory }}/post-build.sh ; fi
49+
- run: cd /src/proj && GITHUB_BRANCH="${GITHUB_REF}" /buildscripts/test-wheel.sh ./${{ inputs.wheel_directory }}/buildconfig "${{ matrix.python_version }}"
50+
- run: cd /src/proj && PYTHONPATH=/buildscripts /buildscripts/upload-pypi.sh ./${{ inputs.wheel_directory }}/buildconfig
4551
env:
4652
TWINE_USERNAME: __token__
4753
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
48-
# NOTE temporary thing until all the mess gets cleared
49-
- run: rm -rf ./* ./.git ./.github
5054
macos-wheel:
5155
name: Build macos wheel
5256
strategy:
@@ -74,21 +78,19 @@ jobs:
7478
- run: rm -rf proj && git clone --depth=1 --branch="${GITHUB_REF#refs/heads/}" https://github.com/$GITHUB_REPOSITORY proj
7579
- run: |
7680
uv python install python"${{ matrix.python_version }}"
77-
cd proj && $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/prepare_deps.sh ./python_wrapper/buildconfig "${{ matrix.python_version }}"
81+
cd proj && $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/prepare_deps.sh ./${{ inputs.wheel_directory }}/buildconfig "${{ matrix.python_version }}"
7882
- run: |
7983
cd proj
80-
if [[ -f ./python_wrapper/pre-compile.sh ]] ; then ./python_wrapper/pre-compile.sh ; fi
81-
PATH="$PATH:$GITHUB_WORKSPACE/ecbuild/bin/" $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/compile.sh ./python_wrapper/buildconfig
82-
if [[ -f ./python_wrapper/post-compile.sh ]] ; then ./python_wrapper/post-compile.sh ; fi
84+
if [[ -f ./${{ inputs.wheel_directory }}/pre-compile.sh ]] ; then ./${{ inputs.wheel_directory }}/pre-compile.sh ; fi
85+
PATH="$GITHUB_WORKSPACE/ecbuild/bin/:$PATH" $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/compile.sh ./${{ inputs.wheel_directory }}/buildconfig
86+
if [[ -f ./${{ inputs.wheel_directory }}/post-compile.sh ]] ; then ./${{ inputs.wheel_directory }}/post-compile.sh ; fi
8387
- run: |
8488
cd proj
85-
rm -rf /tmp/buildvenv && uv venv --python python"${{ matrix.python_version }}" /tmp/buildvenv && source /tmp/buildvenv/bin/activate && uv pip install build twine delocate setuptools requests
86-
GITHUB_BRANCH="${GITHUB_REF}" PYTHONPATH=$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/wheel-linux.sh ./python_wrapper/buildconfig "${{ matrix.python_version }}"
87-
if [[ -f ./python_wrapper/post-build.sh ]] ; then ./python_wrapper/post-build.sh ; fi
88-
$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/test-wheel.sh ./python_wrapper/buildconfig "${{ matrix.python_version }}"
89-
PYTHONPATH=$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/upload-pypi.sh ./python_wrapper/buildconfig
89+
rm -rf /tmp/buildvenv && uv venv --python python"${{ matrix.python_version }}" /tmp/buildvenv && source /tmp/buildvenv/bin/activate && uv pip install build twine==6.0.1 delocate setuptools requests # NOTE twine version forced due to metadata issue, cf wheelmaker Dockerfile
90+
GITHUB_BRANCH="${GITHUB_REF}" PYTHONPATH=$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/wheel-linux.sh ./${{ inputs.wheel_directory }}/buildconfig "${{ matrix.python_version }}"
91+
if [[ -f ./${{ inputs.wheel_directory }}/post-build.sh ]] ; then ./${{ inputs.wheel_directory }}/post-build.sh ; fi
92+
GITHUB_BRANCH="${GITHUB_REF}" $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/test-wheel.sh ./${{ inputs.wheel_directory }}/buildconfig "${{ matrix.python_version }}"
93+
PYTHONPATH=$GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts $GITHUB_WORKSPACE/ci-utils/wheelmaker/buildscripts/upload-pypi.sh ./${{ inputs.wheel_directory }}/buildconfig
9094
env:
9195
TWINE_USERNAME: __token__
9296
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
93-
# NOTE temporary thing until all the mess gets cleared
94-
- run: rm -rf ./* ./.git ./.github

0 commit comments

Comments
 (0)