-
-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add lint and unit test workflow checks for pull requests (#152)
- Loading branch information
1 parent
333a9f2
commit d2675ec
Showing
26 changed files
with
1,442 additions
and
392 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
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
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
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
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,24 +1,52 @@ | ||
provider "aws" { | ||
region = local.region | ||
} | ||
|
||
locals { | ||
name = "ex-${replace(basename(path.cwd), "_", "-")}" | ||
region = "eu-west-1" | ||
tags = { | ||
Owner = "user" | ||
Environment = "dev" | ||
} | ||
} | ||
|
||
resource "aws_sns_topic" "my_sns" { | ||
name = "my-sns" | ||
################################################################################ | ||
# Supporting Resources | ||
################################################################################ | ||
|
||
resource "aws_sns_topic" "example" { | ||
name = local.name | ||
tags = local.tags | ||
} | ||
|
||
################################################################################ | ||
# Slack Notify Module | ||
################################################################################ | ||
|
||
module "notify_slack" { | ||
source = "../../" | ||
|
||
sns_topic_name = aws_sns_topic.my_sns.name | ||
sns_topic_name = aws_sns_topic.example.name | ||
create_sns_topic = false | ||
|
||
slack_webhook_url = "https://hooks.slack.com/services/AAA/BBB/CCC" | ||
slack_channel = "aws-notification" | ||
slack_username = "reporter" | ||
|
||
tags = { | ||
Name = "notify-slack-simple" | ||
} | ||
tags = local.tags | ||
} | ||
|
||
################################################################################ | ||
# Integration Testing Support | ||
# This populates a file that is gitignored to aid in executing the integration tests locally | ||
################################################################################ | ||
|
||
depends_on = [aws_sns_topic.my_sns] | ||
resource "local_file" "integration_testing" { | ||
filename = "${path.module}/../../functions/.int.env" | ||
content = <<-EOT | ||
REGION=${local.region} | ||
LAMBDA_FUNCTION_NAME=${module.notify_slack.notify_slack_lambda_function_name} | ||
SNS_TOPIC_ARN=${aws_sns_topic.example.arn} | ||
EOT | ||
} |
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
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,10 @@ | ||
[flake8] | ||
max-complexity = 10 | ||
max-line-length = 120 | ||
exclude = | ||
.pytest_cache | ||
__pycache__/ | ||
*tests/ | ||
events/ | ||
messages/ | ||
snapshots/ |
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,58 @@ | ||
[tool.black] | ||
line-length = 120 | ||
target-version = ['py38'] | ||
include = '\.pyi?$' | ||
verbose = true | ||
exclude = ''' | ||
/( | ||
| \.git | ||
| \.mypy_cache | ||
| dist | ||
| \.pants\.d | ||
| virtualenvs | ||
| \.venv | ||
| _build | ||
| build | ||
| dist | ||
| snapshots | ||
)/ | ||
''' | ||
|
||
[tool.isort] | ||
line_length = 120 | ||
skip = '.terraform' | ||
sections = 'FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER' | ||
known_third_party = 'aws_lambda_powertools,boto3,botocore,pytest,snapshottest' | ||
known_first_party = 'events,notify_slack' | ||
indent = ' ' | ||
|
||
[tool.mypy] | ||
namespace_packages = true | ||
explicit_package_bases = true | ||
|
||
no_implicit_optional = true | ||
implicit_reexport = false | ||
strict_equality = true | ||
|
||
warn_unused_configs = true | ||
warn_unused_ignores = true | ||
warn_return_any = true | ||
warn_redundant_casts = true | ||
warn_unreachable = true | ||
|
||
pretty = true | ||
show_column_numbers = true | ||
show_error_context = true | ||
show_error_codes = true | ||
show_traceback = true | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
omit = ["*_test.py", "tests/*", "events/*", "messages/*", "snapshots/*", "venv/*", ".mypy_cache/*", ".pytest_cache/*"] | ||
|
||
[tool.coverage.report] | ||
show_missing = true | ||
skip_covered = true | ||
skip_empty = true | ||
sort = "-Miss" | ||
fail_under = 75 |
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,36 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
|
||
[dev-packages] | ||
boto3 = "~=1.20" | ||
botocore = "~=1.23" | ||
black = "*" | ||
flake8 = "*" | ||
isort = "*" | ||
mypy = "*" | ||
pytest = "*" | ||
pytest-cov = "*" | ||
radon = "*" | ||
snapshottest = "~=0.6" | ||
|
||
[requires] | ||
python_version = "3.8" | ||
|
||
[scripts] | ||
test = "python3 -m pytest --cov --cov-report=term" | ||
'test:updatesnapshots' = "python3 -m pytest --snapshot-update" | ||
cover = "python3 -m coverage html" | ||
complexity = "python3 -m radon cc notify_slack.py -a" | ||
halstead = "python3 -m radon hal notify_slack.py" | ||
typecheck = "python3 -m mypy . --ignore-missing-imports" | ||
lint = "python3 -m flake8 . --count --statistics --benchmark --exit-zero --config=.flake8" | ||
'lint:ci' = "python3 -m flake8 . --config=.flake8" | ||
imports = "python3 -m isort . --profile black" | ||
format = "python3 -m black ." | ||
|
||
[pipenv] | ||
allow_prereleases = true |
Oops, something went wrong.