release #50
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will create a Python package and upload it to testPyPi or PyPi | |
# Then, it installs pandapipes from there and all dependencies and runs tests with different Python versions | |
name: release | |
# Controls when the action will run. | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
upload_server: | |
description: 'upload server' | |
required: true | |
default: 'testpypi' | |
type: choice | |
options: | |
- 'testpypi' | |
- 'pypi' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
upload: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
# Sets up python3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
# Installs and upgrades pip, installs twine and other packages for the release-process | |
- name: Install dependencies | |
run: | | |
# Upgrade pip | |
python3 -m pip install --upgrade pip | |
# Install twine | |
python3 -m pip install build setuptools wheel twine | |
# Upload to TestPyPI | |
- name: Build and Upload to TestPyPI | |
if: ${{ inputs.upload_server == 'testpypi'}} | |
run: | | |
python3 -m build | |
python3 -m twine check dist/* --strict | |
python3 -m twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TESTPYPI }} | |
TWINE_REPOSITORY: testpypi | |
# Upload to PyPI | |
- name: Build and Upload to PyPI | |
if: ${{ inputs.upload_server == 'pypi' }} | |
run: | | |
python3 -m build | |
python3 -m twine check dist/* --strict | |
python3 -m twine upload dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI }} | |
TWINE_REPOSITORY: pypi | |
- name: Sleep for 300s to make release available | |
uses: juliangruber/sleep-action@v1 | |
with: | |
time: 300s | |
build: | |
runs-on: ${{ matrix.os }} | |
needs: upload | |
strategy: | |
matrix: | |
python-version: ['3.9', '3.10', '3.11', '3.12'] | |
os: [ ubuntu-latest, windows-latest ] | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pytest igraph pytest-split | |
if [${{ matrix.python-version != '3.11' }}]; then python -m pip install numba; fi | |
shell: bash | |
- name: Install pandapipes from TestPyPI | |
if: ${{ inputs.upload_server == 'testpypi'}} | |
run: | | |
python -m pip install --no-cache-dir -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple pandapipes | |
- name: Install pandapipes from PyPI | |
if: ${{ inputs.upload_server == 'pypi'}} | |
run: | | |
python -m pip install pandapipes | |
- name: List all installed packages | |
run: | | |
python -m pip list | |
- name: Test with pytest | |
run: | | |
pytest --pyargs pandapipes.test |