Skip to content

Commit

Permalink
WIP PyPI-action
Browse files Browse the repository at this point in the history
  • Loading branch information
atemerev committed Feb 23, 2024
1 parent d37f728 commit adf68aa
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 15 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/publish_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Neurodamus Wheels

# TODO: set to on: workflow_dispatch before merging to main
on: push

jobs:
wheel:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: [3.11]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Prerequisites
run: |
sudo apt-get update --fix-missing
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo TZ=UTC apt-get -y install tzdata
sudo apt-get update
sudo apt-get install -y python${{ matrix.python_version }} python${{ matrix.python_version }}-distutils python${{ matrix.python_version }}-venv
sudo apt-get install -y curl
sudo curl -sS https://bootstrap.pypa.io/get-pip.py | python${{ matrix.python_version }}
sudo apt-get install -y cmake ninja-build
sudo apt-get install -y libhdf5-mpich-dev
- name: Build libsonatareport
run: |
git clone https://github.com/BlueBrain/libsonatareport.git --recursive
cd libsonatareport
cmake -B build -DCMAKE_BUILD_TYPE=Release -DSONATA_REPORT_ENABLE_SUBMODULES=ON -GNinja
cmake --build build
cd ..
- name: Install neuron
run: |
pip3 install neuron
- name: Build Wheel
run: |
cd $GITHUB_WORKSPACE
python${{ matrix.python_version }} -m pip install --upgrade build
# build wheel
python${{ matrix.python_version }} -m build .
- name: Test Wheel
run: |
cd $GITHUB_WORKSPACE
pip3 install tox
DIST_FILE=`ls dist/neurodamus*whl` tox --installpkg=dist/*.whl -e ${{ matrix.python_version }}
- name: Upload Wheel
env:
PYPI_URL: ${{ secrets.PYPI_URL }}
PYPI_USER: ${{ secrets.PYPI_USER }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
pip3 install twine argcomplete
DIST_FILE=`ls dist/neurodamus*whl` tox --installpkg=dist/*.whl -e ${{ matrix.python_version }}
python${{ matrix.python_version }} -m twine upload --username $PYPI_USER --password $PYPI_PASSWORD --repository-url $PYPI_URL DIST_FILE
15 changes: 0 additions & 15 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include:
file:
- /ci/lib/tox-bb5.yml
- /ci/jobs/build-package.yml
- /ci/jobs/build-wheels.yml
- /ci/jobs/publish-package.yml
- /ci/jobs/docs.yml
- /ci/jobs/publish-docs.yml
Expand Down Expand Up @@ -233,27 +232,13 @@ upload-to-docker-hub:
- if: $CI_PIPELINE_SOURCE == "web"
when: manual

upload-to-pypi:
needs: [build-wheels]
script:
pip install twine
python -m twine upload --username $PYPI_USER --password $PYPI_PASSWORD --repository-url $PYPI_URL ${PYTHON_PROJECT_DIR}/wheelhouse
rules:
- when: manual

# The following stages are overrides. Don't rename
# Always add the manual option to create sdist/wheel or upload
build-package:
rules:
- when: on_success

build-wheels:
parallel:
matrix:
- PY_VERSION: [py311, py312]
rules:
- when: manual

publish-package:
rules:
- when: manual
Expand Down

0 comments on commit adf68aa

Please sign in to comment.