-
Notifications
You must be signed in to change notification settings - Fork 0
/
Earthfile
156 lines (106 loc) · 3.21 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
VERSION 0.7
COPY_CI_DATA:
COMMAND
COPY --dir "ci/" ".github/" "./"
COPY_METADATA:
COMMAND
DO +COPY_CI_DATA
COPY --dir ".git/" "./"
rust-base:
FROM rust:1.70.0
WORKDIR "/monkey_interpreter"
check-clean-git-history:
FROM +rust-base
RUN cargo install clean_git_history --version 0.1.2 --locked
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/check-clean-git-history.sh --from-reference "${from_reference}"
check-conventional-commits-linting:
FROM +rust-base
RUN cargo install conventional_commits_linter --version 0.12.3 --locked
DO +COPY_METADATA
ARG from_reference="origin/HEAD"
RUN ./ci/check-conventional-commits-linting.sh --from-reference "${from_reference}"
COPY_SOURCECODE:
COMMAND
DO +COPY_CI_DATA
COPY --dir "Cargo.lock" "Cargo.toml" "src/" "./"
rust-formatting-base:
FROM +rust-base
RUN rustup component add rustfmt
DO +COPY_SOURCECODE
check-rust-formatting:
FROM +rust-formatting-base
RUN ./ci/check-rust-formatting.sh
golang-base:
FROM golang:1.20.13
WORKDIR "/monkey_interpreter"
shell-formatting-base:
FROM +golang-base
RUN go install mvdan.cc/sh/v3/cmd/shfmt@v3.7.0
DO +COPY_CI_DATA
check-shell-formatting:
FROM +shell-formatting-base
RUN ./ci/check-shell-formatting.sh
yaml-formatting-base:
FROM +golang-base
RUN go install github.com/google/yamlfmt/cmd/yamlfmt@v0.10.0
COPY ".yamlfmt" "./"
DO +COPY_CI_DATA
check-yaml-formatting:
FROM +yaml-formatting-base
RUN ./ci/check-yaml-formatting.sh
check-formatting:
BUILD +check-rust-formatting
BUILD +check-shell-formatting
BUILD +check-yaml-formatting
fix-rust-formatting:
FROM +rust-formatting-base
RUN ./ci/fix-rust-formatting.sh
SAVE ARTIFACT "src/" AS LOCAL "./"
fix-shell-formatting:
FROM +shell-formatting-base
RUN ./ci/fix-shell-formatting.sh
SAVE ARTIFACT "ci/" AS LOCAL "./"
fix-yaml-formatting:
FROM +yaml-formatting-base
RUN ./ci/fix-yaml-formatting.sh
SAVE ARTIFACT ".github/" AS LOCAL "./"
fix-formatting:
BUILD +fix-rust-formatting
BUILD +fix-shell-formatting
BUILD +fix-yaml-formatting
check-rust-linting:
FROM +rust-base
RUN rustup component add clippy
DO +COPY_SOURCECODE
RUN ./ci/check-rust-linting.sh
ubuntu-base:
FROM ubuntu:22.04
# https://askubuntu.com/questions/462690/what-does-apt-get-fix-missing-do-and-when-is-it-useful
RUN apt-get update --fix-missing
WORKDIR "/monkey_interpreter"
check-shell-linting:
FROM +ubuntu-base
RUN apt-get install shellcheck -y
DO +COPY_CI_DATA
RUN ./ci/check-shell-linting.sh
check-github-actions-workflows-linting:
FROM +golang-base
RUN go install github.com/rhysd/actionlint/cmd/actionlint@v1.6.26
DO +COPY_CI_DATA
RUN ./ci/check-github-actions-workflows-linting.sh
check-linting:
BUILD +check-rust-linting
BUILD +check-shell-linting
BUILD +check-github-actions-workflows-linting
compile:
FROM +rust-base
DO +COPY_SOURCECODE
RUN ./ci/compile.sh
SAVE ARTIFACT "target/" AS LOCAL "./"
SAVE ARTIFACT "Cargo.lock" AS LOCAL "./"
unit-test:
FROM +rust-base
DO +COPY_SOURCECODE
RUN ./ci/unit-test.sh