Skip to content

Commit

Permalink
ci: added python linting to enforce code quality; issue mit-dci#264
Browse files Browse the repository at this point in the history
This commit made with the assistance of github copilot

Signed-off-by: Morgan Rockett <[email protected]>
  • Loading branch information
rockett-m committed Jun 27, 2024
1 parent 541f006 commit 80a3876
Show file tree
Hide file tree
Showing 12 changed files with 732 additions and 29 deletions.
24 changes: 24 additions & 0 deletions .code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"pylint.path": ["${workspaceFolder}/.py_venv/bin/pylint"],
"python.pythonPath": "${workspaceFolder}/.py_venv/bin/python3",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.pylintArgs": [
"--rcfile=${workspaceFolder}/.pylintrc"
],
// recursive for '*.py' files in dirs: scripts, src, tests, tools
"files.exclude": {
"*.py": true,
"scripts/**/*.py": false,
"src/**/*.py": false,
"tests/**/*.py": false,
"tools/**/*.py": false
},
}
}
39 changes: 31 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
jobs:
build-release:
name: Build Release Candidate
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
BUILD_RELEASE: 1
steps:
Expand All @@ -30,7 +30,7 @@ jobs:
- name: Setup Local Dependencies
run: ./scripts/setup-dependencies.sh
- name: Build
run: scripts/build.sh
run: ./scripts/build.sh
lint:
name: Lint
runs-on: ubuntu-20.04
Expand All @@ -43,12 +43,34 @@ jobs:
- name: Setup Local Dependencies
run: ./scripts/setup-dependencies.sh
- name: Build
run: scripts/build.sh
run: ./scripts/build.sh
- name: Lint
run: scripts/lint.sh
run: ./scripts/lint.sh
pylint:
name: Pylint
runs-on: ubuntu-22.04
continue-on-error: true
timeout-minutes: 10
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Setup Build Env
run: sudo ./scripts/install-build-tools.sh
- name: Lint with Pylint
run: |
MIN_CODE_QUALITY=5.0
./scripts/pylint.sh $MIN_CODE_QUALITY
unit-and-integration-test:
name: Unit and Integration Tests
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
Expand All @@ -59,9 +81,9 @@ jobs:
- name: Setup Local Dependencies
run: ./scripts/setup-dependencies.sh
- name: Build
run: scripts/build.sh
run: ./scripts/build.sh
- name: Run Unit Tests
run: scripts/test.sh
run: ./scripts/test.sh
- name: Shorten SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
Expand All @@ -76,7 +98,7 @@ jobs:
retention-days: 7
doxygen:
name: doxygen
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -94,3 +116,4 @@ jobs:
name: OpenCBDC Transaction Processor docs for ${{ steps.vars.outputs.sha_short }}
path: ./doxygen_generated/html/*
retention-days: 7

1 change: 0 additions & 1 deletion .github/workflows/docker-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
with:
files: |
Dockerfile
**/configure.sh
########################
# Build Base #
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ CMakeCache.txt
*.o-*
*.a
*.log
*.tgz

leveldb*/
NuRaft*/
Expand All @@ -54,7 +55,6 @@ plots/
blocks.dat
test_db


# System files
.DS_Store
.dirstamp
Expand All @@ -72,3 +72,6 @@ build/tests

# E2E Test results
testruns/

# Virtualenv
.py_venv/
Loading

0 comments on commit 80a3876

Please sign in to comment.