Skip to content

Commit

Permalink
#709 cross compilation earthly
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Dec 5, 2023
1 parent 81cdf2f commit 79a90fa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
14 changes: 14 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 9 additions & 7 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 79a90fa

Please sign in to comment.