Skip to content

Commit

Permalink
👷 Update pylint.yml to include installation of dependencies from requ…
Browse files Browse the repository at this point in the history
…irements.txt
  • Loading branch information
Senja20 committed Apr 25, 2024
1 parent 9c365b1 commit 732e222
Showing 1 changed file with 25 additions and 32 deletions.
57 changes: 25 additions & 32 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ name: Python CI
on: [push, workflow_dispatch]

jobs:
install:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3

Expand All @@ -13,68 +16,58 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
- name: Set up cache
uses: actions/cache@v2
id: cache-virtualenv
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
path: ~/.venv
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}

- name: Install dependencies
if: steps.cache-virtualenv.outputs.cache-hit != 'true'
run: |
python -m venv ~/.venv
source ~/.venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -U pylint pytest
lint:
needs: install
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
- name: Restore Python virtual environment
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
path: ~/.venv
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}

- name: Lint Code
run: pylint $(git ls-files '*.py')
run: |
source ~/.venv/bin/activate
pylint $(git ls-files '*.py')
test:
needs: install
needs: build
runs-on: ubuntu-latest
env:
ROBOFLOW_API_KEY: ${{ secrets.ROBOFLOW_API_KEY }}
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip
- name: Restore Python virtual environment
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
path: ~/.venv
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}

- name: Run tests
run: pytest .
run: |
source ~/.venv/bin/activate
pytest .

0 comments on commit 732e222

Please sign in to comment.