-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7b5b69
commit 184e007
Showing
3 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |