Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ jobs:
run: npm ci

- name: Provision pinned Darktide source snapshot
run: git clone --depth 1 https://github.com/Aussiemon/Darktide-Source-Code.git ../Darktide-Source-Code
run: |
PINNED_SHA=$(node -e "console.log(JSON.parse(require('fs').readFileSync('data/ground-truth/source-snapshots/manifest.json','utf8')).git_revision)")
git init ../Darktide-Source-Code
cd ../Darktide-Source-Code
git remote add origin https://github.com/Aussiemon/Darktide-Source-Code.git
git fetch --depth 1 origin "$PINNED_SHA"
git checkout FETCH_HEAD

- name: Run checks
env:
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Create .source-root once: echo /path/to/Darktide-Source-Code > .source-root
GROUND_TRUTH_SOURCE_ROOT ?= $(shell cat .source-root 2>/dev/null)

.PHONY: require-source-root test resolve audit index-build index-check edges-build effects-build breeds-build profiles-build check
.PHONY: require-source-root test resolve audit index-build index-check edges-build effects-build breeds-build profiles-build stagger-build check

require-source-root:
@if [ -z "$(GROUND_TRUTH_SOURCE_ROOT)" ]; then \
Expand Down Expand Up @@ -38,5 +38,8 @@ breeds-build: require-source-root
profiles-build: require-source-root
GROUND_TRUTH_SOURCE_ROOT="$(GROUND_TRUTH_SOURCE_ROOT)" npm run profiles:build

check: require-source-root edges-build effects-build breeds-build profiles-build
stagger-build: require-source-root
GROUND_TRUTH_SOURCE_ROOT="$(GROUND_TRUTH_SOURCE_ROOT)" npm run stagger:build

check: require-source-root edges-build effects-build breeds-build profiles-build stagger-build
GROUND_TRUTH_SOURCE_ROOT="$(GROUND_TRUTH_SOURCE_ROOT)" npm run check
3 changes: 2 additions & 1 deletion scripts/export-bot-weapons.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { fileURLToPath } from "node:url";
import { loadGroundTruthRegistry } from "./ground-truth/lib/registry.mjs";

const __dirname = dirname(fileURLToPath(import.meta.url));
const OUTPUT_PATH = join(__dirname, "..", "data", "exports", "bot-weapon-recommendations.json");
const DEFAULT_OUTPUT_PATH = join(__dirname, "..", "data", "exports", "bot-weapon-recommendations.json");
const OUTPUT_PATH = process.argv[2] || DEFAULT_OUTPUT_PATH;

// Curated per-class weapon selections.
// Evaluated against BetterBots bot-incompatibility criteria:
Expand Down
23 changes: 15 additions & 8 deletions scripts/export-bot-weapons.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { describe, it } from "node:test";
import { strict as assert } from "node:assert";
import { readFileSync } from "node:fs";
import { readFileSync, mkdtempSync, rmSync } from "node:fs";
import { spawnSync } from "node:child_process";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { tmpdir } from "node:os";
import { loadGroundTruthRegistry } from "./ground-truth/lib/registry.mjs";

const __dirname = dirname(fileURLToPath(import.meta.url));
Expand Down Expand Up @@ -76,12 +77,18 @@ describe("bot-weapon-recommendations export", () => {

describe("export:bot-weapons CLI", () => {
it("runs without error", () => {
const result = spawnSync(
process.execPath,
["scripts/export-bot-weapons.mjs"],
{ encoding: "utf8", timeout: 10_000 },
);
assert.equal(result.status, 0, `CLI failed: ${result.stderr}`);
assert.ok(result.stdout.includes("Wrote"), `unexpected output: ${result.stdout}`);
const tmp = mkdtempSync(join(tmpdir(), "bot-weapons-"));
const outPath = join(tmp, "bot-weapon-recommendations.json");
try {
const result = spawnSync(
process.execPath,
["scripts/export-bot-weapons.mjs", outPath],
{ encoding: "utf8", timeout: 10_000 },
);
assert.equal(result.status, 0, `CLI failed: ${result.stderr}`);
assert.ok(result.stdout.includes("Wrote"), `unexpected output: ${result.stdout}`);
} finally {
rmSync(tmp, { recursive: true, force: true });
}
});
});
3 changes: 2 additions & 1 deletion scripts/extract-breed-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* npm run breeds:build
*/

import { readFileSync, writeFileSync, readdirSync } from "node:fs";
import { readFileSync, writeFileSync, readdirSync, mkdirSync } from "node:fs";
import { join } from "node:path";
import { validateSourceSnapshot } from "./ground-truth/lib/validate.mjs";
import { runCliMain } from "./ground-truth/lib/cli.mjs";
Expand Down Expand Up @@ -136,6 +136,7 @@ await runCliMain("breeds:build", async () => {
source_snapshot_id: snapshotId,
generated_at: new Date().toISOString(),
};
mkdirSync(GENERATED_DIR, { recursive: true });
writeFileSync(
join(GENERATED_DIR, "breed-data.json"),
JSON.stringify(output, null, 2) + "\n",
Expand Down
3 changes: 2 additions & 1 deletion scripts/extract-damage-profiles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* npm run profiles:build
*/

import { readFileSync, writeFileSync, readdirSync, existsSync } from "node:fs";
import { readFileSync, writeFileSync, readdirSync, existsSync, mkdirSync } from "node:fs";
import { join, basename } from "node:path";
import { validateSourceSnapshot } from "./ground-truth/lib/validate.mjs";
import { runCliMain } from "./ground-truth/lib/cli.mjs";
Expand Down Expand Up @@ -111,6 +111,7 @@ await runCliMain("profiles:build", async () => {
source_snapshot_id: snapshotId,
generated_at: new Date().toISOString(),
};
mkdirSync(GENERATED_DIR, { recursive: true });
writeFileSync(
join(GENERATED_DIR, "damage-profiles.json"),
JSON.stringify(output, null, 2) + "\n",
Expand Down
3 changes: 2 additions & 1 deletion scripts/extract-stagger-settings.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* npm run stagger:build
*/

import { readFileSync, writeFileSync } from "node:fs";
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
import { join } from "node:path";
import { validateSourceSnapshot } from "./ground-truth/lib/validate.mjs";
import { runCliMain } from "./ground-truth/lib/cli.mjs";
Expand Down Expand Up @@ -82,6 +82,7 @@ await runCliMain("stagger:build", async () => {
generated_at: new Date().toISOString(),
};

mkdirSync(GENERATED_DIR, { recursive: true });
writeFileSync(
join(GENERATED_DIR, "stagger-settings.json"),
JSON.stringify(output, null, 2) + "\n",
Expand Down