-
Notifications
You must be signed in to change notification settings - Fork 4
/
Earthfile
200 lines (187 loc) · 9.48 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
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
VERSION 0.7
build-jvm-all:
ARG jabba_jdk='[email protected]'
ARG targets="x86_64-pc-windows-gnu x86_64-unknown-linux-musl"
FROM debian:latest
RUN apt-get update
RUN apt-get install -y curl bash wget
RUN curl -sL https://github.com/Jabba-Team/jabba/raw/main/install.sh | JABBA_COMMAND="install ${jabba_jdk} -o /opt/jdk" bash
ENV JAVA_HOME /opt/jdk
ENV PATH $JAVA_HOME/bin:$PATH
build-scala-all:
FROM +build-jvm-all
WORKDIR /scala-workdir
COPY build.sbt build.sbt
COPY project/plugins.sbt project/plugins.sbt
COPY project/build.properties project/build.properties
COPY --dir scala-core .
COPY --dir scala-blueprints .
COPY --dir scala-common .
COPY --dir scala-bridge-device-tree .
COPY --dir scala-bridge-forsyde-io .
COPY --dir scala-bridge-matlab .
COPY --dir scala-choco .
COPY --dir scala-minizinc .
RUN curl -fL "https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux-static.gz" | gzip -d > cs
RUN chmod +x ./cs
RUN eval "$(./cs setup --env --apps coursier,cs,sbt,sbtn,scala,scalac)" && ./cs launch sbt -- publishModules
FOR target IN ${targets}
FOR imodule IN $(cd imodules && ls *.jar)
IF $(echo "${imodule}" | grep -q "idesyde-scala")
ELSE
RUN mv imodules/${imodule} imodules/idesyde-scala-${imodule}
END
END
FOR emodule IN $(cd emodules && ls *.jar)
IF $(echo "${emodule}" | grep -q "idesyde-scala")
ELSE
RUN mv emodules/${emodule} emodules/idesyde-scala-${emodule}
END
END
SAVE ARTIFACT imodules/* ${target}/imodules/
SAVE ARTIFACT emodules/* ${target}/emodules/
SAVE ARTIFACT imodules/* AS LOCAL dist/${target}/imodules/
SAVE ARTIFACT emodules/* AS LOCAL dist/${target}/emodules/
END
build-java-all:
FROM +build-jvm-all
WORKDIR /java-workdir
COPY build.gradle .
COPY settings.gradle .
COPY gradlew .
COPY --dir gradle gradle
COPY --dir java-core .
COPY --dir java-blueprints .
COPY --dir java-common .
COPY --dir java-bridge-forsyde-io .
COPY --dir java-metaheuristics .
RUN ./gradlew publishModules
FOR target IN ${targets}
SAVE ARTIFACT imodules/* ${target}/imodules/
SAVE ARTIFACT emodules/* ${target}/emodules/
SAVE ARTIFACT imodules/* AS LOCAL dist/${target}/imodules/
SAVE ARTIFACT emodules/* AS LOCAL dist/${target}/emodules/
# RUN cp java-bridge-forsyde-io/build/libs/java-bridge-forsyde-io-all.jar imodules/
# RUN cp java-metaheuristics/build/libs/java-metaheuristics-all.jar emodules/
# SAVE ARTIFACT imodules/java-bridge-forsyde-io-all.jar ${target}/imodules/java-bridge-forsyde-io-all.jar
# SAVE ARTIFACT emodules/java-metaheuristics-all.jar ${target}/emodules/java-metaheuristics-all.jar
# SAVE ARTIFACT imodules/java-bridge-forsyde-io-all.jar AS LOCAL dist/${target}/imodules/java-bridge-forsyde-io-all.jar
# SAVE ARTIFACT emodules/java-metaheuristics-all.jar AS LOCAL dist/${target}/emodules/java-metaheuristics-all.jar
END
build-rust-all:
FROM alpine:latest
WORKDIR /rust-workdir
# RUN apt-get update
# RUN apt-get install -y curl bash build-essential libssl-dev pkg-config mingw-w64 musl-dev musl-tools
RUN apk --no-cache add --update curl bash build-base openssl-dev pkgconfig
ENV CARGO_HOME = /opt/cargo
ENV RUSTUP_HOME = /opt/rustup
ENV PKG_CONFIG_ALLOW_CROSS=1
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
ENV PATH="${CARGO_HOME}/bin:${PATH}"
COPY Cargo.toml .
COPY --dir rust-core .
COPY --dir rust-common .
COPY --dir rust-orchestration .
COPY --dir rust-blueprints .
COPY --dir rust-bridge-matlab-simulink .
build-rust-linux-host:
FROM +build-rust-all
ARG targets="x86_64-unknown-linux-musl"
FOR target IN ${targets}
RUN rustup target add ${target}
RUN cargo build -r --target ${target}
IF $(echo "${target}" | grep -q "windows")
# Took away common module as it is embedded in the orchestrator now
# SAVE ARTIFACT target/${target}/release/idesyde-common.exe ${target}/imodules/idesyde-rust-common.exe
# SAVE ARTIFACT target/${target}/release/idesyde-common.exe AS LOCAL dist/${target}/imodules/idesyde-rust-common.exe
SAVE ARTIFACT target/${target}/release/idesyde-orchestration.exe ${target}/idesyde.exe
SAVE ARTIFACT target/${target}/release/idesyde-orchestration.exe AS LOCAL dist/${target}/idesyde.exe
ELSE
# Took away common module as it is embedded in the orchestrator now
# SAVE ARTIFACT target/${target}/release/idesyde-common ${target}/imodules/idesyde-rust-common
# SAVE ARTIFACT target/${target}/release/idesyde-common AS LOCAL dist/${target}/imodules/idesyde-rust-common
SAVE ARTIFACT target/${target}/release/idesyde-orchestration ${target}/idesyde
SAVE ARTIFACT target/${target}/release/idesyde-orchestration AS LOCAL dist/${target}/idesyde
END
END
build-rust-windows-native:
FROM mcr.microsoft.com/windows/server:ltsc2022
ENV RUSTUP_HOME=/rustup
ENV CARGO_HOME=/cargo
WORKDIR /rust-workdir
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
COPY Cargo.toml .
COPY --dir rust-core .
COPY --dir rust-common .
COPY --dir rust-orchestration .
COPY --dir rust-blueprints .
COPY --dir rust-bridge-matlab-simulink .
RUN source "/cargo/env" && rustup target add x86_64-pc-windows-gnu
RUN source "/cargo/env" && cargo build -r --target x86_64-pc-windows-gnu
# Took away common module as it is embedded in the orchestrator now
# SAVE ARTIFACT target/x86_64-pc-windows-gnu/release/idesyde-common.exe x86_64-windows-gnu/imodules/idesyde-rust-common.exe
# SAVE ARTIFACT target/x86_64-pc-windows-gnu/release/idesyde-common.exe AS LOCAL dist/x86_64-windows-gnu/imodules/idesyde-rust-common.exe
SAVE ARTIFACT target/x86_64-pc-windows-gnu/release/idesyde-orchestration.exe x86_64-windows-gnu/idesyde-orchestrator.exe
SAVE ARTIFACT target/x86_64-pc-windows-gnu/release/idesyde-orchestration.exe AS LOCAL dist/x86_64-windows-gnu/idesyde-orchestrator.exe
zip-build:
FROM alpine:latest
ARG targets="x86_64-unknown-linux-musl"
ARG tag="no-tag"
WORKDIR /zipdir
RUN apk --no-cache add --update zip
FOR target IN ${targets}
COPY --dir +build-scala-all/${target}/* ${target}/
COPY --dir +build-rust-linux-host/${target}/* ${target}/
RUN cd ${target} && zip -r idesyde-${tag}-${target}.zip *
SAVE ARTIFACT ${target}/idesyde-${tag}-${target}.zip AS LOCAL dist/idesyde-${tag}-${target}.zip
RUN rm -r ${target}
END
dist-linux:
ARG tag="no-tag"
ARG jabba_jdk='[email protected]'
BUILD +build-scala-all --targets="x86_64-unknown-linux-musl" --jabba_jdk=${jabba_jdk}
BUILD +build-java-all --targets="x86_64-unknown-linux-musl" --jabba_jdk=${jabba_jdk}
BUILD +build-rust-linux-host --targets="x86_64-unknown-linux-musl"
BUILD +zip-build --targets="x86_64-unknown-linux-musl" --tag=${tag}
dist-windows-cross:
ARG tag="no-tag"
ARG jabba_jdk='[email protected]'
BUILD +build-scala-all --targets="x86_64-pc-windows-gnu" --jabba_jdk=${jabba_jdk}
BUILD +build-java-all --targets="x86_64-pc-windows-gnu" --jabba_jdk=${jabba_jdk}
BUILD +build-rust-linux-host --targets="x86_64-pc-windows-gnu"
BUILD +zip-build --targets="x86_64-pc-windows-gnu" --tag=${tag}
dist-all:
ARG tag="no-tag"
ARG jabba_jdk='[email protected]'
BUILD +build-scala-all --targets="x86_64-unknown-linux-musl x86_64-pc-windows-gnu" --jabba_jdk=${jabba_jdk}
BUILD +build-java-all --targets="x86_64-unknown-linux-musl x86_64-pc-windows-gnu" --jabba_jdk=${jabba_jdk}
BUILD +build-rust-linux-host --targets="x86_64-unknown-linux-musl x86_64-pc-windows-gnu"
BUILD +zip-build --targets="x86_64-unknown-linux-musl x86_64-pc-windows-gnu" --tag=${tag}
test-case-studies:
ARG test_slow="no"
ARG jabba_jdk='[email protected]'
ARG targets="x86_64-unknown-linux-musl"
BUILD +build-scala-all --targets=${targets} --jdk_base=${jdk_base}
BUILD +build-java-all --targets=${targets} --jdk_base=${jdk_base}
BUILD +build-rust-linux-host --targets=${targets}
FROM debian:latest
RUN apt-get update
RUN apt-get install -y curl bash wget python3 python3-pip python3-venv pipx
RUN curl -sL https://github.com/Jabba-Team/jabba/raw/main/install.sh | JABBA_COMMAND="install ${jabba_jdk} -o /jdk" bash
ENV JAVA_HOME /jdk
ENV PATH $JAVA_HOME/bin:$PATH
ENV TEST_SLOW=${test_slow}
# RUN /robotenv/bin/python -m pip install robotframework
FOR target IN ${targets}
WORKDIR /${target}
COPY --dir +build-scala-all/${target}/* .
COPY --dir +build-rust-linux-host/${target}/* .
COPY --dir examples_and_benchmarks .
COPY *.py .
COPY *.robot .
RUN pipx run --spec robotframework robot --exclude slow TestsBenchmark.robot
SAVE ARTIFACT report.html AS LOCAL report.html
SAVE ARTIFACT log.html AS LOCAL log.html
SAVE ARTIFACT output.xml AS LOCAL output.xml
END