Skip to content
This repository has been archived by the owner on Aug 20, 2021. It is now read-only.

Commit

Permalink
Ci Updates (#29)
Browse files Browse the repository at this point in the history
* fix CI

* update CI for testing and deployment
  • Loading branch information
anweiss authored Dec 26, 2018
1 parent a159bde commit 6d90be0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
45 changes: 39 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
version: 2
jobs:
build:
working_directory: /go/src/github.com/opencontrol/oscalkit
test:
docker:
- image: circleci/golang:1.10
- image: circleci/golang:1.11
working_directory: /go/src/github.com/opencontrol/oscalkit
environment:
TEST_RESULTS: /tmp/test-results
steps:
- checkout
- run: mkdir -p $TEST_RESULTS
- restore_cache:
keys:
- v1-pkg-cache
- run:
name: Run unit tests
command: |
trap "go-junit-report <${TEST_RESULTS}/go-test.out > ${TEST_RESULTS}/go-test-report.xml" EXIT
make test | tee ${TEST_RESULTS}/go-test.out
- save_cache:
key: v1-pkg-cache
paths:
- "/go/pkg"
- store_artifacts:
path: /tmp/test-results
destination: raw-test-output
- store_test_results:
path: /tmp/test-results

deploy:
docker:
- image: circleci/golang:1.11
working_directory: /go/src/github.com/opencontrol/oscalkit
steps:
- setup_remote_docker:
docker_layer_caching: true
- run: sudo apt-get install -y rpm
Expand All @@ -19,7 +42,17 @@ jobs:
if [[ -n ${CIRCLE_TAG} ]]; then
curl -sL https://git.io/goreleaser | bash
fi

deployment:
trigger_tag:
tag: /.*/
workflows:
test_and_deploy:
jobs:
- test
- deploy:
requires:
- test
filters:
tags:
only: /.*/
branches:
only: master
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ generate:
$(NAMESPACE)/$(REPO):generate \
sh -c "go generate"

test: generate
docker container run \
-v $$PWD:/go/src/github.com/opencontrol/oscalkit \
-w /go/src/github.com/opencontrol/oscalkit \
golang:1.11 \
sh -c "go test \$$(go list ./... | grep -v /vendor/)"
test:
@go test -v $(shell go list ./... | grep -v /vendor/)

build-docker:
docker image build --build-arg VERSION=$(VERSION) --build-arg BUILD=$(BUILD) --build-arg DATE=$(DATE) -t $(NAMESPACE)/$(REPO):$(VERSION)-$(BUILD) .
Expand Down

0 comments on commit 6d90be0

Please sign in to comment.