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

Improve workflows #11

Merged
merged 3 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
41 changes: 41 additions & 0 deletions .github/actions/setup-poetry-project/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Setup Poetry Project
description: "Set ups Poetry and install the project's dependencies"

inputs:
install_plugin:
description: "Whether the Poetry dynamic versioning plugin should be installed"
required: true
default: "true"


runs:
using: "composite"
steps:
- name: Install Poetry
env:
PIP_PROGRESS_BAR: "off"
PIP_DISABLE_PIP_VERSION_CHECK: "on"
shell: sh
run: |
export POETRY_HOME=$HOME/poetry
python -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.3
$POETRY_HOME/bin/poetry --version
echo "$HOME/poetry/bin" >> $GITHUB_PATH

- name: Add Poetry plugin
env:
PIP_PROGRESS_BAR: "off"
PIP_DISABLE_PIP_VERSION_CHECK: "on"
POETRY_NO_INTERACTION: 1
POETRY_VIRTUALENVS_IN_PROJECT: true
shell: sh
if: ${{ inputs.install_plugin == 'true' }}
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: Install Dependencies
env:
POETRY_NO_INTERACTION: 1
POETRY_VIRTUALENVS_IN_PROJECT: true
shell: sh
run: poetry install --with dev
72 changes: 72 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Perform checks

permissions:
contents: read

on:
push:
branches:
- main
paths-ignore:
- '.github/ISSUE_TEMPLATE/*.yaml'
- '.github/CODEOWNERS'
- '.github/pull_request_template.md'
- 'docs/**/*.md'
- 'mkdocs.yml'
- 'README.md'
pull_request:
branches:
- main
paths-ignore:
- '.github/ISSUE_TEMPLATE/*.yaml'
- '.github/CODEOWNERS'
- '.github/pull_request_template.md'
- 'docs/**/*.md'
- 'mkdocs.yml'
- 'README.md'

env:
PIP_PROGRESS_BAR: "off"
PIP_DISABLE_PIP_VERSION_CHECK: "on"
POETRY_NO_INTERACTION: 1
POETRY_VIRTUALENVS_IN_PROJECT: true

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.11', '3.12' ] # Define Python versions here

container:
image: python:${{ matrix.python-version }}-alpine # Use Python Docker images

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: ./.github/actions/setup-poetry-project
with:
install_plugin: false

- name: Run Pytest
run: |
poetry run pytest
lint:
runs-on: ubuntu-latest
container:
image: python:3.12-alpine

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- uses: ./.github/actions/setup-poetry-project
with:
install_plugin: false

- name: Run ruff check
run: poetry run ruff check

- name: Run ruff format check
run: poetry run ruff format --check .
40 changes: 0 additions & 40 deletions .github/workflows/lint.yaml

This file was deleted.

16 changes: 3 additions & 13 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,9 @@ jobs:
- name: Fix directory permissions
run: chown -R root:root .

- name: Install Poetry
run: |
export POETRY_HOME=$HOME/poetry
python -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.8.3
$POETRY_HOME/bin/poetry --version
echo "$HOME/poetry/bin" >> $GITHUB_PATH

- name: Add Poetry plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: Install Dependencies
run: poetry install --with dev
- uses: ./.github/actions/setup-poetry-project
with:
install_plugin: true

- name: Run Pytest
run: poetry run pytest
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/test.yaml

This file was deleted.