Skip to content

Commit

Permalink
Update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiannis128 committed Nov 7, 2024
1 parent 416a7aa commit 9c8bf5d
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,36 @@ jobs:
- name: Check out repository code
uses: actions/[email protected]

- name: Get Hatch Dependency Hash
run: echo "HATCH_DEP_HASH=$(hatch dep hash)" >> $GITHUB_ENV

- name: Cache Hatch environment
uses: actions/[email protected]
with:
path: ~/.cache/hatch
key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }}

- name: Install Hatch
if: steps.cache-hatch.outputs.cache-hit != 'true'
run: python -m pip install --upgrade hatch

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

# Upload requirements to have them
- name: Upload Requirements
uses: actions/[email protected]
with:
name: requirements
path: requirements.txt

setup-pipenv:
name: Setup Environment
needs: setup-requirements
build:
name: Build
runs-on: ubuntu-latest
needs: setup-requirements
timeout-minutes: 10

steps:
seteps:
- name: Check out repository code
uses: actions/[email protected]

Expand All @@ -44,33 +55,26 @@ jobs:
uses: actions/[email protected]
with:
python-version: "3.12.0"

- name: Download Requirements
uses: actions/[email protected]
with:
name: requirements
path: .

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

- name: Cache Pipenv
id: cache-pipenv
- name: Cache Hatch environment
uses: actions/[email protected]
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
path: ~/.cache/hatch
key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }}

- name: Install dependencies
if: steps.cache-pipenv.outputs.cache-hit != 'true'
run: |
pipenv install -r requirements.txt
pipenv lock
- name: Hatch build
run: hatch build

- name: Upload build files
uses: actions/[email protected]
with:
name: build
path: dist

pylint:
name: PyLint
runs-on: ubuntu-latest
needs: setup-pipenv
needs: setup-requirements
timeout-minutes: 10

steps:
Expand All @@ -83,20 +87,18 @@ jobs:
with:
python-version: "3.12.0"

- name: Cache Pipenv
id: cache-pipenv
- name: Cache Hatch environment
uses: actions/[email protected]
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
path: ~/.cache/hatch
key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }}

- name: Pylint on esbmc_ai
run: |
pipenv run pylint esbmc_ai
run: hatch run pylint esbmc_ai

test:
name: PyTest
needs: setup-pipenv
needs: setup-requirements
runs-on: ubuntu-latest
timeout-minutes: 10

Expand All @@ -110,12 +112,12 @@ jobs:
with:
python-version: "3.12.0"

- name: Cache Pipenv
id: cache-pipenv
- name: Cache Hatch environment
uses: actions/[email protected]
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
path: ~/.cache/hatch
key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }}

- name: Run test suite
run: pipenv run pytest -v
run: hatch run pytest

0 comments on commit 9c8bf5d

Please sign in to comment.