Skip to content

Commit

Permalink
Merge pull request #4 from mrom1/development
Browse files Browse the repository at this point in the history
Modernization and Code Quality Update
  • Loading branch information
mrom1 authored Jul 16, 2024
2 parents 2d130d4 + 9766ac5 commit 6af0041
Show file tree
Hide file tree
Showing 173 changed files with 55,138 additions and 11,693 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ statistics = True

max-line-length = 128

exclude = .tox,.venv,.env,venv,env,build,dist,doc
exclude = .tox,.venv,.env,venv,env,build,dist,doc,a2lparser/gen/
79 changes: 16 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,86 +12,39 @@ on:
workflow_dispatch:

jobs:
#################
# Windows Build #
#################
build-Windows:
runs-on: windows-latest
strategy:
matrix:
python-version: [2.7, 3.11]

steps:
# Checkout the repository under $GITHUB_WORKSPACE and install python
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

# Set up virtual environment
- name: Install virtualenv
run: |
python -m pip install --upgrade pip
python -m pip install virtualenv
- name: Create virtual environment
run: |
virtualenv .venv
cmd.exe \c call .venv\Scripts\activate.bat
# Install build dependencies
- name: Install build dependencies
run: |
python -m pip install setuptools wheel
# Building the package
- name: Build package
run: |
python -m pip install .
# Running a2lparser unittests.
- name: Test the package
run: |
a2lparser --testcases
###############
# Linux Build #
###############
build-Linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.11]

steps:
# Checkout the repository under $GITHUB_WORKSPACE and install python
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

python-version: 3.11
# Set up virtual environment
- name: Install virtualenv
- name: Set up virtual environment
run: |
python -m pip install --upgrade pip
python -m pip install virtualenv
- name: Create virtual environment
run: |
virtualenv .venv
source .venv/bin/activate
python -m venv .venv
- name: Activate virtual environment
run: source .venv/bin/activate
# Install build dependencies
- name: Install build dependencies
run: |
python -m pip install setuptools wheel
python -m pip install setuptools wheel build
# Building the package
- name: Build package
run: |
python -m pip install .
# Running a2lparser unittests.
- name: Test the package
python -m build
# Installing package
- name: Install package
run: |
pip install dist/*.whl
# Running a2lparser.
- name: Print package version
run: |
a2lparser --testcases
a2lparser --version || exit 1
39 changes: 39 additions & 0 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: flake8

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
# Checkout the repository under $GITHUB_WORKSPACE and install python
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
# Set up the environment
- name: Create a virtual environment
run: |
python -m pip install --upgrade pip
python -m venv .venv
- name: Activate the virtual environment
run: |
source .venv/bin/activate
- name: Install flake8
run: |
pip install flake8
# Performs a flake8 check on the fritzsniffer package and tests
- name: Run flake8
run: |
flake8 a2lparser/ --config=.flake8
29 changes: 14 additions & 15 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: a2lparser

# Controls when the action will run.
Expand All @@ -15,26 +14,21 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.11]

steps:
# Checkout the repository under $GITHUB_WORKSPACE and install python
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: 3.11

# Set up virtual environment
- name: Install virtualenv
- name: Create virtual environment
run: |
python -m pip install --upgrade pip
python -m pip install virtualenv
- name: Create virtual environment
python -m venv .venv
- name: Activate virtual environment
run: |
virtualenv .venv
source .venv/bin/activate
# Install a2lparser dependencies
Expand All @@ -43,19 +37,24 @@ jobs:
pip install coverage pytest pytest-timeout
pip install -r requirements.txt
# Initialize a2lparser by importing for first time
- name: Initialize a2lparser
run: |
python -c "import a2lparser"
# Run Testcases and generate report
- name: Testcases
run: |
coverage run -m a2lparser.a2lparser --unittests
coverage run --omit="test_a2l_ast.py,tests/*,a2lparser/gen/*" -m pytest -v --timeout=30
coverage report -m
coverage xml
# Upload code coverage report
- name: Upload coverage to Codecov
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: false
verbose: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ ENV/
env.bak/
venv.bak/

# Tests output
testfiles/temp_dir_output_*/

# Spyder project settings
.spyderproject
.spyproject
Expand Down
Loading

0 comments on commit 6af0041

Please sign in to comment.