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

Commit

Permalink
Merge pull request #23 from Financial-Times/fix/UPPSF-984-migrate-to-…
Browse files Browse the repository at this point in the history
…go-modules

Migrate to Go modules
  • Loading branch information
mchompalova committed Jan 17, 2020
2 parents d8d5b9d + 47e4a49 commit eb377b1
Show file tree
Hide file tree
Showing 8 changed files with 125 additions and 269 deletions.
24 changes: 11 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,45 @@
version: 2
jobs:
build:
working_directory: /content-collection-unfolder
docker:
- image: golang:1
working_directory: /go/src/github.com/Financial-Times/content-collection-unfolder
environment:
GOPATH: /go
CIRCLE_TEST_REPORTS: /tmp/test-results
CIRCLE_COVERAGE_REPORT: /tmp/coverage-results

steps:
- checkout
- run:
name: External Dependencies
command: |
go get -u github.com/mattn/goveralls
go get -u github.com/jstemmer/go-junit-report
go get -u github.com/haya14busa/goverage
go get -u github.com/golang/dep/cmd/dep
GO111MODULE=off go get github.com/mattn/goveralls
GO111MODULE=off go get 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.21.0
wget https://raw.githubusercontent.com/Financial-Times/upp-coding-standard/v1.0.0/golangci-config/.golangci.yml
- run:
name: Create Test Folders
command: |
mkdir -p $CIRCLE_TEST_REPORTS
mkdir -p $CIRCLE_COVERAGE_REPORT
- run:
name: Download Vendored Dependencies
command: dep ensure -v -vendor-only
- run:
name: Go Build
command: go build
command: go build -mod=readonly -v
- run:
name: Run linters
command: golangci-lint run --new-from-rev=$(git rev-parse origin/master) --config .golangci.yml
- run:
name: Run Tests
command: go test -race -cover -coverprofile=${CIRCLE_COVERAGE_REPORT}/coverage.out ./... | go-junit-report > ${CIRCLE_TEST_REPORTS}/junit.xml
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: /content-collection-unfolder
docker:
- image: docker:1.12.6-git
- image: docker:18
steps:
- checkout
- setup_docker_engine
Expand Down
15 changes: 4 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
FROM golang:1

ENV PROJECT=content-collection-unfolder
ENV BUILDINFO_PACKAGE="github.com/Financial-Times/service-status-go/buildinfo."

ENV ORG_PATH="github.com/Financial-Times"
ENV SRC_FOLDER="${GOPATH}/src/${ORG_PATH}/${PROJECT}"
ENV BUILDINFO_PACKAGE="${ORG_PATH}/${PROJECT}/vendor/${ORG_PATH}/service-status-go/buildinfo."

COPY . ${SRC_FOLDER}
WORKDIR ${SRC_FOLDER}

# Install dependancies
RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh \
&& dep ensure -vendor-only
COPY . /${PROJECT}/
WORKDIR /${PROJECT}

RUN VERSION="version=$(git describe --tag --always 2> /dev/null)" \
&& DATETIME="dateTime=$(date -u +%Y%m%d%H%M%S)" \
&& REPOSITORY="repository=$(git config --get remote.origin.url)" \
&& REVISION="revision=$(git rev-parse HEAD)" \
&& BUILDER="builder=$(go version)" \
&& LDFLAGS="-s -w -X '"${BUILDINFO_PACKAGE}$VERSION"' -X '"${BUILDINFO_PACKAGE}$DATETIME"' -X '"${BUILDINFO_PACKAGE}$REPOSITORY"' -X '"${BUILDINFO_PACKAGE}$REVISION"' -X '"${BUILDINFO_PACKAGE}$BUILDER"'" \
&& CGO_ENABLED=0 go build -a -o /artifacts/${PROJECT} -ldflags="${LDFLAGS}" \
&& CGO_ENABLED=0 go build -mod=readonly -a -o /artifacts/${PROJECT} -ldflags="${LDFLAGS}" \
&& echo "Build flags: ${LDFLAGS}"

# Multi-stage build - copy certs and the binary into the image
Expand Down
199 changes: 0 additions & 199 deletions Gopkg.lock

This file was deleted.

36 changes: 0 additions & 36 deletions Gopkg.toml

This file was deleted.

9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Introduction

UPP Service that finds added/deleted collection members and lead article through relations-api.
UPP Service that finds added/deleted collection members and lead articles through relations-api.
Then it forwards mapped content collections to the content-collection-rw-neo4j to be written in Neo4j database.
If a 200 answer is received from the writer,
it retrieves the added/deleted contents and the lead article in the collection from document-store-api
Expand All @@ -20,21 +20,18 @@ Dependencies are:
Download the source code, dependencies and test dependencies:

curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
go get -u github.com/Financial-Times/content-collection-unfolder
go get github.com/Financial-Times/content-collection-unfolder
cd $GOPATH/src/github.com/Financial-Times/content-collection-unfolder
dep ensure -vendor-only
go build .

## Running locally

1. Run the tests and install the binary:

dep ensure -vendor-only
go test -v -race ./...
go install

2. Run the binary (using the `help` flag to see the available optional arguments):
2. Run the binary (usе the `help` flag to see the available optional arguments):

$GOPATH/bin/content-collection-unfolder [--help]

Expand Down
30 changes: 30 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module github.com/Financial-Times/content-collection-unfolder

go 1.13

require (
github.com/Financial-Times/go-fthealth v0.0.0-20171204124831-1b007e2b37b7
github.com/Financial-Times/go-logger v0.0.0-20180323124113-febee6537e90
github.com/Financial-Times/message-queue-go-producer v0.1.1-0.20170622111849-0bb065111416
github.com/Financial-Times/service-status-go v0.0.0-20160323111542-3f5199736a3d
github.com/Financial-Times/transactionid-utils-go v0.2.0
github.com/Financial-Times/uuid-utils-go v0.0.0-20170516110427-e22658edd0f1
github.com/Workiva/go-datastructures v1.0.43
github.com/davecgh/go-spew v1.0.1-0.20161028175848-04cdfd42973b // indirect
github.com/gorilla/context v1.1.1 // indirect
github.com/gorilla/handlers v1.2.1
github.com/gorilla/mux v1.4.1-0.20170524010104-043ee6597c29
github.com/hashicorp/go-version v0.0.0-20170202080759-03c5bf6be031 // indirect
github.com/jawher/mow.cli v0.0.0-20170430135212-8327d12beb75
github.com/onsi/ginkgo v1.11.0 // indirect
github.com/onsi/gomega v1.8.1 // indirect
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0 // indirect
github.com/satori/go.uuid v1.1.1-0.20170321230731-5bf94b69c6b6
github.com/sirupsen/logrus v1.0.5 // indirect
github.com/stretchr/objx v0.0.0-20140526180921-cbeaeb16a013 // indirect
github.com/stretchr/testify v1.1.5-0.20170526065633-eb84487caee2
github.com/willf/bitset v1.0.1-0.20161202170036-5c3c0fce4884 // indirect
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b // indirect
gopkg.in/airbrake/gobrake.v2 v2.0.9 // indirect
gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2 // indirect
)
Loading

0 comments on commit eb377b1

Please sign in to comment.