-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEarthfile
More file actions
227 lines (163 loc) · 6.26 KB
/
Earthfile
File metadata and controls
227 lines (163 loc) · 6.26 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
VERSION 0.7
COPY_CI_DATA:
COMMAND
COPY --dir "ci/" ".github/" "./"
COPY_METADATA:
COMMAND
DO +COPY_CI_DATA
COPY --dir ".git/" "./"
alpine-base:
FROM alpine:3.20.3@sha256:1e42bbe2508154c9126d48c2b8a75420c3544343bf86fd041fb7527e017a4b4a
# renovate: datasource=repology depName=alpine_3_20/bash versioning=loose
ENV BASH_VERSION="5.2.26-r0"
RUN apk add --no-cache bash=$BASH_VERSION
WORKDIR "/conventional_commits_next_version"
rust-base:
FROM +alpine-base
# renovate: datasource=repology depName=alpine_3_20/rust versioning=loose
ENV RUST_VERSION="1.78.0-r0"
RUN apk add --no-cache cargo=$RUST_VERSION
check-clean-git-history:
FROM +rust-base
# renovate: datasource=github-releases depName=DeveloperC286/clean_git_history
ENV CLEAN_GIT_HISTORY_VERSION="v0.2.0"
RUN wget -O - "https://github.com/DeveloperC286/clean_git_history/releases/download/${CLEAN_GIT_HISTORY_VERSION}/x86_64-unknown-linux-musl.gz" | gzip -d > /usr/bin/clean_git_history && chmod 755 /usr/bin/clean_git_history
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
# renovate: datasource=github-releases depName=DeveloperC286/conventional_commits_linter
ENV CONVENTIONAL_COMMITS_LINTER_VERSION="v0.13.0"
RUN wget -O - "https://github.com/DeveloperC286/conventional_commits_linter/releases/download/${CONVENTIONAL_COMMITS_LINTER_VERSION}/x86_64-unknown-linux-musl.gz" | gzip -d > /usr/bin/conventional_commits_linter && chmod 755 /usr/bin/conventional_commits_linter
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 --if-exists "Cargo.lock" "./"
COPY --dir "Cargo.toml" "src/" "end-to-end-tests/" "./"
rust-formatting-base:
FROM +rust-base
RUN apk add --no-cache rustfmt=$RUST_VERSION
DO +COPY_SOURCECODE
check-rust-formatting:
FROM +rust-formatting-base
RUN ./ci/check-rust-formatting.sh
python-base:
FROM +alpine-base
# renovate: datasource=repology depName=alpine_3_20/python3 versioning=loose
ENV PYTHON_VERSION="3.12.7-r0"
# renovate: datasource=repology depName=alpine_3_20/git versioning=loose
ENV GIT_VERSION="2.45.2-r0"
# renovate: datasource=repology depName=alpine_3_20/py3-pip versioning=loose
ENV PIP_VERSION="24.0-r2"
RUN apk add --no-cache py3-pip=$PIP_VERSION python3=$PYTHON_VERSION git=$GIT_VERSION
DO +COPY_SOURCECODE
python-formatting-base:
FROM +python-base
RUN pip3 install -r "end-to-end-tests/autopep8.requirements.txt" --break-system-packages
check-python-formatting:
FROM +python-formatting-base
RUN ./ci/check-python-formatting.sh
golang-base:
FROM golang:1.22.1@sha256:0b55ab82ac2a54a6f8f85ec8b943b9e470c39e32c109b766bbc1b801f3fa8d3b
WORKDIR "/conventional_commits_next_version"
shell-formatting-base:
FROM +golang-base
# renovate: datasource=github-releases depName=mvdan/sh
ENV SHFMT_VERSION="v3.7.0"
RUN go install mvdan.cc/sh/v3/cmd/shfmt@$SHFMT_VERSION
DO +COPY_CI_DATA
check-shell-formatting:
FROM +shell-formatting-base
RUN ./ci/check-shell-formatting.sh
yaml-formatting-base:
FROM +golang-base
# renovate: datasource=github-releases depName=google/yamlfmt
ENV YAMLFMT_VERSION="v0.10.0"
RUN go install github.com/google/yamlfmt/cmd/yamlfmt@$YAMLFMT_VERSION
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-python-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-python-formatting:
FROM +python-formatting-base
RUN ./ci/fix-python-formatting.sh
SAVE ARTIFACT "end-to-end-tests/" 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-python-formatting
BUILD +fix-shell-formatting
BUILD +fix-yaml-formatting
check-rust-linting:
FROM +rust-base
RUN apk add --no-cache rust-clippy=$RUST_VERSION
DO +COPY_SOURCECODE
RUN ./ci/check-rust-linting.sh
check-shell-linting:
FROM +alpine-base
# renovate: datasource=repology depName=alpine_3_20/shellcheck versioning=loose
ENV SHELLCHECK_VERSION="0.10.0-r1"
RUN apk add --no-cache shellcheck=$SHELLCHECK_VERSION
DO +COPY_CI_DATA
RUN ./ci/check-shell-linting.sh
check-github-actions-workflows-linting:
FROM +golang-base
# renovate: datasource=github-releases depName=rhysd/actionlint
ENV ACTIONLINT_VERSION="v1.6.26"
RUN go install github.com/rhysd/actionlint/cmd/actionlint@$ACTIONLINT_VERSION
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
end-to-end-test:
FROM +python-base
RUN pip3 install -r "end-to-end-tests/requirements.txt" --break-system-packages
COPY "+compile/target/" "target/"
RUN ./ci/end-to-end-test.sh
release-artifacts:
FROM +alpine-base
# renovate: datasource=repology depName=alpine_3_20/github-cli versioning=loose
ENV GITHUB_CLI_VERSION="2.47.0-r4"
RUN apk add --no-cache github-cli=$GITHUB_CLI_VERSION
DO +COPY_METADATA
DO +COPY_SOURCECODE
ARG release
RUN --secret GH_TOKEN ./ci/release-artifacts.sh --release "${release}"
publish:
FROM +rust-base
COPY "README.md" "./"
DO +COPY_SOURCECODE
RUN --secret CARGO_REGISTRY_TOKEN ./ci/publish.sh