Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(.github/workflows/lint.yml): only install necessary tools #4

Merged
merged 39 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
636193b
ci(.github/workflows/lint.yml): only install necessary tools
risu729 Jun 3, 2024
3a12a88
Merge branch 'main' into 2-only-install-required-tools-in-ci
risu729 Jun 5, 2024
bb65066
Merge branch 'main' into 2-only-install-required-tools-in-ci
risu729 Jul 15, 2024
d0834ba
Merge branch 'main' into 2-only-install-required-tools-in-ci
risu729 Sep 21, 2024
086a6ad
fix(.github/workflows/lint.yml): remove second mise install attempt
risu729 Sep 21, 2024
6b9d4aa
Merge branch 'main' into 2-only-install-required-tools-in-ci
risu729 Sep 23, 2024
c60f136
ci(.github/workflows/lint.yml): do not use mise run for bun install
risu729 Sep 23, 2024
5711893
ci(.github/workflows/lint.yml): show content of msgpack mise cache
risu729 Sep 23, 2024
f29b335
Revert "ci(.github/workflows/lint.yml): show content of msgpack mise …
risu729 Sep 23, 2024
8b6fc13
ci(.github/workflows/lint.yml): list all mise cache files for debug
risu729 Sep 23, 2024
806ab7d
Revert "ci(.github/workflows/lint.yml): list all mise cache files for…
risu729 Sep 23, 2024
de27ea9
ci(.github/workflows/lint.yml): disable mise auto install
risu729 Sep 23, 2024
1483b9f
ci(.github/workflows/lint.yml): exchange the job disabling mise auto …
risu729 Sep 23, 2024
4d91af5
ci(.github/workflows/lint.yml): enable logging
risu729 Sep 24, 2024
388880b
ci(.github/workflows/lint.yml): limit rayon max number of threads
risu729 Sep 24, 2024
a892e67
ci(.github/workflows/lint.yml): remove lines for debug
risu729 Sep 24, 2024
c4a7878
ci(.github/workflows/lint.yml): remove node from mise shims
risu729 Sep 24, 2024
d05cf77
Revert "ci(.github/workflows/lint.yml): remove node from mise shims"
risu729 Sep 24, 2024
d60cfc7
ci(.github/workflows/lint.yml): run mise for debug
risu729 Sep 24, 2024
e3bcd5a
Merge branch 'main' into 2-only-install-required-tools-in-ci
risu729 Oct 3, 2024
1aca8d1
ci(.github/workflows/lint.yml): cleanup lines for debug
risu729 Sep 26, 2024
870ec9a
ci(.github/workflows/lint.yml): use install_args for mise install
risu729 Oct 3, 2024
eaaefff
Revert "fix(.github/workflows/lint.yml): remove second mise install a…
risu729 Oct 3, 2024
b29816c
ci(.github/workflows/lint.yml): remove mise reshim for non-background…
risu729 Oct 3, 2024
409b712
ci(.github/workflows/lint.yml): remove npm shim to avoid mise infinit…
risu729 Oct 3, 2024
df97378
ci(.github/workflows/lint.yml): output which npm for debug
risu729 Oct 3, 2024
31979ac
ci(.github/workflows/lint.yml): debug
risu729 Oct 3, 2024
e8f2ee8
ci(.github/workflows/lint.yml): remove whole shims directory for debug
risu729 Oct 3, 2024
16d3d2d
Revert "ci(.github/workflows/lint.yml): remove whole shims directory …
risu729 Oct 4, 2024
8a2cd37
Revert "ci(.github/workflows/lint.yml): debug"
risu729 Oct 4, 2024
f97fc40
Revert "ci(.github/workflows/lint.yml): output which npm for debug"
risu729 Oct 4, 2024
1ea68c8
ci(.github/workflows/lint.yml): set mise log level to trace
risu729 Oct 4, 2024
b53ec74
ci(.github/workflows/lint.yml): show npm binary for debug
risu729 Oct 4, 2024
f00bd38
ci(.github/workflows/lint.yml): cleanup debug codes
risu729 Oct 4, 2024
e727137
ci(.github/workflows/lint.yml,wsl/install.sh): remove mise reshim wor…
risu729 Oct 4, 2024
4f6dd92
Merge branch 'main' into 2-only-install-required-tools-in-ci
risu729 Oct 14, 2024
f88eee6
ci(.github/workflows/lint.yml): remove ubi from backends
risu729 Oct 14, 2024
3cacac4
ci(.github/workflows/scripts/list-mise-tasks.ts): remove backends fro…
risu729 Oct 14, 2024
78583d3
Revert "ci(.github/workflows/scripts/list-mise-tasks.ts): remove back…
risu729 Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Install mise
uses: jdx/mise-action@f8dfbcc150159126838e44b882bf34bd98fd90f3 # v2.1.0
with:
# backends are required to run mise list
install_args: bun node
cache_key_prefix: mise-v0-bun-node
experimental: true

- name: Install package.json dependencies
Expand Down Expand Up @@ -70,6 +73,8 @@ jobs:
- name: Install mise
uses: jdx/mise-action@f8dfbcc150159126838e44b882bf34bd98fd90f3 # v2.1.0
with:
install_args: ${{ matrix.tools }}
cache_key_prefix: mise-v0-${{ matrix.toolsHash }}
experimental: true

- name: Run ${{ matrix.name }}
Expand All @@ -90,6 +95,8 @@ jobs:
- name: Install mise
uses: jdx/mise-action@f8dfbcc150159126838e44b882bf34bd98fd90f3 # v2.1.0
with:
install_args: bun node
cache_key_prefix: mise-v0-bun-node
experimental: true

- name: Install package.json dependencies
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/scripts/list-mise-tasks.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { createHash } from "node:crypto";
import { $ } from "bun";
import {
type EdgeModel,
Expand All @@ -10,6 +11,10 @@ $.throws(true);

const ciTaskDepsDot = await $`mise tasks deps ci --dot`.text();

const miseTools = Object.keys(
(await $`mise list --current --json`.json()) as Record<string, unknown>,
);

const ciTasks = fromDot(ciTaskDepsDot);

const rootNode = ciTasks.nodes.find(
Expand Down Expand Up @@ -58,19 +63,49 @@ const getNodeLabel = (node: NodeModel): string => {
return label;
};

const getDependencies = ({ id }: NodeRef): NodeRef[] => {
return ciTasks.edges
.map(getEdgeTargets)
.filter(({ from }) => from.id === id)
.flatMap(({ to }) => [to, ...getDependencies(to)]);
};

const tasks: {
name: string;
task: string;
// space separated list to use in `mise install` command
tools: string;
toolsHash: string;
}[] = ciTasks.edges
.map(getEdgeTargets)
.filter(({ from }) => from.id === rootNode.id)
.map(({ to }) => {
const taskName = getNodeLabel(getNodeFromRef(to));
// remove prefix if exists
const name = taskName.split(":")[1] ?? taskName;
const tool = miseTools.find((tool) => tool.includes(name));

const tools: string[] = tool ? [tool] : [];

if (tool?.startsWith("npm")) {
tools.push("node");
}

const dependencies = getDependencies(to).map((node) =>
getNodeLabel(getNodeFromRef(node)),
);
// cspell:ignore buni
if (dependencies.some((dependency) => dependency.startsWith("buni"))) {
tools.push("bun", "node");
}

return {
name: name,
task: taskName,
tools: tools.join(" "),
toolsHash: createHash("sha256")
.update(tools.sort().join("-"))
.digest("hex"),
};
});

Expand Down