Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.env
.envrc
env*.sh
!env.test.sh
private/plugin/abbott/*.env
private/plugin/abbott/env*.sh
!version.env
Expand All @@ -18,22 +19,6 @@ __debug_bin*
*.test
coverprofile.out
ginkgo.report
test
*_test.go
*/test
*/*_test.go
*/*/test
*/*/*_test.go
*/*/*/test
*/*/*/*_test.go
*/*/*/*/test
*/*/*/*/*_test.go
*/*/*/*/*/test
*/*/*/*/*/*_test.go
*/*/*/*/*/*/test
*/*/*/*/*/*/*_test.go
*/*/*/*/*/*/*/test
*/*/*/*/*/*/*/*_test.go

# Project
vendor
Expand All @@ -46,7 +31,6 @@ _tmp
.gvm_local
.idea
.vscode
.govetignore
*.code-workspace
private/plugin/abbott/.govetignore

Expand Down
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:

cache:
directories:
- $HOME/.cache/go-build
- $HOME/.cache/buildkit

before_install:
# Remove broken RabbitMQ repos
Expand All @@ -32,6 +32,8 @@ before_install:
- until nc -z localhost 27017; do echo Waiting for MongoDB; sleep 1; done
- /usr/bin/mongosh --eval 'rs.initiate(); while (rs.status().startupStatus || (rs.status().hasOwnProperty("myState") && rs.status().myState != 1)) { printjson( rs.status() ); sleep(1000); }; printjson( rs.status() );'
- echo -e "machine github.com\n login $GITHUB_TOKEN" > ~/.netrc
- sudo apt-get install -y git-restore-mtime
- mkdir -p $HOME/.cache/buildkit

addons:
apt:
Expand All @@ -41,4 +43,6 @@ addons:

script:
- export TIMING_CMD='time -p'
- make plugins-visibility-${PLUGINS_VISIBILITY} && make ci
- git config alias.whatchanged 'log --raw --no-merges'
- git restore-mtime
- make plugins-visibility-${PLUGINS_VISIBILITY} && make ci-in-docker
26 changes: 22 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1
ARG GOLANG_VERSION=1.24.5-alpine
ARG MONGO_VERSION=6.0.23
ARG PLUGIN_VISIBILITY=public
Expand All @@ -13,7 +14,7 @@ WORKDIR /home/tidepool

# platform-base-golang
FROM golang:${GOLANG_VERSION} AS platform-base-golang
RUN apk --no-cache update && apk --no-cache upgrade && apk --no-cache add ca-certificates tzdata git make
RUN apk --no-cache update && apk --no-cache upgrade && apk --no-cache add ca-certificates tzdata git make gcc musl-dev

# platform-base-delve
FROM platform-base-golang AS platform-base-delve
Expand Down Expand Up @@ -44,21 +45,38 @@ COPY plugin/visibility/ ./plugin/visibility/
# platform-init-public
FROM platform-init AS platform-init-public
COPY plugin/abbott/abbott/plugin/ ./plugin/abbott/abbott/plugin/
RUN make init plugins-visibility
RUN --mount=type=cache,target=/root/.cache/go-build \
make init plugins-visibility

# platform-init-private
FROM platform-init AS platform-init-private
COPY private/plugin/abbott/go.* ./private/plugin/abbott/
COPY private/plugin/abbott/abbott/plugin/ ./private/plugin/abbott/abbott/plugin/
RUN make init plugins-visibility
RUN --mount=type=cache,target=/root/.cache/go-build \
make init plugins-visibility

### Build

# platform-build
FROM platform-init-${PLUGIN_VISIBILITY} AS platform-build
ARG SERVICE DELVE_PORT
COPY . .
RUN BUILD=services/${SERVICE} make build
RUN --mount=type=cache,target=/root/.cache/go-build \
BUILD=services/${SERVICE} make build

### CI

# platform-ci
FROM platform-init-${PLUGIN_VISIBILITY} AS platform-ci
ENV CGO_ENABLED=1
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
make ci-init generate ci-build

# platform-ci-test
FROM platform-ci AS platform-ci-test
RUN --mount=type=cache,target=/root/.cache/go-build \
make ci-test-go

### Delve

Expand Down
31 changes: 23 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GINKGO_CI_WATCH_FLAGS += --randomize-all --succinct --fail-on-pending --cover --
GINKGO_CI_FLAGS += $(GINKGO_CI_WATCH_FLAGS) --randomize-suites --keep-going

DOCKER_LOGIN_CMD ?= docker login
DOCKER_BUILD_CMD ?= docker build
DOCKER_BUILD_CMD ?= docker buildx build
DOCKER_PUSH_CMD ?= docker push
DOCKER_TAG_CMD ?= docker tag

Expand Down Expand Up @@ -169,6 +169,21 @@ endif

ci: ci-init ci-generate ci-build ci-test ci-docker

ci-in-docker: ci-docker-build-test ci-docker

DOCKER_CACHE_DIR ?= $(HOME)/.cache/buildkit

ci-docker-build-test:
@echo "Running CI build and test in Docker..."
@cd $(ROOT_DIRECTORY) && \
$(TIMING_CMD) $(DOCKER_BUILD_CMD) \
--network=host \
--build-arg PLUGIN_VISIBILITY=$(PLUGIN_VISIBILITY) \
--cache-from type=local,src=$(DOCKER_CACHE_DIR) \
--cache-to type=local,dest=$(DOCKER_CACHE_DIR),mode=max \
--target platform-ci-test \
.

init: go-mod-download

ci-init: init mockgen goimports
Expand Down Expand Up @@ -302,7 +317,6 @@ test-go:
{ [ -z `go env GOWORK` ] || GOWORK_FLAGS=-mod=readonly; } && \
. ./env.test.sh && $(TIMING_CMD) go test $(GOTEST_FLAGS) $${GOWORK_FLAGS:-} $(GOTEST_PKGS)

ci-test-go: GOTEST_FLAGS += -count=1 -race -shuffle=on -cover
ci-test-go: GOTEST_PKGS = ./...
ci-test-go: test-go

Expand Down Expand Up @@ -350,7 +364,7 @@ endif
docker-build: docker-dump docker-login
ifdef DOCKER_REPOSITORY
@cd $(ROOT_DIRECTORY) && \
$(TIMING_CMD) $(DOCKER_BUILD_CMD) --build-arg=PLUGIN_VISIBILITY=$(PLUGIN_VISIBILITY) --target=platform-${DOCKER_SERVICE} --tag $(DOCKER_REPOSITORY) .
$(TIMING_CMD) $(DOCKER_BUILD_CMD) --load --build-arg=PLUGIN_VISIBILITY=$(PLUGIN_VISIBILITY) --target=platform-${DOCKER_SERVICE} --tag $(DOCKER_REPOSITORY) .
ifdef DOCKER_TRAVIS_BRANCH
@cd $(ROOT_DIRECTORY) && \
$(DOCKER_TAG_CMD) $(DOCKER_REPOSITORY) $(DOCKER_REPOSITORY):$(DOCKER_TRAVIS_BRANCH)-$(TRAVIS_COMMIT)-$(TIMESTAMP) && \
Expand Down Expand Up @@ -414,11 +428,12 @@ phony:
@grep -E '^[^ #]+:( |$$)' $(MAKEFILE) | sed -E 's/^([^ #]+):.*/\1/' | sort -u | xargs echo '.PHONY:' | fold -s -w 80 | sed '$$!s/$$/\\/;2,$$s/^/ /g' >> $(MAKEFILE)

.PHONY: bindir build build-list build-watch buildable ci ci-build \
ci-build-watch ci-docker ci-generate ci-init ci-test ci-test-ginkgo \
ci-test-ginkgo-until-failure ci-test-ginkgo-watch ci-test-go clean clean-all \
clean-bin clean-cover clean-debug clean-generate clean-test clean-version \
CompileDaemon default docker docker-build docker-dump docker-login docker-push \
format format-write format-write-changed generate ginkgo go-generate \
ci-build-watch ci-docker ci-docker-build-test ci-generate ci-in-docker \
ci-init ci-test ci-test-ginkgo ci-test-ginkgo-until-failure \
ci-test-ginkgo-watch ci-test-go clean clean-all clean-bin clean-cover \
clean-debug clean-generate clean-test clean-version CompileDaemon default \
docker docker-build docker-dump docker-login docker-push format \
format-write format-write-changed generate ginkgo go-generate \
go-mod-download go-mod-tidy goimports imports imports-write \
imports-write-changed init mockgen phony plugin-visibility \
plugin-visibility-private plugin-visibility-public plugins-visibility \
Expand Down
1 change: 1 addition & 0 deletions auth/service/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ var _ = Describe("Service", func() {

service = authServiceService.New()
Expect(service).ToNot(BeNil())
Expect(true).To(BeTrue())
})

AfterEach(func() {
Expand Down
2 changes: 1 addition & 1 deletion summary/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func GetBuckets[B BucketDataPt[A], A BucketData](ctx context.Context, userId str
}

var _ = Describe("End to end summary calculations", func() {
var err error
var err error
var logger log.Logger
var ctx context.Context
var registry *summary.SummarizerRegistry
Expand Down
Loading