Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BGDIINF_SB-1181: Added codebuild test report #9

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@ local/
# mypy
.mypy_cache/

# unittest report
nose2-junit.xml

# PyCharm generated files
*.idea
*/bin/
*/lib64
*/pip-selfcheck.json
*/pyvenv.cfg

# Visual Studio generated files
.vscode/

#vim
*.swp

# git generate files
*.orig

# visual studio code config
.vscode
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CURRENT_DIR := $(shell pwd)
INSTALL_DIR := $(CURRENT_DIR)/.venv
PYTHON_LOCAL_DIR := $(CURRENT_DIR)/build/local
PYTHON_FILES := $(shell find ./* -type f -name "*.py" -print)
TEST_REPORT_DIR := $(CURRENT_DIR)/tests/report

#FIXME: put this variable in config file
PYTHON_VERSION := 3.7.4
Expand Down Expand Up @@ -93,7 +94,8 @@ lint: .venv/build.timestamp

.PHONY: test
test: .venv/build.timestamp
$(NOSE_CMD) -s tests/
mkdir -p $(TEST_REPORT_DIR)
$(NOSE_CMD) --plugin nose2.plugins.junitxml --junit-xml --junit-xml-path $(TEST_REPORT_DIR)/nose2-junit.xml -s tests/

# Serve targets. Using these will run the application on your local machine. You can either serve with a wsgi front (like it would be within the container), or without.
.PHONY: serve
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# service-name

| Branch | Status |
|--------|-----------|
| develop | ![Build Status](<codebuild-badge>) |
| master | ![Build Status](<codebuild-badge>) |

## Summary of the project

A simple description of the service should go here
Expand Down
11 changes: 10 additions & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ env:
SHELL: /bin/bash
AWS_DEFAULT_REGION: eu-central-1
USER: "aws_code_build"
TEST_REPORT_DIR: "./tests/report"
TEST_REPORT_FILE: "nose2-junit.xml"
parameter-store:
CI_DOCKERHUB_USER: "/dockerhub/user"
CI_DOCKERHUB_PASSWORD: "/dockerhub/password"
Expand Down Expand Up @@ -34,6 +36,13 @@ phases:
post_build:
commands:
- .venv/bin/pylint $(find ./* -type f -name "*.py" -print)
- .venv/bin/nose2 -s tests/
- mkdir -p ${TEST_REPORT_DIR}
- .venv/bin/nose2 --plugin nose2.plugins.junitxml --junit-xml --junit-xml-path ${TEST_REPORT_DIR}/${TEST_REPORT_FILE} -s tests/
- docker push ${IMAGE_BASE_NAME}:${IMAGE_TAG}

reports:
nose2_reports:
files:
- ${TEST_REPORT_FILE}
base-directory: ${TEST_REPORT_DIR}
file-format: JunitXml