Skip to content

Commit

Permalink
🔧 caching the dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Senja20 committed Apr 25, 2024
1 parent 32ee949 commit fae7ad8
Showing 1 changed file with 36 additions and 17 deletions.
53 changes: 36 additions & 17 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,62 @@ name: Python CI
on: [push, workflow_dispatch]

jobs:
install-dependencies:
setup-and-lint:
runs-on: ubuntu-latest
outputs:
python-version: ${{ steps.setup-python.outputs.python-version }}
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v3

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

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U pylint
pip install -r requirements.txt
lint:
needs: install-dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ needs.install-dependencies.outputs.python-version }}
- name: Analysing the code with pylint
- name: Lint Code
run: pylint $(git ls-files '*.py')

test:
needs: install-dependencies
needs: setup-and-lint
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: ${{ needs.install-dependencies.outputs.python-version }}
- name: Run tests with pytest
python-version: ${{ matrix.python-version }}

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: pytest .

0 comments on commit fae7ad8

Please sign in to comment.