Skip to content

Commit

Permalink
Add option to build using poetry instead of pipenv (#15)
Browse files Browse the repository at this point in the history
* Add option to build using poetry instead of pipenv

* Use install-poetry action

* 1 line
  • Loading branch information
Clue88 authored Jan 14, 2024
1 parent 4b901c4 commit f98f776
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions django-check/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ inputs:
required: False
description: "whether to use black for linting"
default: "true"
# Dependency manager config
dependencyManager:
required: False
description: "Dependency manager to use (e.g., pipenv, poetry)"
default: "pipenv"

runs:
using: "composite"
Expand All @@ -34,30 +39,39 @@ runs:
with:
path: ~/.local/share/virtualenvs
key: v0-${{ hashFiles('${{ inputs.path }}/Pipfile.lock') }}
- name: Install Dependencies
- name: Install Dependencies (pipenv)
shell: bash
continue-on-error: true
run: |-
cd ${{ inputs.path }}
pip install pipenv
pipenv install --deploy --dev
if: ${{ inputs.dependencyManager == "pipenv" }}
- name: Install Poetry
uses: snok/install-poetry@v1
if: ${{ inputs.dependencyManager == "poetry" }}
- name: Install Dependencies (poetry)
shell: bash
continue-on-error: true
run: poetry install --no-root
if: ${{ inputs.dependencyManager == "poetry" }}
- name: Test (run in parallel)
shell: bash
run: |-
cd ${{ inputs.path }}
pipenv run coverage run --concurrency=multiprocessing manage.py test --settings=${{ inputs.projectName }}.settings.ci --parallel
pipenv run coverage combine
${{ inputs.dependencyManager }} run coverage run --concurrency=multiprocessing manage.py test --settings=${{ inputs.projectName }}.settings.ci --parallel
${{ inputs.dependencyManager }} run coverage combine
- name: Lint (flake8)
shell: bash
run: |-
cd ${{ inputs.path }}
pipenv run flake8 .
${{ inputs.dependencyManager }} run flake8 .
if: ${{ inputs.flake }}
- name: Lint (black)
shell: bash
run: |-
cd ${{ inputs.path }}
pipenv run black --check . || pipenv run black --diff .
${{ inputs.dependencyManager }} run black --check . || ${{ inputs.dependencyManager }} run black --diff .
if: ${{ inputs.black }}
container:
image: python:${{ inputs.pythonVersion }}

0 comments on commit f98f776

Please sign in to comment.