diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 4f198d6..24eba12 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -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 .