[desktop] Fix all clippy warning. Add clippy to CI.
This commit is contained in:
36
Earthfile
36
Earthfile
@@ -636,6 +636,42 @@ tauri-release:
|
||||
BUILD +tauri-build --target="${arch}"
|
||||
END
|
||||
|
||||
tauri-lint:
|
||||
FROM +tauri-src
|
||||
|
||||
# Clippy (rust linter) will try to build the project before it runs the linter.
|
||||
# Make sure we have evrything needed to build the project.
|
||||
ARG target="x86_64-unknown-linux-gnu"
|
||||
|
||||
# if we want tauri to create the installer bundles we also need to provide all external binaries
|
||||
# we need to do some magic here because tauri expects the binaries to include the rust target tripple.
|
||||
# We already know that triple because it's a required argument. From that triple, we use +RUST_TO_GO_ARCH_STRING
|
||||
# function from below to parse the triple and guess wich GOOS and GOARCH we need.
|
||||
RUN mkdir /tmp/gobuild
|
||||
RUN mkdir ./binaries
|
||||
|
||||
DO +RUST_TO_GO_ARCH_STRING --rustTarget="${target}"
|
||||
RUN echo "GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} GO_ARCH_STRING=${GO_ARCH_STRING}"
|
||||
|
||||
# Our tauri app has externalBins configured so tauri will try to embed them when it finished compiling
|
||||
# the app. Make sure we copy portmaster-start and portmaster-core in all architectures supported.
|
||||
# See documentation for externalBins for more information on how tauri searches for the binaries.
|
||||
COPY (+go-build/output --CMDS="portmaster-start portmaster-core" --GOOS="${GOOS}" --GOARCH="${GOARCH}" --GOARM="${GOARM}") /tmp/gobuild
|
||||
|
||||
# Place them in the correct folder with the rust target tripple attached.
|
||||
FOR bin IN $(ls /tmp/gobuild)
|
||||
# ${bin$.*} does not work in SET commands unfortunately so we use a shell
|
||||
# snippet here:
|
||||
RUN set -e ; \
|
||||
dest="./binaries/${bin}-${target}" ; \
|
||||
if [ -z "${bin##*.exe}" ]; then \
|
||||
dest="./binaries/${bin%.*}-${target}.exe" ; \
|
||||
fi ; \
|
||||
cp "/tmp/gobuild/${bin}" "${dest}" ;
|
||||
END
|
||||
DO rust+SET_CACHE_MOUNTS_ENV
|
||||
RUN cargo clippy --all-targets --all-features -- -D warnings
|
||||
|
||||
kext-build:
|
||||
FROM ${rust_builder_image}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user