Files
stack/ee/reconciliation/Earthfile

82 lines
2.0 KiB
Plaintext

VERSION 0.8
IMPORT github.com/formancehq/earthly:tags/v0.15.0 AS core
IMPORT ../.. AS stack
IMPORT ../../releases AS releases
IMPORT .. AS ee
FROM core+base-image
sources:
WORKDIR src
COPY --pass-args (releases+sdk-generate/go) /src/releases/sdks/go
WORKDIR /src/ee/reconciliation
COPY go.* .
COPY --dir cmd internal .
COPY main.go .
SAVE ARTIFACT /src
compile:
FROM core+builder-image
COPY (+sources/*) /src
WORKDIR /src/ee/reconciliation
ARG VERSION=latest
DO --pass-args core+GO_COMPILE --VERSION=$VERSION
build-image:
FROM core+final-image
ENTRYPOINT ["/bin/reconciliation"]
CMD ["serve"]
COPY (+compile/main) /bin/reconciliation
ARG REPOSITORY=ghcr.io
ARG tag=latest
DO core+SAVE_IMAGE --COMPONENT=reconciliation --REPOSITORY=${REPOSITORY} --TAG=$tag
tests:
FROM core+builder-image
COPY (+sources/*) /src
WORKDIR /src/ee/reconciliation
WITH DOCKER --pull=postgres:15-alpine
DO --pass-args core+GO_TESTS
END
deploy:
COPY (+sources/*) /src
LET tag=$(tar cf - /src | sha1sum | awk '{print $1}')
WAIT
BUILD --pass-args +build-image --tag=$tag
END
FROM --pass-args core+vcluster-deployer-image
RUN kubectl patch Versions.formance.com default -p "{\"spec\":{\"reconciliation\": \"${tag}\"}}" --type=merge
deploy-staging:
BUILD --pass-args stack+deployer-module --MODULE=reconciliation
lint:
FROM core+builder-image
COPY (+sources/*) /src
COPY --pass-args +tidy/go.* .
WORKDIR /src/ee/reconciliation
DO --pass-args stack+GO_LINT
SAVE ARTIFACT cmd AS LOCAL cmd
SAVE ARTIFACT internal AS LOCAL internal
SAVE ARTIFACT main.go AS LOCAL main.go
pre-commit:
WAIT
BUILD --pass-args +tidy
END
BUILD --pass-args +lint
openapi:
COPY ./openapi.yaml .
SAVE ARTIFACT ./openapi.yaml
tidy:
FROM core+builder-image
COPY --pass-args (+sources/src) /src
WORKDIR /src/ee/reconciliation
DO --pass-args stack+GO_TIDY
release:
BUILD --pass-args stack+goreleaser --path=ee/reconciliation