Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: overhaul ci and cd workflows #326

Merged
merged 23 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

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

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

jobs:
dist:
# Build the Python SDist and wheel, performs metadata and readme linting
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
afuetterer marked this conversation as resolved.
Show resolved Hide resolved
- uses: hynek/build-and-inspect-python-package@v2

release:
# Publish a GitHub release from the given git tag
name: Create GitHub Release
needs: [dist]
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 on PyPI
afuetterer marked this conversation as resolved.
Show resolved Hide resolved
name: Publish to PyPI
needs: [dist]
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
29 changes: 20 additions & 9 deletions .github/workflows/CI.yaml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,37 @@ on:

jobs:
build:
name: Build and verify package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v2
id: baipp

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

test:
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) }}
afuetterer marked this conversation as resolved.
Show resolved Hide resolved
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 +67,9 @@ jobs:
run: |
choco install glpk

- name: Install dependencies for python ${{ matrix.python-version }}
- name: Install package and dependencies
run: |
pip install -e .[dev,solvers]
pip install ${{ fromJson(steps.baipp.outputs.dist_file_paths_json_array)[0] }}[dev,solvers]

- name: Lint with flake8
run: |
Expand Down