Merge 732983ee72 into 09be5d45d5
This commit is contained in:
commit
700dadc1da
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@ -16,6 +16,10 @@ jobs:
|
|||||||
- name: Checkout submodules (retry)
|
- name: Checkout submodules (retry)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
if [ ! -f .gitmodules ]; then
|
||||||
|
echo "No .gitmodules found; skipping submodule update."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
for attempt in 1 2 3 4 5; do
|
for attempt in 1 2 3 4 5; do
|
||||||
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
||||||
@ -101,6 +105,10 @@ jobs:
|
|||||||
- name: Checkout submodules (retry)
|
- name: Checkout submodules (retry)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
if [ ! -f .gitmodules ]; then
|
||||||
|
echo "No .gitmodules found; skipping submodule update."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
for attempt in 1 2 3 4 5; do
|
for attempt in 1 2 3 4 5; do
|
||||||
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
||||||
@ -217,6 +225,10 @@ jobs:
|
|||||||
- name: Checkout submodules (retry)
|
- name: Checkout submodules (retry)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
if [ ! -f .gitmodules ]; then
|
||||||
|
echo "No .gitmodules found; skipping submodule update."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
for attempt in 1 2 3 4 5; do
|
for attempt in 1 2 3 4 5; do
|
||||||
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
||||||
@ -293,6 +305,10 @@ jobs:
|
|||||||
- name: Checkout submodules (retry)
|
- name: Checkout submodules (retry)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
if [ ! -f .gitmodules ]; then
|
||||||
|
echo "No .gitmodules found; skipping submodule update."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
for attempt in 1 2 3 4 5; do
|
for attempt in 1 2 3 4 5; do
|
||||||
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
||||||
@ -389,6 +405,10 @@ jobs:
|
|||||||
- name: Checkout submodules (retry)
|
- name: Checkout submodules (retry)
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
if [ ! -f .gitmodules ]; then
|
||||||
|
echo "No .gitmodules found; skipping submodule update."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
git submodule sync --recursive
|
git submodule sync --recursive
|
||||||
for attempt in 1 2 3 4 5; do
|
for attempt in 1 2 3 4 5; do
|
||||||
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import type { runExec } from "../process/exec.js";
|
|||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { ensureBinary } from "./binaries.js";
|
import { ensureBinary } from "./binaries.js";
|
||||||
|
|
||||||
|
const expectedCmd = process.platform === "win32" ? "where" : "which";
|
||||||
|
|
||||||
describe("ensureBinary", () => {
|
describe("ensureBinary", () => {
|
||||||
it("passes through when binary exists", async () => {
|
it("passes through when binary exists", async () => {
|
||||||
const exec: typeof runExec = vi.fn().mockResolvedValue({
|
const exec: typeof runExec = vi.fn().mockResolvedValue({
|
||||||
@ -16,7 +18,7 @@ describe("ensureBinary", () => {
|
|||||||
exit: vi.fn(),
|
exit: vi.fn(),
|
||||||
};
|
};
|
||||||
await ensureBinary("node", exec, runtime);
|
await ensureBinary("node", exec, runtime);
|
||||||
expect(exec).toHaveBeenCalledWith("which", ["node"]);
|
expect(exec).toHaveBeenCalledWith(expectedCmd, ["node"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("logs and exits when missing", async () => {
|
it("logs and exits when missing", async () => {
|
||||||
|
|||||||
@ -7,7 +7,9 @@ export async function ensureBinary(
|
|||||||
runtime: RuntimeEnv = defaultRuntime,
|
runtime: RuntimeEnv = defaultRuntime,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// Abort early if a required CLI tool is missing.
|
// Abort early if a required CLI tool is missing.
|
||||||
await exec("which", [name]).catch(() => {
|
// Use `where` on Windows, `which` elsewhere.
|
||||||
|
const cmd = process.platform === "win32" ? "where" : "which";
|
||||||
|
await exec(cmd, [name]).catch(() => {
|
||||||
runtime.error(`Missing required binary: ${name}. Please install it.`);
|
runtime.error(`Missing required binary: ${name}. Please install it.`);
|
||||||
runtime.exit(1);
|
runtime.exit(1);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user