Skip to content

Commit

Permalink
Update lint-and-test.yml
Browse files Browse the repository at this point in the history
flake8 was installed in the test job, but the flake8 command was being run in the lint job. Fixed.
  • Loading branch information
ScotterMonk authored Oct 14, 2024
1 parent a70064b commit f5afc87
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Lint and Test

on:
push:
branches:
Expand All @@ -24,27 +23,33 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

run: |
poetry install --no-interaction --no-root
if [ $? -ne 0 ]; then
echo "Poetry install failed. Attempting to update lock file and retry..."
poetry lock --no-update
poetry install --no-interaction --no-root
fi
poetry add flake8 --dev
if [ $? -ne 0 ]; then
echo "Failed to add flake8. Attempting to update lock file and retry..."
poetry lock --no-update
poetry add flake8 --dev
fi
- name: Run pre-commit
continue-on-error: true
run: poetry run pre-commit run --all-files

- name: Run flake8
run: poetry run flake8 app tests

Expand All @@ -54,19 +59,16 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install dependencies
run: |
poetry install --no-interaction --no-root
Expand All @@ -75,11 +77,5 @@ jobs:
poetry lock --no-update
poetry install --no-interaction --no-root
fi
poetry add flake8 --dev
if [ $? -ne 0 ]; then
echo "Failed to add flake8. Attempting to update lock file and retry..."
poetry lock --no-update
poetry add flake8 --dev
fi
- name: Run tests
run: poetry run pytest tests

0 comments on commit f5afc87

Please sign in to comment.