-
Notifications
You must be signed in to change notification settings - Fork 1
/
Earthfile
67 lines (52 loc) · 1.55 KB
/
Earthfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
VERSION 0.6
ARG ELIXIR=1.14.1
ARG OTP=25.1.2
FROM hexpm/elixir:$ELIXIR-erlang-$OTP-alpine-3.16.2
WORKDIR /src
setup-mix:
RUN apk add --no-progress --update git build-base
ENV ELIXIR_ASSERT_TIMEOUT=10000
RUN mix local.hex --force && mix local.rebar --force
deps-get:
FROM +setup-mix
COPY mix.exs mix.lock ./
COPY config config
RUN mix do deps.get, deps.compile
RUN MIX_ENV=test mix deps.compile
RUN mix hex.audit
RUN mix deps.unlock --check-unused
RUN mix dialyzer --plt
SAVE ARTIFACT /src/deps
SAVE ARTIFACT /src/_build
SAVE IMAGE --push ghcr.io/drselump14/sops_config_provider:deps-plts
linter:
FROM +setup-mix
BUILD +deps-get
COPY +deps-get/deps /src/deps
COPY +deps-get/_build /src/_build
COPY . .
RUN mix deps.audit
RUN mix format --dry-run --check-formatted
RUN mix credo --strict
RUN mix compile --all-warnings --warnings-as-errors
RUN mix dialyzer --halt-exit-status
RUN mix gradient
SAVE IMAGE --push ghcr.io/drselump14/sops_config_provider:linter
# TODO add Documentation
# RUN mix doctor
test:
FROM +setup-mix
BUILD +deps-get
COPY +deps-get/deps /src/deps
COPY +deps-get/_build /src/_build
# Coveralls needs these environment variables to post coverage report
ARG GITHUB_SHA
ARG GITHUB_REF
ARG GITHUB_TOKEN
ARG GITHUB_EVENT_NAME
# Need to copy the event.json from github action host container to tmp/event.json
ARG GITHUB_EVENT_PATH=/src/tmp/event.json
COPY . .
RUN mix coveralls.github
SAVE ARTIFACT /src
SAVE IMAGE --push ghcr.io/drselump14/sops_config_provider:compile_test