From 79a90fa5afde2c7a1de5acedaea7e544913a3ee8 Mon Sep 17 00:00:00 2001 From: Joep Meindertsma Date: Tue, 5 Dec 2023 11:28:09 +0100 Subject: [PATCH] #709 cross compilation earthly --- .vscode/tasks.json | 14 ++++++++++++++ Earthfile | 16 +++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 9b99431bf..994bc1d94 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -56,6 +56,20 @@ "group": "none", "problemMatcher": [] }, + { + "label": "earthly pipeline locally", + "type": "shell", + "command": "earthly -i -P +pipeline", + "group": "none", + "problemMatcher": [] + }, + { + "label": "earthly cross-compile", + "type": "shell", + "command": "earthly -i -P +compile-all", + "group": "none", + "problemMatcher": [] + }, { "type": "npm", "script": "start", diff --git a/Earthfile b/Earthfile index 66d568b11..736788bcc 100644 --- a/Earthfile +++ b/Earthfile @@ -13,10 +13,14 @@ pipeline: BUILD +test BUILD +build BUILD +e2e - BUILD +cross-build --TARGET=x86_64-unknown-linux-musl build-all: + # x86_64-unknown-linux-gnu + BUILD +build BUILD +cross-build --TARGET=x86_64-unknown-linux-musl + BUILD +cross-build --TARGET=armv7-unknown-linux-musleabihf + # + # BUILD +cross-build --TARGET=aarch64-apple-darwin install: RUN apt-get update -qq @@ -38,24 +42,22 @@ install: source: FROM +install COPY --keep-ts Cargo.toml Cargo.lock ./ - COPY --keep-ts --dir server lib cli desktop ./ + COPY --keep-ts --dir server lib cli ./ COPY browser+build/dist /code/browser/data-browser/dist cross-build: FROM +source ARG --required TARGET - # This syntax is not supported WITH DOCKER - DO rust+RUN_WITH_CACHE --command "cross build --target \$TARGET" + RUN cross build --target $TARGET --release END - RUN wadoanw - SAVE ARTIFACT ./target/release/ target AS LOCAL artifact/target + SAVE ARTIFACT ./target/$TARGET/release/atomic-server target AS LOCAL artifact/target/$TARGET/atomic-server build: FROM +source DO rust+CARGO --args="build --release" --output="release/[^/\.]+" RUN ./target/release/atomic-server --version - SAVE ARTIFACT ./target/release/ target AS LOCAL artifact/target + SAVE ARTIFACT ./target/release/ target AS LOCAL artifact/target/x86_64-unknown-linux-gnu test: FROM +source