Skip to content

Commit

Permalink
Setup reusable poetry workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
drmikehenry committed May 6, 2024
1 parent 4a2c63c commit 29ee901
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 22 deletions.
43 changes: 43 additions & 0 deletions .github/actions/setup-poetry-nox/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: setup-poetry-nox
description: Setup Python, Poetry, and Nox

inputs:
python-version:
description: Python version
required: false
default: "3.11"
poetry-version:
description: Poetry version
required: false
default: "1.8.2"
poetry-plugin-export-version:
description: poetry-plugin-export version
required: false
default: "1.7.1"

runs:
using: "composite"
steps:
- name: Install poetry
run: pipx install "poetry==${{ inputs.poetry-version }}"
shell: bash

- name: Install poetry-plugin-export
run: pipx inject poetry
"poetry-plugin-export==${{ inputs.poetry-plugin-export-version }}"
shell: bash

- name: Disable poetry warning about poetry-plugin-export
run: poetry config warnings.export false
shell: bash

- name: Set up Python "${{ inputs.python-version }}"
uses: actions/setup-python@v5
with:
python-version: "${{ inputs.python-version }}"
# https://github.com/actions/setup-python#caching-packages-dependencies
cache: poetry

- name: Install Nox
run: poetry install --only nox
shell: bash
24 changes: 2 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,17 @@ name: build

on: [push]

env:
PYTHON_VERSION: "3.11"
POETRY_VERSION: "1.8.2"
POETRY_PLUGIN_EXPORT_VERSION: "1.7.1"

jobs:
build-executable:
strategy:
matrix:
os: [windows-latest, macos-latest]
runs-on: "${{ matrix.os }}"

steps:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install "poetry==${{ env.POETRY_VERSION }}"
- name: Install poetry-plugin-export
run: pipx inject poetry
"poetry-plugin-export==${{ env.POETRY_PLUGIN_EXPORT_VERSION }}"
- name: Disable poetry warning about poetry-plugin-export
run: poetry config warnings.export false

- name: Set up Python "${{ env.PYTHON_VERSION }}"
uses: actions/setup-python@v5
with:
python-version: "${{ env.PYTHON_VERSION }}"
# https://github.com/actions/setup-python#caching-packages-dependencies
cache: poetry

- name: Install Nox
run: poetry install --only nox
- uses: ./.github/actions/setup-poetry-nox

- name: Build `romt` executable
run: poetry run nox -s build
Expand Down

0 comments on commit 29ee901

Please sign in to comment.