Skip to content

Commit

Permalink
ECC-1793: develop binary wheel - Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
iainrussell committed Apr 18, 2024
1 parent f4c5ede commit fc6c948
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/build-wheel-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,61 @@ jobs:
with:
name: wheel-manylinux2014-3.12
path: wheelhouse/*.whl

test:

needs: build

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"]

runs-on: [self-hosted, Linux]

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

steps:

- uses: actions/checkout@v2

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

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


deploy:

if: ${{ github.event_name == 'release' }}

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

needs: [test, build]

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

runs-on: [self-hosted, Linux]


steps:

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

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

- run: |
source ./scripts/select-python-linux.sh ${{ matrix.python-version }}
pip3 install twine
ls -l artifact-${{ matrix.python-version }}/*.whl
twine upload --repository testpypi artifact-${{ matrix.python-version }}/*.whl
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }}
25 changes: 25 additions & 0 deletions scripts/select-python-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# (C) Copyright 2024 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

set -xe
version=$1

source /opt/conda/etc/profile.d/conda.sh

CONDA_PY_ENV_DIR=$RUNNER_TEMP/venv_$version

if [ ! -d "${CONDA_PY_ENV_DIR}" ]; then
conda create -y -p $CONDA_PY_ENV_DIR
fi

conda activate $CONDA_PY_ENV_DIR
conda install -y python=${{ inputs.version }} openldap

which python3
python3 --version
28 changes: 28 additions & 0 deletions scripts/test-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# (C) Copyright 2024 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmental organisation
# nor does it submit to any jurisdiction.

set -eaux
python_version=$1

ls -l
source ./scripts/select-python-linux.sh ${python_version}

echo $PATH
pwd
ls -l

pip install *.whl
pip install pytest
pip install -r tests/requirements.txt
pip freeze

cd tests
pytest -v -s

rm -fr *.whl tests

0 comments on commit fc6c948

Please sign in to comment.