Skip to content

Commit

Permalink
add github action
Browse files Browse the repository at this point in the history
  • Loading branch information
VSumanth99 committed Jun 11, 2024
1 parent c7b5b69 commit 184e007
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/cloc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Count Lines of Code

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

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:

# This workflow contains a single job called "build"
cloc:

# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repo
uses: actions/checkout@v3

# Runs djdefi/cloc-action
- name: Install and run cloc
run: |
sudo apt-get install cloc
cloc src --csv --quiet --report-file=cloc_report.csv
- name: Read CSV
id: csv
uses: juliangruber/read-file-action@v1
with:
path: ./cloc_report.csv

- name: Create MD
uses: petems/csv-to-md-table-action@master
id: csv-table-output
with:
csvinput: ${{ steps.csv.outputs.content }}

- name: Write file
uses: "DamianReeves/write-file-action@master"
with:
path: ./cloc_report.md
write-mode: overwrite
contents: |
${{steps.csv-table-output.outputs.markdown-table}}
- name: PR comment with file
uses: thollander/actions-comment-pull-request@v2
with:
filePath: ./cloc_report.md
23 changes: 23 additions & 0 deletions .github/workflows/pylinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Checks python code for linting

on: [pull_request]

jobs:

# This workflow contains a single job called "test"
check_pylint:

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install flake8
run: pip install flake8
- name: Python Linter
uses: py-actions/flake8@v2
with:
ignore: "E402,E731,F541,W291,E122,E127,F401,E266,E241,C901,E741,W293,F811,W503,E203,F403,F405,B007"
max-line-length: "150"
path: "src"
plugins: "flake8-bugbear==22.1.11"
24 changes: 24 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Runs pytests and generates coverage report

on: [pull_request]

jobs:

# This workflow contains a single job called "test"
run_pytest:

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Install dependencies
run: |
pip install flake8 pytest pytest-cov
- name: Build coverage file
run: |
pytest --cache-clear --cov=src tests/ > pytest-coverage.txt
- name: Comment coverage
uses: coroo/[email protected]

0 comments on commit 184e007

Please sign in to comment.