Skip to content

Commit

Permalink
Updated workflow
Browse files Browse the repository at this point in the history
* to include builds
* fixed pylint
  • Loading branch information
Yiannis128 committed Nov 8, 2024
1 parent c1c45c9 commit 27d3d15
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 29 deletions.
153 changes: 125 additions & 28 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Checking
name: Development
on: push

jobs:
Expand All @@ -20,19 +20,31 @@ jobs:
- name: Install Hatch
run: python -m pip install --upgrade hatch

- 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
~/.local/share/hatch
key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }}

- 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


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

steps:
Expand All @@ -45,17 +57,20 @@ jobs:
with:
python-version: "3.12.0"

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

- name: Install dependencies
run: |
pipenv install --deploy --dev
- name: Cache Hatch environment
uses: actions/[email protected]
with:
path: |
~/.cache/hatch
~/.local/share/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
Expand All @@ -73,27 +88,109 @@ jobs:
with:
python-version: "3.12.0"

- name: Download Requirements
uses: actions/[email protected]
- name: Install Hatch
if: steps.cache-hatch.outputs.cache-hit != 'true'
run: python -m pip install --upgrade hatch

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

- name: Run test suite
run: hatch run pytest

# incremenet_version:
# name: Increment Version
# runs-on: ubuntu-latest
# needs: setup-requirements
# timeout-minutes: 10
# # Configure permissions for git push
# permissions:
# contents: write

# steps:
# - name: Check out repository code
# uses: actions/[email protected]
# with:
# persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
# fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.

# # Setup Python (faster than using Python container)
# - name: Setup Python
# uses: actions/[email protected]
# with:
# python-version: "3.12.0"

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

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

# - name: Invrement Version
# run: hatch version dev

# - name: Configure Git
# run: |
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git config --global user.name "github-actions[bot]"

# # Add and commit without changing message
# - name: Git Add
# run: |
# git add esbmc_ai/__about__.py
# git commit -m "Increment version"

# - name: GitHub Push
# if: github.ref != 'refs/heads/master'
# uses: ad-m/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}

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

- name: Install Environment
run: python -m pip install --upgrade pipenv wheel
steps:
- name: Check out repository code
uses: actions/[email protected]

- name: Cache Pipenv
id: cache-pipenv
uses: actions/[email protected]
# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/[email protected]
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
python-version: "3.12.0"

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

- name: Run test suite
run: pipenv run pytest -v
- name: Cache Hatch environment
uses: actions/[email protected]
with:
path: |
~/.cache/hatch
~/.local/share/hatch
key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }}

- name: Hatch build
run: hatch build

- name: Upload build files
uses: actions/[email protected]
with:
name: build
path: dist
2 changes: 1 addition & 1 deletion esbmc_ai/__about__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Author: Yiannis Charalambous

__version__ = "v0.6.0"
__version__ = "v0.6.0.dev1"
__author__: str = "Yiannis Charalambous"

0 comments on commit 27d3d15

Please sign in to comment.