forked from earthly/earthly
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathEarthfile
More file actions
90 lines (82 loc) · 2.24 KB
/
Earthfile
File metadata and controls
90 lines (82 loc) · 2.24 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
VERSION 0.8
FROM alpine:3.18
WORKDIR /tutorial
test:
# TODO: This doesn't work yet due to order of operations not isolated between LOCALLY targets.
BUILD +test-part \
--lang=go \
--lang=js \
--lang=java \
--lang=python \
--part=part1 \
--part=part3 \
--part=part4 \
--part=part5
test-part1:
BUILD +test-part \
--lang=go \
--lang=js \
--lang=java \
--lang=python \
--part=part1
test-part2:
BUILD +test-part \
--lang=go \
--lang=js \
--lang=java \
--lang=python \
--part=part2
test-part3:
BUILD +test-part \
--lang=go \
--lang=js \
--lang=java \
--lang=python \
--part=part3
test-part4:
BUILD +test-part \
--lang=go \
--lang=js \
--lang=java \
--lang=python \
--part=part4
test-part5:
BUILD +test-part \
--lang=go \
--lang=js \
--lang=java \
--lang=python \
--part=part5
test-part6:
BUILD +test-part \
--lang=go \
--lang=js \
--lang=java \
--lang=python \
--part=part6 \
--target=integration-tests
test-part:
LOCALLY
ARG lang
ARG part
ARG target=docker
ARG earthly=earthly
WORKDIR ${lang}
RUN rm -rf ./test-${part}
RUN "$earthly" --artifact +${part}/${part} ./test-${part}
WORKDIR ./test-${part}
RUN "$earthly" -P +"$target"
IF [ "${lang}" = "js" ] && [ "${part}" != "part1" ] && [ "${part}" != "part2" ] && [ "${part}" != "part6" ]
RUN docker rm -f js-example
RUN docker run -d --rm --name js-example ${lang}-example:latest
RUN sleep 5
RUN curl "$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' js-example)":8080 | grep "Getting Started"
RUN curl "$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' js-example)":8080/main.js | grep "hello world"
RUN docker stop js-example
ELSE IF [ "${part}" != "part6" ]
RUN docker run --rm ${lang}-example:latest 2>&1 | grep "hello world"
END
WORKDIR ..
RUN rm -rf ./test-${part}
# Needed if this were to continue.
# WORKDIR ..