-
Notifications
You must be signed in to change notification settings - Fork 2
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 #25 from fecgov/release/sprint-2
Release/sprint 2
- Loading branch information
Showing
12 changed files
with
478 additions
and
192 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,40 @@ | ||
# CircleCI Configuration | ||
## Environment Variables | ||
There is a minimum acceptable percentage for unit test code coverage that defaults to 85%. | ||
You can modify this minimum by setting the MIN_COVERAGE_PERCENT environment variable to a | ||
different value. | ||
|
||
# Using CircleCI local CLI | ||
|
||
## Install circleci local | ||
Install on Linux or Mac with: | ||
``` | ||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash | ||
``` | ||
|
||
Details and instructions for other platforms in the [CircleCI Docs](https://circleci.com/docs/2.0/local-cli/) | ||
|
||
## Validate the config.yml | ||
Run this from the top level of the repo: | ||
``` | ||
circleci config validate | ||
``` | ||
|
||
## Run the CircleCI Job locally | ||
You can run a CircleCI job locally and avoid the change/commit/wait loop you need to | ||
do if you want to actually run the changes on Circle. | ||
This can save a lot of time when trying to debug an issue in CI. | ||
``` | ||
circleci local execute --job JOB_NAME | ||
``` | ||
|
||
## Environment Variables | ||
To run in the local CircleCI with specific environment variables, use the following pattern: | ||
|
||
``` | ||
circleci local execute -e MIN_COVERAGE_PERCENT=15 --job unit-test | ||
``` | ||
|
||
## CircleCI configuration | ||
To get CircleCI to run tests, you have to configure the | ||
project in the Circle web application https://app.circleci.com/ |
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,100 @@ | ||
# See: https://circleci.com/docs/2.0/configuration-reference | ||
version: 2.1 | ||
|
||
# See: https://circleci.com/docs/2.0/orb-intro/ | ||
orbs: | ||
# See the orb documentation here: https://circleci.com/developer/orbs/orb/circleci/python | ||
python: circleci/[email protected] | ||
|
||
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs | ||
jobs: | ||
unit-test: | ||
# These next lines defines a Docker executors: https://circleci.com/docs/2.0/executor-types/ | ||
# A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python | ||
docker: | ||
- image: cimg/python:3.8 | ||
|
||
steps: | ||
- checkout | ||
|
||
- python/install-packages: | ||
pkg-manager: pip | ||
pip-dependency-file: requirements-test.txt | ||
|
||
- run: | ||
name: Run tests, save a coverage report, and save coverage percentage | ||
command: | | ||
pytest --cov=. --cov-report=html --cov-report=term | tee pytest.out | ||
export NEW_PERCENT=$(cat pytest.out | grep TOTAL | awk '{print $4}' | grep -oE "[0-9]+" ) | ||
echo ${NEW_PERCENT} > htmlcov/total_percent.txt | ||
echo Total code coverage percentage is ${NEW_PERCENT}% | ||
- store_artifacts: | ||
path: htmlcov | ||
|
||
- run: | ||
name: Compare the actual code coverage to the minimum target coverage | ||
command: | | ||
export NEW_PERCENT=$(cat htmlcov/total_percent.txt) | ||
echo Comparing the current code coverage percentage of ${NEW_PERCENT}% to the target of ${MIN_COVERAGE_PERCENT-85}% | ||
if [ "${NEW_PERCENT}" -lt ${MIN_COVERAGE_PERCENT-85} ]; then | ||
echo The total code coverage percentage of ${NEW_PERCENT}% is below the minimum of ${MIN_COVERAGE_PERCENT-85}% | ||
echo If you would like to modify the minimum coverage, set the MIN_COVERAGE_PERCENT environment variable | ||
exit 1 | ||
fi | ||
echo Coverage is good. | ||
lint: | ||
docker: | ||
- image: cimg/python:3.8 | ||
|
||
steps: | ||
- checkout | ||
|
||
- python/install-packages: | ||
pkg-manager: pip | ||
pip-dependency-file: requirements-test.txt | ||
|
||
- run: | ||
name: Run lint | ||
command: flake8 . | ||
|
||
|
||
dependency-check: | ||
docker: | ||
- image: cimg/python:3.8 | ||
|
||
steps: | ||
- checkout | ||
|
||
- python/install-packages: | ||
pkg-manager: pip | ||
pip-dependency-file: requirements-test.txt | ||
|
||
- run: | ||
name: Run depency check | ||
command: | | ||
export today=$(date "+%Y-%m-%d") | ||
# gather up the -i ignore IDs fro safety check | ||
export ignores=$( | ||
grep -vE "^\s*#" .safety.dependency.ignore | # print out any non-comment line | ||
grep "[0-9]" | # filter out any line that doesn't have a number in it | ||
awk -v "today=${today}" '{ if ($2 > today || $2 == "") print "-i", $1}' | # print any line with date after today | ||
xargs echo # put all the output from previous command on one line | ||
) | ||
export command="safety check -r requirements.txt --full-report $ignores" | ||
echo "----------------------------------------------------" | ||
echo "If you need to modify the ignore list for the safety" | ||
echo "check, edit .safety.dependency.ignore file" | ||
echo "----------------------------------------------------" | ||
eval $command | ||
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows | ||
workflows: | ||
sample: | ||
jobs: | ||
- unit-test | ||
- lint | ||
- dependency-check |
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,18 @@ | ||
--- | ||
name: Issue template | ||
about: Issue template for fecfile-validate | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
### Business Reason ### | ||
|
||
As a [role], I will be able to [blank] so that I can [business reason] | ||
|
||
### Acceptance Criteria ### | ||
|
||
**If** [precedent] | ||
**When** [action] | ||
**Then** [result] |
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,12 @@ | ||
# Any vulnerability ID numbers listed in this file will be ignored when | ||
# running the safety dependency check. Each line should have the ID number | ||
# and a date. The ID will be ignored by the CI pipeline check unitl the date | ||
# in YYYY-MM-DD format listed for that line. | ||
# If no date is listed, the exception will never expire. (NOT RECOMMENDED) | ||
# | ||
# test | ||
# Example: | ||
# 40104 2022-01-15 | ||
# | ||
40104 2022-01-25 # gunicorn | ||
40105 2022-01-25 # gunicorn |
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
Oops, something went wrong.