Skip to content
Snippets Groups Projects
Commit c53df518 authored by Maik Nijhuis's avatar Maik Nijhuis
Browse files

AST-1460 Enable make wheels

parent 866c5498
No related branches found
No related tags found
No related merge requests found
...@@ -191,6 +191,52 @@ build-package-2204: ...@@ -191,6 +191,52 @@ build-package-2204:
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
- if: '$UPLOAD_PACKAGE' - if: '$UPLOAD_PACKAGE'
.build-wheel:
stage: build
needs: []
image: docker:20.10
services:
- docker:20.10-dind
tags:
- das6
before_script:
- apk add bash
script:
- cd docker
- USER=root ./make_wheels.sh $PYTHON_VERSION
artifacts:
paths:
- output-*/*
rules:
- <<: *if_astron_repo
when: manual
allow_failure: true
build-wheel-36:
extends: .build-wheel
variables:
PYTHON_VERSION: 36
build-wheel-37:
extends: .build-wheel
variables:
PYTHON_VERSION: 37
build-wheel-38:
extends: .build-wheel
variables:
PYTHON_VERSION: 38
build-wheel-39:
extends: .build-wheel
variables:
PYTHON_VERSION: 39
build-wheel-310:
extends: .build-wheel
variables:
PYTHON_VERSION: 310
linting-2204: linting-2204:
stage: linting stage: linting
extends: [".failable",".needs-base-2204"] extends: [".failable",".needs-base-2204"]
...@@ -359,6 +405,35 @@ deploy-package-2204: ...@@ -359,6 +405,35 @@ deploy-package-2204:
when: never when: never
- if: '$UPLOAD_PACKAGE' - if: '$UPLOAD_PACKAGE'
.deploy-wheel:
stage: publish
image: python:latest
script:
- pip install twine
- TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi output-*/*.whl
when: manual
allow_failure: true
deploy-wheel-36:
extends: .deploy-wheel
needs: ["build-wheel-36"]
deploy-wheel-37:
extends: .deploy-wheel
needs: ["build-wheel-37"]
deploy-wheel-38:
extends: .deploy-wheel
needs: ["build-wheel-38"]
deploy-wheel-39:
extends: .deploy-wheel
needs: ["build-wheel-39"]
deploy-wheel-310:
extends: .deploy-wheel
needs: ["build-wheel-310"]
pages-2204: pages-2204:
stage: pages stage: pages
needs: ["versioning","build-debug-2204","unit-test-2204","integration-test-2204"] needs: ["versioning","build-debug-2204","unit-test-2204","integration-test-2204"]
...@@ -385,6 +460,5 @@ pages-2204: ...@@ -385,6 +460,5 @@ pages-2204:
coverage_report: coverage_report:
coverage_format: cobertura coverage_format: cobertura
path: public/build/reports/code-coverage.xml path: public/build/reports/code-coverage.xml
rules: rules:
- <<: *if_not_astron_repo - <<: *if_not_astron_repo
#!/usr/bin/bash #!/bin/bash
# Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy) # Copyright (C) 2022 ASTRON (Netherlands Institute for Radio Astronomy)
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
# Script to make python wheels for several versions # Script that makes python wheels for several versions.
# The working directory matters, script should be run with ./make_wheels.sh # The working directory matters since the parent directory should contain the
# The parent directory should contain the source code with the version to build. # source code. The script should be run with
# ./make_wheels.sh <python versions>
# For example, when <python versions> equals 38 310, the script builds wheels
# for python 3.8 and 3.10.
# If <python versions> is empty, it becomes: 310 39 38 37 36 .
set -euo pipefail set -euo pipefail
for py_version in 310 39 38 37 36; do for py_version in ${@:-310 39 38 37 36}; do
pushd .. pushd ..
sed -i "s=\(master_wheel\)[0-9]*=\1${py_version}=" docker/py310_wheel.docker
grep wheel3 docker/py310_wheel.docker # Use the Python3.10 dockerfile as a template, even for Python3.10.
dockerfile=$(mktemp make_wheels.docker.XXXXXX)
cat docker/py310_wheel.docker > $dockerfile
sed -i "s=\(casacore:master_wheel\)310=\1${py_version}=" $dockerfile
## Build docker image from docker-file. The current wheel is created there ## Build docker image from docker-file. The current wheel is created there
#docker build -t dp3-py${py_version}-$USER -f docker/py310_wheel.docker . docker build -t dp3-py${py_version}-$USER -f $dockerfile .
## Create a docker container from that image, and extract the wheel ## Create a docker container from that image, and extract the wheel
#containerid=$(docker create dp3-py${py_version}-$USER) containerid=$(docker create dp3-py${py_version}-$USER)
#echo "Docker container ID is: $containerid" echo "Docker container ID is: $containerid"
#docker cp $containerid:/output/ output-${py_version} # Copies whole dir docker cp $containerid:/output/ output-${py_version} # Copies whole dir
#docker rm ${containerid} docker rm ${containerid}
#docker image rm dp3-py${py_version}-$USER docker image rm dp3-py${py_version}-$USER
rm $dockerfile
popd popd
done done
...@@ -50,6 +50,6 @@ RUN sed -i '/find_package(PythonLibs 3 REQUIRED)/d' CMakeLists.txt ...@@ -50,6 +50,6 @@ RUN sed -i '/find_package(PythonLibs 3 REQUIRED)/d' CMakeLists.txt
# and to remove the previous wheel when changing parameters that causes a new # and to remove the previous wheel when changing parameters that causes a new
# wheel filename e.g. changing the version number. # wheel filename e.g. changing the version number.
RUN /opt/python/${TARGET}/bin/python ./setup.py build_ext -j${THREADS} RUN /opt/python/${TARGET}/bin/python ./setup.py build_ext -j${THREADS}
RUN mv /dp3/build/temp.linux-x86_64-cpython-39/dp3/DP3 /dp3/build/temp.linux-x86_64-cpython-39/dp3/__DP3_from_pip__ RUN mv /dp3/build/temp.linux-x86_64-*/dp3/DP3 /dp3/build/__DP3_from_pip__
RUN /opt/python/${TARGET}/bin/python ./setup.py bdist_wheel -d . RUN /opt/python/${TARGET}/bin/python ./setup.py bdist_wheel -d .
RUN auditwheel repair --plat manylinux2014_x86_64 -w /output *.whl RUN auditwheel repair --plat manylinux2014_x86_64 -w /output *.whl
...@@ -130,7 +130,7 @@ setup( ...@@ -130,7 +130,7 @@ setup(
# LD_PRELOAD=/path/to/lib/libpython3.9.so __DP3_from_pip__ # LD_PRELOAD=/path/to/lib/libpython3.9.so __DP3_from_pip__
( (
"bin", "bin",
["/dp3/build/temp.linux-x86_64-cpython-39/dp3/__DP3_from_pip__"], ["build/__DP3_from_pip__"],
), ),
], ],
url="https://dp3.readthedocs.io/", url="https://dp3.readthedocs.io/",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment