generated from wayfair-incubator/oss-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Basic test and docker compose runner.
- Loading branch information
1 parent
7f15254
commit 8815d16
Showing
3 changed files
with
111 additions
and
2 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,56 @@ | ||
version: '3.4' | ||
|
||
# Defaults | ||
|
||
x-build-args-36: &build_args_36 | ||
IMAGE_TAG: "3.6-buster" | ||
|
||
x-build-args-37: &build_args_37 | ||
IMAGE_TAG: "3.7-buster" | ||
|
||
x-build-args-38: &build_args_38 | ||
IMAGE_TAG: "3.8-buster" | ||
|
||
services: | ||
|
||
# Devbox | ||
|
||
dev: &dev | ||
build: &dev_build | ||
dockerfile: ./docker/Dockerfile | ||
context: . | ||
image: avro-to-markdown-dev | ||
command: /bin/bash | ||
volumes: | ||
- ./:/app | ||
|
||
# Test & Lint suite | ||
|
||
test-36: | ||
<<: *dev | ||
build: | ||
<<: *dev_build | ||
args: | ||
IMAGE: python:3.6-buster | ||
image: avro-to-markdown-test-36 | ||
command: docker/run_tests.sh | ||
|
||
test-37: | ||
<<: *dev | ||
build: | ||
<<: *dev_build | ||
args: | ||
IMAGE: python:3.7-buster | ||
image: avro-to-markdown-test-37 | ||
command: docker/run_tests.sh | ||
|
||
# NOTE: test-38 command includes `--format-code` option that will | ||
# apply changes when the lint suite is run | ||
test-38: | ||
<<: *dev | ||
build: | ||
<<: *dev_build | ||
args: | ||
IMAGE: python:3.8-buster | ||
image: avro-to-markdown-test-38 | ||
command: docker/run_tests.sh --format-code |
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,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
BLACK_ACTION="--check" | ||
ISORT_ACTION="--check-only" | ||
|
||
function usage | ||
{ | ||
echo "usage: run_tests.sh [--format-code]" | ||
echo "" | ||
echo " --format-code : Format the code instead of checking formatting." | ||
exit 1 | ||
} | ||
|
||
while [[ $# -gt 0 ]]; do | ||
arg="$1" | ||
case $arg in | ||
--format-code) | ||
BLACK_ACTION="--quiet" | ||
ISORT_ACTION="" | ||
;; | ||
-h|--help) | ||
usage | ||
;; | ||
"") | ||
# ignore | ||
;; | ||
*) | ||
echo "Unexpected argument: ${arg}" | ||
usage | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
# only generate html locally | ||
pytest tests/unit --cov-report html | ||
|
||
echo "Running MyPy..." | ||
mypy avro_to_markdown tests | ||
|
||
echo "Running black..." | ||
black ${BLACK_ACTION} avro_to_markdown tests | ||
|
||
echo "Running iSort..." | ||
isort ${ISORT_ACTION} avro_to_markdown tests | ||
|
||
echo "Running flake8..." | ||
flake8 avro_to_markdown tests | ||
|
||
echo "Running bandit..." | ||
bandit --ini .bandit --quiet -r avro_to_markdown |
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,5 +1,5 @@ | ||
import avro_to_markdown | ||
|
||
|
||
def test_avro_to_markdown(): | ||
pass | ||
def test_avro_to_markdown_version(): | ||
assert avro_to_markdown.__version__ == "0.1.0" |