Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General Improvements #157

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 132 additions & 27 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/cache@v4.1.2
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/upload-artifact@v4.4.3
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,28 @@ 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/cache@v4.1.2
with:
path: |
~/.cache/hatch
~/.local/share/hatch
key: ${{ runner.os }}-hatch-${{ env.HATCH_DEP_HASH }}

# Don't fail just output, since we want the score to be above 9 not 10.0
# Don’t let the Perfect be the Enemy of the Good
- name: Pylint on esbmc_ai
run: hatch run pylint esbmc_ai || true

# Check if pass, the test command only takes integers so truncate decimals
- name: Check If Pass (90%)
run: |
pipenv run pylint esbmc_ai
SCORE="$(sed -n '$s/[^0-9]*\([0-9.]*\).*/\1/p' <<< "$(hatch run pylint esbmc_ai)")"
test "${SCORE%.*}" -ge 9

test:
name: PyTest
Expand All @@ -73,27 +96,109 @@ jobs:
with:
python-version: "3.12.0"

- name: Download Requirements
uses: actions/download-artifact@v4.1.8
- name: Install Hatch
if: steps.cache-hatch.outputs.cache-hit != 'true'
run: python -m pip install --upgrade hatch

- name: Cache Hatch environment
uses: actions/cache@v4.1.2
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/checkout@v4.2.2
# 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/setup-python@v5.3.0
# 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/cache@v4.1.2
# 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/github-push-action@v0.8.0
# 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/checkout@v4.2.2

- name: Cache Pipenv
id: cache-pipenv
uses: actions/cache@v4.1.2
# Setup Python (faster than using Python container)
- name: Setup Python
uses: actions/setup-python@v5.3.0
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/cache@v4.1.2
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/upload-artifact@v4.4.3
with:
name: build
path: dist
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ config_dev.toml

# Proprietary source code samples.
uav_test.sh

addons/
1 change: 1 addition & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"-c",
"fix-code",
"-v",
"-r",
"${file}"
]
},
Expand Down
7 changes: 5 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ allow_successful = false
loading_hints = true
source_code_format = "full"

[esbmc]
[verifier]
name = "esbmc"

[verifier.esbmc]
path = "~/.local/bin/esbmc"
params = [
"--interval-analysis",
"--memory-leak-check",
"--goto-unwind",
"--unlimited-goto-unwind",
"--k-induction",
Expand All @@ -18,7 +22,6 @@ params = [
"2",
"--floatbv",
"--unlimited-k-steps",
"--compact-trace",
"--context-bound",
"2",
]
Expand Down
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.dev2"
__author__: str = "Yiannis Charalambous"
Loading
Loading