Skip to content

Commit

Permalink
improve workflows (#13)
Browse files Browse the repository at this point in the history
* Update lint-check-and-test.yaml

* test version bump

* revert version bump

* Update lint-check-and-test.yaml

try updating actions

* Update lint-and-test.yaml

* Update README.md

* Create pypi-publish.yaml
  • Loading branch information
aclerc committed Jul 12, 2024
1 parent 3ebf2c9 commit ca6f29d
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 8 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/CI.yaml → .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check format lint and test
name: Lint and test

on:
push:
Expand All @@ -15,11 +15,11 @@ jobs:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "checkout repository"
uses: actions/checkout@v4

- uses: actions/setup-python@v4
name: 'Set up Python ${{ inputs.python-version }}'
- uses: actions/setup-python@v5
name: 'set up Python ${{ inputs.python-version }}'
with:
python-version: ${{ env.python-version }}

Expand All @@ -31,14 +31,20 @@ jobs:
restore-keys: |
${{ runner.os }}-venv-
- name: 'Create Virtualenv and install Dependencies'
- name: 'create virtualenv and install dependencies'
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv .venv
source .venv/bin/activate
pip install .[dev]
- name: "lint-check & test"
- name: 'update dependencies'
if: steps.cache-venv.outputs.cache-hit == 'true'
run: |
source .venv/bin/activate
pip install -U .[dev]
- name: "lint check & test"
run: |
source .venv/bin/activate
poe lint-check
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/pypi-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package to PyPi

on:
release:
types: [published]

permissions:
contents: read

jobs:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Build release distributions
run: |
python -m pip install build
python -m build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest

needs:
- release-build

permissions:
id-token: write

environment:
name: release
url: https://pypi.org/project/res-wind-up/

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# wind-up
A tool to assess yield uplift of wind turbines

[![CI](https://github.com/resgroup/wind-up/actions/workflows/CI.yaml/badge.svg)](https://github.com/resgroup/wind-up/actions/workflows/CI.yaml)
[![lint-and-test](https://github.com/resgroup/wind-up/actions/workflows/lint-and-test.yaml/badge.svg)](https://github.com/resgroup/wind-up/actions/workflows/lint-and-test.yaml)
[![Python 3.10](https://img.shields.io/badge/python-≥3.10-blue.svg)](https://www.python.org/downloads/release/python-3100/)
[![Lint & Format: Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
[![Typing: mypy](https://img.shields.io/badge/typing-mypy-yellow.svg)](https://github.com/python/mypy)
Expand Down

0 comments on commit ca6f29d

Please sign in to comment.