Skip to content

Commit

Permalink
Merge pull request #326 from afuetterer/325-ci-cd
Browse files Browse the repository at this point in the history
ci: overhaul ci and cd workflows
  • Loading branch information
FabianHofmann authored Jul 17, 2024
2 parents f03b9f8 + c6564a8 commit b1a52dc
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 72 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/deploy.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/gh-release.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
tags:
- v*.*.*

jobs:
build:
# Build the Python SDist and wheel, performs metadata and readme linting
name: Build and verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hynek/build-and-inspect-python-package@v2

release:
# Publish a GitHub release from the given git tag
name: Create GitHub Release
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: softprops/action-gh-release@v2
with:
generate_release_notes: true

publish:
# Publish the built SDist and wheel from "dist" job to PyPI
name: Publish to PyPI
needs: [build]
runs-on: ubuntu-latest
environment:
name: Release
url: https://pypi.org/project/linopy/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
43 changes: 33 additions & 10 deletions .github/workflows/CI.yaml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Tests

on:
push:
Expand All @@ -8,28 +8,45 @@ on:
schedule:
- cron: "0 5 * * TUE"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
# Build the Python SDist and wheel, performs metadata and readme linting
name: Build and verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for setuptools_scm
- uses: hynek/build-and-inspect-python-package@v2
id: baipp

outputs:
python-versions: ${{ steps.baipp.outputs.supported_python_classifiers_json_array }}

test:
# Test package build in matrix of OS and Python versions
name: Test package
needs: [build]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- 3.9
- "3.10"
- "3.11"
- "3.12"
python-version: ${{ fromJSON(needs.build.outputs.python-versions) }}
os:
- ubuntu-latest
- macos-latest
- windows-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches (necessary for setuptools_scm)
fetch-depth: 0 # Needed for setuptools_scm

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -56,9 +73,15 @@ jobs:
run: |
choco install glpk
- name: Install dependencies for python ${{ matrix.python-version }}
- name: Download package
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Install package and dependencies
run: |
pip install -e .[dev,solvers]
python -m pip install "$(ls dist/*.whl)[dev,solvers]"
- name: Lint with flake8
run: |
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# linopy: Optimization with array-like variables and constraints

[![PyPI](https://img.shields.io/pypi/v/linopy)](https://pypi.org/project/linopy/) [![CI](https://github.com/FabianHofmann/linopy/actions/workflows/CI.yaml/badge.svg)](https://github.com/FabianHofmann/linopy/actions/workflows/CI.yaml) [![License](https://img.shields.io/pypi/l/linopy.svg)](LICENSE.txt) [![doc](https://readthedocs.org/projects/linopy/badge/?version=latest)](https://linopy.readthedocs.io/en/latest/) [![codecov](https://codecov.io/gh/PyPSA/linopy/branch/master/graph/badge.svg?token=TT4EYFCCZX)](https://codecov.io/gh/PyPSA/linopy)
[![PyPI](https://img.shields.io/pypi/v/linopy)](https://pypi.org/project/linopy/)
[![License](https://img.shields.io/pypi/l/linopy.svg)](LICENSE.txt)
[![Tests](https://github.com/PyPSA/linopy/actions/workflows/test.yml/badge.svg)](https://github.com/PyPSA/linopy/actions/workflows/test.yml)
[![doc](https://readthedocs.org/projects/linopy/badge/?version=latest)](https://linopy.readthedocs.io/en/latest/)
[![codecov](https://codecov.io/gh/PyPSA/linopy/branch/master/graph/badge.svg?token=TT4EYFCCZX)](https://codecov.io/gh/PyPSA/linopy)

**linopy** is an open-source python package that facilitates **optimization** with **real world data**. It builds a bridge between data analysis packages like [xarray](https://github.com/pydata/xarray) & [pandas](https://pandas.pydata.org/) and problem solvers like [cbc](https://projects.coin-or.org/Cbc), [gurobi](https://www.gurobi.com/) (see the full list below). **Linopy** supports **Linear, Integer, Mixed-Integer and Quadratic Programming** while aiming to make linear programming in Python easy, highly-flexible and performant.

Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ readme = "README.md"
authors = [{ name = "Fabian Hofmann", email = "[email protected]" }]
license = { file = "LICENSE" }
classifiers = [
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Development Status :: 3 - Alpha",
"Environment :: Console",
"Intended Audience :: Science/Research",
Expand Down

0 comments on commit b1a52dc

Please sign in to comment.