Skip to content

Commit

Permalink
reworked github actions.
Browse files Browse the repository at this point in the history
  • Loading branch information
vogt31337 committed Mar 27, 2024
1 parent 92e7257 commit f355ac3
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 125 deletions.
125 changes: 0 additions & 125 deletions .github/workflows/release.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This workflow will create a Python package and upload it to testPyPi or PyPi
# Then, it installs pandapower 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
push:
branches:
- release/*

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

build:
runs-on: ${{ matrix.os }}
needs: upload
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [ ubuntu-latest, windows-latest ]
group: [ 1, 2 ]

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install pandapower & dependencies
run: |
python -m pip install --upgrade pip
cd $GITHUB_WORKSPACE
pip install -e .
python -m pip install pytest igraph pytest-split seaborn matplotlib plotly geopandas ortools xlsxwriter openpyxl cryptography psycopg2 matpowercaseframes
- name: Install specific dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
if ( '${{ matrix.python-version }}' -eq '3.9' ) { python -m pip install pypower }
if ( '${{ matrix.python-version }}' -ne '3.9' ) { python -m pip install numba }
if ( '${{ matrix.python-version }}' -eq '3.8' -or '${{ matrix.python-version }}' -eq '3.10' ) { python -m pip install lightsim2grid }
- name: Install specific dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
if ${{ matrix.python-version == '3.9' }}; then python -m pip install pypower; fi
if ${{ matrix.python-version != '3.9' }}; then python -m pip install numba; fi
if ${{ matrix.python-version == '3.8' || matrix.python-version == '3.10' }}; then python -m pip install lightsim2grid; fi
# - name: Install Julia
# if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
# run: |
# ./.install_julia.sh 1.8
# pip install julia
# python ./.install_pycall.py

- name: List all installed packages
run: |
pip list
- name: Test with pytest
run: |
pytest --split 2 --group ${{ matrix.group }} --pyargs pandapower.test
54 changes: 54 additions & 0 deletions .github/workflows/upload_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This workflow will create a Python package and upload it to testPyPi or PyPi
# Then, it installs pandapower from there and all dependencies and runs tests with different Python versions

name: upload release

# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
push:
tags:
- 'v*'
branches:
- master

# 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@v4

# Sets up python3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
# Installs and upgrades pip, installs other dependencies and installs the package from setup.py
- name: Install dependencies
run: |
# Upgrade pip
python3 -m pip install --upgrade pip
# Install twine
python3 -m pip install setuptools wheel twine
# Upload to PyPI
- name: Build and Upload to PyPI
if: inputs.upload_server == 'pypi'
run: |
python3 setup.py sdist --formats=zip
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

0 comments on commit f355ac3

Please sign in to comment.