Skip to content

Commit

Permalink
Updated pytest job:
Browse files Browse the repository at this point in the history
- to work with hatch
- to use latest version of actions
  • Loading branch information
Yiannis128 committed Nov 4, 2024
1 parent 090cdf7 commit 9a85a4a
Showing 1 changed file with 48 additions and 12 deletions.
60 changes: 48 additions & 12 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,46 @@ name: Checking
on: push

jobs:
setup-requirements:
name: Get Requirements
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v5.3.0
with:
python-version: "3.11"

- name: Check out repository code
uses: actions/checkout@v4.2.2

- name: Install Hatch
run: python -m pip install --upgrade hatch

- name: Generate Requirements
run: python -m hatch dep show requirements > requirements.txt

- name: Upload Requirements
uses: actions/upload-artifact@v4.4.3
with:
name: requirements
path: requirements.txt


pylint:
name: PyLint
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4.2.2

# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5.3.0
with:
python-version: "3.11"

Expand All @@ -31,33 +59,41 @@ jobs:
test:
name: PyTest
needs: setup-requirements
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4.2.2

# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5.3.0
with:
python-version: "3.11"

- name: Install pipenv
run: |
python -m pip install --upgrade pipenv wheel
- id: cache-pipenv
uses: actions/cache@v1.2.1
- name: Download Requirements
uses: actions/download-artifact@v4.1.8
with:
name: requirements
path: .

- name: Install Environment
run: python -m pip install --upgrade pipenv wheel

- name: Cache Pipenv
id: cache-pipenv
uses: actions/cache@v4.1.2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}

- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install --deploy --dev
pipenv install -r requirements.txt
pipenv lock
- name: Run test suite
run: |
pipenv run pytest -v
run: pipenv run pytest -v

0 comments on commit 9a85a4a

Please sign in to comment.