Skip to content

Commit

Permalink
Migrate config to orbs
Browse files Browse the repository at this point in the history
  • Loading branch information
mchompalova committed Mar 26, 2020
1 parent e06c725 commit be0bd2b
Showing 1 changed file with 16 additions and 55 deletions.
71 changes: 16 additions & 55 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,7 @@
version: 2
version: 2.1
orbs:
ft-golang-ci: financial-times/golang-ci@1
jobs:
build:
working_directory: /go/src/github.com/Financial-Times/draft-annotations-api
docker:
- image: golang:1
environment:
GOPATH: /go
CIRCLE_TEST_REPORTS: /tmp/test-results
CIRCLE_COVERAGE_REPORT: /tmp/coverage-results
steps:
- checkout
- run:
name: External Dependencies
command: |
GO111MODULE=off go get -u github.com/mattn/goveralls
GO111MODULE=off go get -u github.com/jstemmer/go-junit-report
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.18.0
wget https://raw.githubusercontent.com/Financial-Times/upp-coding-standard/v1.0.0/golangci-config/.golangci.yml
- run:
name: Test Results
command: |
mkdir -p ${CIRCLE_TEST_REPORTS}
mkdir -p ${CIRCLE_COVERAGE_REPORT}
- run:
name: Go Build
command: go build -mod=readonly -v
- run:
name: Run linters
command: golangci-lint run --new-from-rev=master --config .golangci.yml
- run:
name: Run Tests
command: |
go test -mod=readonly -race -cover -coverprofile=${CIRCLE_COVERAGE_REPORT}/coverage.out ./... | go-junit-report > ${CIRCLE_TEST_REPORTS}/junit.xml
- run:
name: Upload Coverage
command: goveralls -coverprofile=${CIRCLE_COVERAGE_REPORT}/coverage.out -service=circle-ci -repotoken=${COVERALLS_TOKEN}
- store_test_results:
path: /tmp/test-results
dockerfile:
working_directory: /draft-content-api
docker:
- image: docker:18
steps:
- checkout
- setup_docker_engine
- run:
name: Build Dockerfile
command: docker build .
dredd:
working_directory: /go/src/github.com/Financial-Times/draft-annotations-api
docker:
Expand All @@ -60,12 +15,12 @@ jobs:
- image: peteclarkft/ersatz:stable
steps:
- checkout
- run:
name: Go Build
command: go build -mod=readonly -v
- run:
name: Load ersatz-fixtures.yml to ersatz image
command: "curl -X POST --data-binary @_ft/ersatz-fixtures.yml -H \"Content-type: text/x-yaml\" http://localhost:9000/__configure"
- run:
name: Go Build
command: go build -mod=readonly -v
- run:
name: Download dredd
command: |
Expand All @@ -77,11 +32,17 @@ jobs:
name: Dredd API Testing
command: dredd
workflows:
version: 2
test-and-build-docker:
jobs:
- build
- ft-golang-ci/build-and-test:
name: build-and-test-project
- dredd
- dockerfile:
- ft-golang-ci/docker-build:
name: build-docker-image
requires:
- build
- build-and-test-project
snyk-scanning:
jobs:
- ft-golang-ci/scan:
name: scan-dependencies
context: cm-team-snyk

0 comments on commit be0bd2b

Please sign in to comment.