mirror of
https://github.com/wez/wezterm.git
synced 2024-12-25 22:33:52 +03:00
ci: Vendor cargo dependencies
This doesn't improve the build times, but it does reduce the requests we make to `crates.io`.
This commit is contained in:
parent
8c43c045c4
commit
bcc54d32be
@ -73,15 +73,18 @@ class Step(object):
|
|||||||
|
|
||||||
|
|
||||||
class RunStep(Step):
|
class RunStep(Step):
|
||||||
def __init__(self, name, run, shell="bash", env=None):
|
def __init__(self, name, run, shell="bash", env=None, condition=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.run = run
|
self.run = run
|
||||||
self.shell = shell
|
self.shell = shell
|
||||||
self.env = env
|
self.env = env
|
||||||
|
self.condition = condition
|
||||||
|
|
||||||
def render(self, f, depth=0):
|
def render(self, f, depth=0):
|
||||||
indent = " " * depth
|
indent = " " * depth
|
||||||
f.write(f"{indent}- name: {yv(self.name)}\n")
|
f.write(f"{indent}- name: {yv(self.name)}\n")
|
||||||
|
if self.condition:
|
||||||
|
f.write(f"{indent} if: {self.condition}\n")
|
||||||
if self.env:
|
if self.env:
|
||||||
f.write(f"{indent} env:\n")
|
f.write(f"{indent} env:\n")
|
||||||
keys = list(self.env.keys())
|
keys = list(self.env.keys())
|
||||||
@ -98,17 +101,20 @@ class RunStep(Step):
|
|||||||
|
|
||||||
|
|
||||||
class ActionStep(Step):
|
class ActionStep(Step):
|
||||||
def __init__(self, name, action, params=None, env=None, condition=None):
|
def __init__(self, name, action, params=None, env=None, condition=None, id=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.action = action
|
self.action = action
|
||||||
self.params = params
|
self.params = params
|
||||||
self.env = env
|
self.env = env
|
||||||
self.condition = condition
|
self.condition = condition
|
||||||
|
self.id = id
|
||||||
|
|
||||||
def render(self, f, depth=0):
|
def render(self, f, depth=0):
|
||||||
indent = " " * depth
|
indent = " " * depth
|
||||||
f.write(f"{indent}- name: {yv(self.name)}\n")
|
f.write(f"{indent}- name: {yv(self.name)}\n")
|
||||||
f.write(f"{indent} uses: {self.action}\n")
|
f.write(f"{indent} uses: {self.action}\n")
|
||||||
|
if self.id:
|
||||||
|
f.write(f"{indent} id: {self.id}\n")
|
||||||
if self.condition:
|
if self.condition:
|
||||||
f.write(f"{indent} if: {self.condition}\n")
|
f.write(f"{indent} if: {self.condition}\n")
|
||||||
if self.params:
|
if self.params:
|
||||||
@ -122,14 +128,14 @@ class ActionStep(Step):
|
|||||||
|
|
||||||
|
|
||||||
class CacheStep(ActionStep):
|
class CacheStep(ActionStep):
|
||||||
def __init__(self, name, path, key):
|
def __init__(self, name, path, key, id=None):
|
||||||
super().__init__(
|
super().__init__(
|
||||||
name, action="actions/cache@v3", params={"path": path, "key": key}
|
name, action="actions/cache@v3", params={"path": path, "key": key}, id=id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class CacheRustStep(ActionStep):
|
class SccacheStep(ActionStep):
|
||||||
def __init__(self, name, key):
|
def __init__(self, name):
|
||||||
super().__init__(name, action="mozilla-actions/sccache-action@v0.0.3")
|
super().__init__(name, action="mozilla-actions/sccache-action@v0.0.3")
|
||||||
|
|
||||||
|
|
||||||
@ -390,9 +396,19 @@ rustup default {toolchain}
|
|||||||
]
|
]
|
||||||
if cache:
|
if cache:
|
||||||
steps += [
|
steps += [
|
||||||
CacheRustStep(
|
SccacheStep(name="Compile with sccache"),
|
||||||
name="Cache cargo",
|
# Cache vendored dependecies
|
||||||
key=f"{key_prefix}-cargo",
|
CacheStep(
|
||||||
|
name="Cache Rust Dependencies",
|
||||||
|
path="vendor\n.cargo/config",
|
||||||
|
key="cargo-deps-${{ hashFiles('**/Cargo.lock') }}",
|
||||||
|
id="cache-cargo-vendor",
|
||||||
|
),
|
||||||
|
# Vendor dependencies
|
||||||
|
RunStep(
|
||||||
|
name="Vendor dependecies",
|
||||||
|
condition="steps.cache-cargo-vendor.outputs.cache-hit != 'true'",
|
||||||
|
run="cargo vendor --locked --versioned-dirs >> .cargo/config",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
return steps
|
return steps
|
||||||
@ -850,7 +866,7 @@ cargo build --all --release""",
|
|||||||
# This holds the xcb bits
|
# This holds the xcb bits
|
||||||
RunStep(
|
RunStep(
|
||||||
"Install tar",
|
"Install tar",
|
||||||
"zypper install -yl tar",
|
"zypper install -yl tar gzip",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user