Something went wrong. Try again.
A collection of +180 reusable WebAssembly modules for building composable CI/CD pipelines with FluentCI fluentci.io/modules
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142module CI.Cache.Sccache where
import Preludeimport CI.Cache.IO as IOimport CI.CacheHost as Himport Control.Promise (toAffE)import Effect.Aff (Aff)
version :: Stringversion = "0.19.0"
target :: String -> String -> Stringtarget os arch = case os, arch of "linux", "x64" -> "x86_64-unknown-linux-musl" "linux", "arm64" -> "aarch64-unknown-linux-musl" "darwin", "x64" -> "x86_64-apple-darwin" "darwin", "arm64" -> "aarch64-apple-darwin" "win32", "x64" -> "x86_64-pc-windows-msvc" "win32", "arm64" -> "aarch64-pc-windows-msvc" _, _ -> ""
-- | OpenDAL appends a rooted path, so the endpoint must not end with a slash.environment :: String -> String -> Array { name :: String, value :: String }environment base executable = [ { name: "SCCACHE_WEBDAV_ENDPOINT", value: base <> "/sccache" } , { name: "SCCACHE_WEBDAV_DISABLE_CREATE_DIR", value: "true" } , { name: "SCCACHE_WEBDAV_KEY_PREFIX", value: "fluentci/" } , { name: "SCCACHE_WEBDAV_RW_MODE", value: "READ_WRITE" } , { name: "RUSTC_WRAPPER", value: executable } , { name: "FLUENTCI_RUST_CACHE_BACKEND", value: "sccache" } , { name: "CARGO_INCREMENTAL", value: "0" } ]
install :: String -> String -> Aff { executable :: String, binDir :: String }install os arch = do let asset = "sccache-v" <> version <> "-" <> target os arch <> ".tar.gz" installed <- toAffE (IO.installSccache ("https://github.com/mozilla/sccache/releases/download/v" <> version <> "/" <> asset) asset (if os == "win32" then "sccache.exe" else "sccache")) actual <- toAffE (IO.sccacheVersion installed.executable) H.ensureA (actual == "sccache " <> version) "Installed sccache version mismatch" toAffE (IO.stopSccache installed.executable) pure installed