-
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.
Merge pull request #4 from Project-Resilience/actions
Add Github Actions
- Loading branch information
Showing
7 changed files
with
109 additions
and
1 deletion.
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,2 @@ | ||
[flake8] | ||
max-line-length = 120 |
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,31 @@ | ||
# This runs the unit tests for the ELUC use case | ||
|
||
name: SDK Workflow | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with PyLint | ||
run: pylint ./src/prsdk | ||
- name: Lint with Flake8 | ||
run: flake8 ./src/prsdk | ||
- name: Run unit tests | ||
run: python -m unittest | ||
|
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,45 @@ | ||
# Note: | ||
# This is a minimal subset of the options available for Pylint. | ||
# To generate an exhaustive configuration file based on current settings and defaults, run the following command | ||
# in the project directory: | ||
# | ||
# pylint --generate-rcfile > ~/.pylintrc | ||
|
||
[MASTER] | ||
|
||
# Add files or directories to the blacklist. They should be base names, not | ||
# paths. | ||
ignore= | ||
|
||
# Directories from top level that should be ignored. | ||
ignore-paths= | ||
|
||
# Add files or directories matching the regex patterns to the blacklist. The | ||
# regex matches against base names, not paths. | ||
ignore-patterns= | ||
|
||
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the | ||
# number of processors available to use. | ||
jobs=0 | ||
|
||
# Set reasonable line length | ||
max-line-length=120 | ||
|
||
# When enabled, pylint would attempt to guess common misconfiguration and emit | ||
# user-friendly hints instead of false-positive error messages. | ||
suggestion-mode=yes | ||
|
||
# Disable the message, report, category or checker with the given id(s). You | ||
# can either give multiple identifiers separated by comma (,) or put this | ||
# option multiple times (only on the command line, not in the configuration | ||
# file where it should appear only once).You can also use "--disable=all" to | ||
# disable everything first and then reenable specific checks. For example, if | ||
# you want to run only the similarities checker, you can use "--disable=all | ||
# --enable=similarities". If you want to run only the classes checker, but have | ||
# no Warning level messages displayed, use"--disable=all --enable=classes | ||
# --disable=W" | ||
|
||
disable= | ||
|
||
# Default set of "always good" names | ||
good-names=_ |
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,2 @@ | ||
flake8==7.1.0 | ||
pylint==3.2.6 |
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 |
---|---|---|
@@ -1,2 +1,10 @@ | ||
""" | ||
A dummy module to test the package. | ||
""" | ||
|
||
|
||
def compute_percent_change(x: int) -> float: | ||
return x / 100 | ||
""" | ||
A function that divides an integer by 100 and returns a float. | ||
""" | ||
return x / 100 |
File renamed without changes.
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,20 @@ | ||
""" | ||
Dummy test for the dummy module. | ||
""" | ||
import unittest | ||
|
||
from src.prsdk.dummy import compute_percent_change | ||
|
||
|
||
class TestDummy(unittest.TestCase): | ||
""" | ||
Tests for the dummy module. | ||
""" | ||
def test_pct_change(self): | ||
""" | ||
Tests the compute_percent_change function. | ||
It should return the input divided by 100. | ||
""" | ||
self.assertEqual(compute_percent_change(100), 1.0) | ||
self.assertEqual(compute_percent_change(50), 0.5) | ||
self.assertEqual(compute_percent_change(0), 0.0) |