This repository has been archived by the owner on Jul 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6480a5f
commit bf27b8b
Showing
18 changed files
with
527 additions
and
32 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,5 @@ | ||
{:auth | ||
{:repository-auth | ||
{#"clojars" | ||
{:username #=(eval (System/getenv "CLOJARS_USER")) | ||
:password #=(eval (System/getenv "CLOJARS_PASS"))}}}} |
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,225 @@ | ||
version: 2.1 | ||
|
||
commands: | ||
early_return_for_forked_pull_requests: | ||
description: >- | ||
If this build is from a fork, stop executing the current job and return success. | ||
This is useful to avoid steps that will fail due to missing credentials. | ||
steps: | ||
- run: | ||
name: Early return if this build is from a forked PR | ||
command: | | ||
if [ -n "$CIRCLE_PR_NUMBER" ]; then | ||
echo "Nothing to do for forked PRs, so marking this step successful" | ||
circleci step halt | ||
fi | ||
jobs: | ||
checkout_code: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- checkout | ||
- save_cache: | ||
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
paths: | ||
- ~/build | ||
|
||
bundle_dependencies: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3-node | ||
working_directory: ~/build | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- v1-dependencies-{{ checksum "project.clj" }} | ||
- v1-node-dependencies-{{ checksum "package.json" }} | ||
- run: lein deps | ||
- run: npm install | ||
- save_cache: | ||
key: v1-dependencies-{{ checksum "project.clj" }} | ||
paths: | ||
- ~/.m2 | ||
- save_cache: | ||
key: v1-node-dependencies-{{ checksum "package.json" }} | ||
paths: | ||
- ~/node_modules | ||
|
||
verify_license_headers: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- v1-dependencies-{{ checksum "project.clj" }} | ||
- run: ./.circleci/scripts/verify-license-headers.sh "clj" "^;; Copyright 2015-[0-9]{4} Workiva Inc.$" project.clj profiles.clj | ||
- run: ./.circleci/scripts/verify-license-headers.sh "java" "^// Copyright 2015-[0-9]{4} Workiva Inc.$" | ||
|
||
verify_docs: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- v1-dependencies-{{ checksum "project.clj" }} | ||
- v1-node-dependencies-{{ checksum "package.json" }} | ||
# Verify Docs | ||
- run: ./.circleci/scripts/verify-docs.sh | ||
- run: cd ./docs/api && tar cvfz "../../eva-api-docs.tgz" ./ | ||
- run: mkdir -p ./artifacts/docs | ||
- run: mv ./eva-api-docs.tgz ./artifacts/docs/ | ||
- store_artifacts: | ||
path: ./artifacts | ||
|
||
unit_tests: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- v1-dependencies-{{ checksum "project.clj" }} | ||
- run: lein with-profile +aot,-dynamodb-local test | ||
|
||
build_transactor: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- v1-dependencies-{{ checksum "project.clj" }} | ||
- run: lein with-profile +deployment uberjar | ||
- run: cp ./target/transactor.jar /tmp/transactor.jar | ||
- store_artifacts: | ||
path: ./target/transactor.jar | ||
- persist_to_workspace: | ||
root: /tmp | ||
paths: | ||
- transactor.jar | ||
|
||
verify_workiva_ci: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- setup_remote_docker: | ||
docker_layer_caching: false | ||
- run: ./.circleci/scripts/verify-dockerfile.sh | ||
|
||
# Verify that internal CI system will not fail after a merged PR | ||
build_and_push_docker_image: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- setup_remote_docker: | ||
docker_layer_caching: false | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: mkdir -p ./target/ | ||
- run: mv /tmp/workspace/transactor.jar ./target/transactor.jar | ||
- run: docker build -f transactor.Dockerfile -t workiva/eva:latest-release -t workiva/eva:$CIRCLE_TAG . | ||
# TODO - waiting on account to be made | ||
# - run: docker login -u $DOCKER_USER -p $DOCKER_PASS | ||
# - run: docker push xtvaser/salttoday:latest | ||
# - run: docker push xtvaser/salttoday:$CIRCLE_TAG | ||
|
||
deploy_clojars: | ||
docker: | ||
- image: circleci/clojure:lein-2.8.3 | ||
working_directory: ~/build | ||
steps: | ||
- early_return_for_forked_pull_requests | ||
- restore_cache: | ||
keys: | ||
- v1-repo-{{ .Environment.CIRCLE_SHA1 }} | ||
- v1-dependencies-{{ checksum "project.clj" }} | ||
- run: mkdir -p ~/.lein | ||
- run: cp ./.circleci/clojars/profiles.clj ~/.lein/profiles.clj | ||
- run: LEIN_SNAPSHOTS_IN_RELEASE=true lein deploy clojars | ||
|
||
workflows: | ||
eva_workflow: | ||
jobs: | ||
- checkout_code: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
ignore: /[0-9a-f]{7}_cr_no_smithy/ | ||
- bundle_dependencies: | ||
requires: | ||
- checkout_code | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- verify_workiva_ci: | ||
requires: | ||
- checkout_code | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- verify_license_headers: | ||
requires: | ||
- checkout_code | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- verify_docs: | ||
requires: | ||
- checkout_code | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- unit_tests: | ||
requires: | ||
- checkout_code | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- build_transactor: | ||
requires: | ||
- unit_tests | ||
filters: | ||
tags: | ||
only: /.*/ | ||
- build_and_push_docker_image: | ||
context: DockerHub | ||
requires: | ||
- verify_workiva_cli | ||
- verify_license_headers | ||
- build_transactor | ||
# Only run on tagged builds starting with 'v' | ||
# Therefore, releases MUST start with 'v' | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
- deploy_clojars: | ||
context: Clojars | ||
requires: | ||
- verify_workiva_cli | ||
- verify_license_headers | ||
- build_transactor | ||
# Only run on tagged builds starting with 'v' | ||
# Therefore, releases MUST start with 'v' | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ |
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,7 @@ | ||
#!/bin/bash | ||
# Updates table of contents in all relevant readmes | ||
# Requires markdown-toc | ||
MAX_DEPTH=4 | ||
|
||
# Parent README | ||
npx markdown-toc -i README.md --maxdepth $MAX_DEPTH |
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,30 @@ | ||
#!/bin/bash | ||
|
||
# Checks if either the `docker build ...` command exited with '0' or | ||
# if the dockerfile ends with FROM scratch, no image will be generated which | ||
# causes exit code '1', however this is a valid condition from our perspective. | ||
|
||
COLOR_NC='\e[0m' | ||
COLOR_GREEN='\e[0;32m' | ||
COLOR_RED='\e[0;31m' | ||
|
||
docker build -f workivabuild.Dockerfile . 2>&1 | tee workivabuild.Dockerfile.output | ||
|
||
finalLine=$(awk '/./{line=$0} END{print line}' workivabuild.Dockerfile.output) | ||
|
||
regex="Successfully built*" | ||
if [[ "$finalLine" == $regex ]]; then | ||
printf "${COLOR_GREEN}Dockerfile built successfully${COLOR_NC}" | ||
rm workivabuild.Dockerfile.output | ||
exit 0 | ||
fi | ||
|
||
if [[ "$finalLine" == "No image was generated. Is your Dockerfile empty?" ]]; then | ||
printf "${COLOR_GREEN}Dockerfile built successfully${COLOR_NC}" | ||
rm workivabuild.Dockerfile.output | ||
exit 0 | ||
fi | ||
|
||
printf "${COLOR_RED}Dockerfile built successfully${COLOR_NC}" | ||
rm workivabuild.Dockerfile.output | ||
exit 1 |
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,39 @@ | ||
#!/bin/bash | ||
# Verifies that docs have been generated and updated | ||
GREEN='\e[0;32m' | ||
RED='\033[0;31m' | ||
NC='\033[0m' # No Color | ||
|
||
md5Command=md5sum | ||
if [ $(uname -s) == "Darwin" ]; then | ||
md5Command=(md5 -q) | ||
fi | ||
|
||
# Store MD5 of Committed Documentation | ||
MD5_ROOT_README_BEFORE=$(find README.md -type f -exec $md5Command {} \; | sort -k 2 | $md5Command) | ||
MD5_DOCS_BEFORE=$(find ./docs/api -type f -exec $md5Command {} \; | sort -k 2 | $md5Command) | ||
|
||
# Update Table of Contents | ||
./.circleci/scripts/update-tocs.sh | ||
# Update Codox documentation | ||
lein docs | ||
|
||
# Calculate Later | ||
MD5_ROOT_README_AFTER=$(find README.md -type f -exec $md5Command {} \; | sort -k 2 | $md5Command) | ||
MD5_DOCS_AFTER=$(find ./docs/api -type f -exec $md5Command {} \; | sort -k 2 | $md5Command) | ||
|
||
# Verify root README.md | ||
if [ "$MD5_ROOT_README_BEFORE" != "$MD5_ROOT_README_AFTER" ]; then | ||
printf "${RED}Aborting, parent README file TOC was not updated${NC}\n" | ||
printf "${RED}Run make update-tocs${NC}\n" | ||
exit 1 | ||
fi | ||
|
||
# Verify ./documentation content | ||
if [ "$MD5_DOCS_BEFORE" != "$MD5_DOCS_AFTER" ]; then | ||
printf "${RED}Aborting, ./docs/api was not updated${NC}\n" | ||
printf "${RED}Run lein docs${NC}\n" | ||
exit 1 | ||
fi | ||
|
||
printf "${GREEN}Documentation verified successfully${NC}\n" |
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,54 @@ | ||
#!/bin/bash | ||
|
||
# Verifies if the license headers are present in source-code files identified by extension | ||
# Grabs the first line of every discovered file and checks it against the provided regex | ||
|
||
# Parameter Listing: | ||
# extension to search for | ||
# regex | ||
# file-names to exclude <var-args> | ||
|
||
COLOR_NC='\e[0m' | ||
COLOR_GREEN='\e[0;32m' | ||
COLOR_CYAN='\e[0;36m' | ||
COLOR_RED='\e[0;31m' | ||
COLOR_YELLOW='\e[1;33m' | ||
|
||
EXTENSION=$1 | ||
REGEX=$2 | ||
EXCLUDE_LIST=( "$@" ) | ||
# Remove First Two Arguments | ||
EXCLUDE_LIST=( ${EXCLUDE_LIST[@]:2} ) | ||
|
||
printf $COLOR_CYAN | ||
printf "Extension - $EXTENSION\n" | ||
printf "REGEX - $REGEX\n" | ||
printf "EXCLUDE LIST - ${EXCLUDE_LIST[*]}\n\n" | ||
printf "$COLOR_NC\n" | ||
|
||
missingHeader=false | ||
for file in $(find . -name "*.$EXTENSION"); do | ||
# Check to see if we should exclude this file | ||
skipFile=false | ||
for excludeFile in "${EXCLUDE_LIST[@]}"; do | ||
if [[ $file == *"$excludeFile"* ]]; then | ||
printf "${COLOR_YELLOW}Skipping - ${file}${COLOR_NC}\n" | ||
skipFile=true | ||
fi | ||
done | ||
# Check the file headers | ||
if [[ "$skipFile" == false ]]; then | ||
headLine=$(head -n 1 $file) | ||
if ! [[ "$headLine" =~ $REGEX ]]; then | ||
printf "${COLOR_RED}\"${file}\" does not contain the proper licensing header!${COLOR_NC}\n" | ||
missingHeader=true | ||
fi | ||
fi | ||
done | ||
|
||
if [[ $missingHeader == false ]]; then | ||
printf "\n${COLOR_GREEN}All non-excluded *.${EXTENSION} files contained the licensing header.${COLOR_NC}\n" | ||
exit 0 | ||
else | ||
exit 1 | ||
fi |
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,15 @@ | ||
# Contributing | ||
|
||
1. Branch and PR to master | ||
2. Maintiners / Previous Contributors will Review | ||
|
||
# Guidelines | ||
|
||
- Good style - https://github.com/bbatsov/clojure-style-guide | ||
- Descriptive commit messages - https://chris.beams.io/posts/git-commit/ | ||
- Tests where appropriate | ||
|
||
# Active Maintainers | ||
|
||
- Erik Petersen <erik.petersen@workiva.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,17 @@ | ||
## Expected Behavior | ||
|
||
|
||
## Actual Behavior | ||
|
||
|
||
## Steps to Reproduce the Problem | ||
|
||
1. | ||
2. | ||
3. | ||
|
||
## Specifications | ||
|
||
- Version: | ||
- Platform: | ||
- Subsystem: |
Oops, something went wrong.