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: enable windows #3078

Draft
wants to merge 61 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
18e88c1
build: run CI on windows
holic Aug 28, 2024
c62abc5
attempt to fix with mkdirp
holic Aug 28, 2024
3b0827f
replace mkdirp/rimraf with shx
holic Aug 28, 2024
d18e41a
missed a spot
holic Aug 28, 2024
4a9f97f
another
holic Aug 28, 2024
d5f6aa4
one more
holic Aug 28, 2024
61aace3
try postinstall
holic Aug 28, 2024
40db84d
fix bad placeholder
holic Aug 28, 2024
9a1bc04
fix glob for windows
holic Aug 28, 2024
a7649dd
no bun on windows
holic Aug 28, 2024
50765b0
remove unused dep
holic Aug 28, 2024
68f6016
can't run test on windows because of containers
holic Aug 28, 2024
6b555e9
avoid cjs build with type:module
holic Aug 28, 2024
24fbaf4
update prettierrc extension
holic Aug 28, 2024
342871b
replace shell script with ts script
holic Aug 28, 2024
d8c83f5
Merge remote-tracking branch 'origin/main' into holic/test-windows
holic Aug 28, 2024
f2e2523
cjs
holic Aug 28, 2024
cbc3b64
back to js
holic Aug 28, 2024
075aa1c
fix template root
holic Aug 28, 2024
2c551d3
back to not a module
holic Aug 28, 2024
2bf20a6
Merge remote-tracking branch 'origin/main' into holic/test-windows
holic Aug 28, 2024
e13d001
Merge remote-tracking branch 'origin/main' into holic/test-windows
holic Aug 28, 2024
84c40cd
revert lockfile changes
holic Aug 28, 2024
04ced71
fix bin issue with linked libs
holic Aug 28, 2024
bd9a2a0
replace npx shx with local shx
holic Aug 28, 2024
8b8c1f5
add shx to all the other workspace roots
holic Aug 28, 2024
c2e0ef6
update changeset
holic Aug 28, 2024
dbbb218
Merge remote-tracking branch 'origin/main' into holic/test-windows
holic Aug 28, 2024
cf9a808
log artifacts
holic Aug 28, 2024
39c79a7
more logs
holic Aug 28, 2024
c703b86
log what files we got
holic Aug 28, 2024
4632b4b
try an initial forward slash
holic Aug 28, 2024
d49aa69
try posix everywhere
holic Aug 28, 2024
a5aa7a2
try normalizing
holic Aug 29, 2024
dcfc342
remove unused file
holic Aug 29, 2024
de6c491
try to prefix windows drive path
holic Aug 29, 2024
0738fbf
fail fast
holic Aug 29, 2024
d6b1770
try adjusting path before import
holic Aug 29, 2024
9b9cdcc
another attempt
holic Aug 29, 2024
4af570f
try via working dir
holic Aug 29, 2024
2801371
logs
holic Aug 29, 2024
04ab781
try a diff prefix
holic Aug 29, 2024
7b7728b
try win working dir
holic Aug 29, 2024
6c27bf0
just throwing shit at the wall now
holic Aug 29, 2024
01d6e15
remove drive prefix
holic Aug 29, 2024
c02e37e
try without file:// prefix
holic Aug 29, 2024
277832a
more options
holic Aug 29, 2024
03844c2
simplify
holic Aug 29, 2024
5fee286
unix line endings
holic Aug 29, 2024
6c6e3a4
Merge remote-tracking branch 'origin/main' into holic/test-windows
holic Aug 29, 2024
4d78869
add debug output to CI build
holic Aug 29, 2024
5d0b130
show untracked
holic Aug 29, 2024
3653719
more logging
holic Aug 29, 2024
0a883ef
maybe fix cli paths
holic Aug 29, 2024
abf8ccb
throw if rootDir is not absolute dir
holic Aug 29, 2024
f51825d
more logs
holic Aug 29, 2024
37c8aae
Revert "throw if rootDir is not absolute dir"
holic Aug 29, 2024
b607133
try diff path libs
holic Aug 29, 2024
a98b34f
one last try
holic Aug 29, 2024
b758230
Merge remote-tracking branch 'origin/main' into holic/test-windows
holic Aug 29, 2024
1f49b7f
Revert "ci: disable windows (#3091)"
holic Aug 29, 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
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# ensure unix line endings
* text=auto eol=lf

# suppress diffs for generated files
**/pnpm-lock.yaml linguist-generated=true
**/codegen/**/*.sol linguist-generated=true
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ runs:

- name: Build
shell: bash
env:
DEBUG: mud:*
run: pnpm turbo run build --cache-dir=.turbo --concurrency 10

- name: Outdated files, run `pnpm build` and commit them
Expand Down
3 changes: 2 additions & 1 deletion .github/actions/require-empty-diff/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ runs:
shell: bash
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git status
pwd
git status -u
git --no-pager diff
exit 1
fi
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ env:
jobs:
build:
name: Build and validate artifacts
runs-on: ubuntu-latest
strategy:
matrix:
os: [depot-ubuntu-22.04-16, windows-latest]

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -36,6 +40,8 @@ jobs:
- name: Build
if: steps.check_changes.outputs.changes_outside_docs
shell: bash
env:
DEBUG: mud:*
run: pnpm turbo run build --concurrency 10

- name: Outdated files, run `pnpm build` and commit them
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ env:
jobs:
build:
name: Build template
runs-on: ubuntu-latest
strategy:
matrix:
os: [depot-ubuntu-22.04-16, windows-latest]
template: [vanilla, react, react-ecs, phaser, threejs]

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-published-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ jobs:
test-create-mud-project:
name: Test create-mud project
strategy:
fail-fast: false
matrix:
os: [depot-ubuntu-22.04-16]
os: [depot-ubuntu-22.04-16, windows-latest]
template: [vanilla, react, react-ecs, phaser, threejs]

runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/indexerSync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
openClientWithRootAccount,
} from "./setup";
import { range } from "@latticexyz/utils";
import path from "node:path";
import path from "node:path/posix";
import { rpcHttpUrl } from "./setup/constants";
import { z } from "zod";
import { callPageFunction } from "./data/callPageFunction";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/sync-test/setup/startIndexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { rmSync } from "node:fs";
import { cleanDatabase } from "@latticexyz/store-sync/postgres";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";
import path from "node:path";
import path from "node:path/posix";

type IndexerOptions =
| {
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/generate-bench-data-bulk.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "node:fs/promises";
import path from "node:path";
import path from "node:path/posix";
import { fileURLToPath } from "node:url";
import { startProxy } from "@viem/anvil";
import { generateLogs } from "./generateLogs";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/generate-bench-data-query.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "node:fs/promises";
import path from "node:path";
import path from "node:path/posix";
import { fileURLToPath } from "node:url";
import { createAnvil } from "@viem/anvil";
import { generateLogs } from "./generateLogs";
Expand Down
2 changes: 1 addition & 1 deletion e2e/packages/test-data/generate-test-data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "node:fs/promises";
import path from "node:path";
import path from "node:path/posix";
import { fileURLToPath } from "node:url";
import { createAnvil } from "@viem/anvil";
import { generateLogs } from "./generateLogs";
Expand Down
2 changes: 1 addition & 1 deletion packages/abi-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const commandModule: CommandModule<Options, Options> = {
},

handler({ input }) {
const files = globSync(input).sort();
const files = globSync(input, { posix: true }).sort();

if (!files.length) {
console.error(`No files found for glob: ${input}`);
Expand Down
17 changes: 10 additions & 7 deletions packages/cli/scripts/generate-test-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ import { defineStore } from "@latticexyz/store";
import { fileURLToPath } from "node:url";
import path from "node:path";

const configPath = fileURLToPath(import.meta.url);
console.log("import.meta.url", import.meta.url);
console.log("fileURLToPath", fileURLToPath(import.meta.url));
console.log("dirname", path.dirname(fileURLToPath(import.meta.url)));
const rootDir = path.posix.resolve(path.dirname(fileURLToPath(import.meta.url)), "../contracts");
console.log("rootDir", rootDir);

// This config is used only for tests.
// Aside from avoiding `mud.config.ts` in cli package (could cause issues),
// this also tests that mudConfig and tablegen can work as standalone functions
const config = defineStore({
sourceDirectory: "../contracts/src",
enums: {
Enum1: ["E1", "E2", "E3"],
Enum2: ["E1"],
},
userTypes: {
TestTypeAddress: { filePath: "../contracts/src/types.sol", type: "address" },
TestTypeInt64: { filePath: "../contracts/src/types.sol", type: "int64" },
"TestTypeLibrary.TestTypeBool": { filePath: "../contracts/src/types.sol", type: "bool" },
"TestTypeLibrary.TestTypeUint128": { filePath: "../contracts/src/types.sol", type: "uint128" },
TestTypeAddress: { filePath: "./src/types.sol", type: "address" },
TestTypeInt64: { filePath: "./src/types.sol", type: "int64" },
"TestTypeLibrary.TestTypeBool": { filePath: "./src/types.sol", type: "bool" },
"TestTypeLibrary.TestTypeUint128": { filePath: "./src/types.sol", type: "uint128" },
ResourceId: { filePath: "@latticexyz/store/src/ResourceId.sol", type: "bytes32" },
},
tables: {
Expand Down Expand Up @@ -95,4 +98,4 @@ const config = defineStore({
},
});

await tablegen({ rootDir: path.dirname(configPath), config });
await tablegen({ rootDir, config });
2 changes: 1 addition & 1 deletion packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { CommandModule } from "yargs";
import { loadConfig, resolveConfigPath } from "@latticexyz/config/node";
import { World as WorldConfig } from "@latticexyz/world";
import { build } from "../build";
import path from "node:path";
import path from "node:path/posix";

type Options = {
configPath?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/dev-contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { anvil, getScriptDirectory, getSrcDirectory } from "@latticexyz/common/f
import chalk from "chalk";
import chokidar from "chokidar";
import { loadConfig, resolveConfigPath } from "@latticexyz/config/node";
import path from "path";
import path from "node:path/posix";
import { World as WorldConfig } from "@latticexyz/world";
import { homedir } from "os";
import { rmSync } from "fs";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/devnode.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { rmSync } from "fs";
import { homedir } from "os";
import path from "path";
import path from "node:path/posix";
import type { CommandModule } from "yargs";
import { execa } from "execa";

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/set-version.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import chalk from "chalk";
import { readFileSync, writeFileSync } from "fs";
import path from "path";
import path from "node:path/posix";
import type { CommandModule } from "yargs";
import { MUDError } from "@latticexyz/common/errors";
import { logError } from "../utils/errors";
Expand Down Expand Up @@ -63,7 +63,7 @@ const commandModule: CommandModule<Options, Options> = {
}

// Update all package.json below the current working directory (except in node_modules)
const packageJsons = globSync("**/package.json")
const packageJsons = globSync("**/package.json", { posix: true })
.sort()
.filter((p) => !p.includes("node_modules"));

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/tablegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { CommandModule } from "yargs";
import { loadConfig, resolveConfigPath } from "@latticexyz/config/node";
import { Store as StoreConfig } from "@latticexyz/store";
import { tablegen } from "@latticexyz/store/codegen";
import path from "node:path";
import path from "node:path/posix";

type Options = {
configPath?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/trace.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "node:path";
import path from "node:path/posix";
import fs from "node:fs";
import type { CommandModule } from "yargs";
import { loadConfig, resolveConfigPath } from "@latticexyz/config/node";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/verify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getContractData } from "../utils/getContractData";
import { Hex, createWalletClient, http } from "viem";
import chalk from "chalk";
import { configToModules } from "../deploy/configToModules";
import path from "node:path";
import path from "node:path/posix";

const verifyOptions = {
deployerAddress: {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/worldgen.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "node:path";
import path from "node:path/posix";
import type { CommandModule } from "yargs";
import { loadConfig, resolveConfigPath } from "@latticexyz/config/node";
import { World as WorldConfig } from "@latticexyz/world";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/configToModules.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "node:path";
import path from "node:path/posix";
import { Module } from "./common";
import { encodeField } from "@latticexyz/protocol-parser/internal";
import { SchemaAbiType, SchemaAbiTypeToPrimitiveType } from "@latticexyz/schema-type/internal";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/findLibraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function findLibraries(forgeOutDir: string): readonly {
readonly path: string;
readonly name: string;
}[] {
const artifacts = globSync(`${forgeOutDir}/**/*.json`, { ignore: "**/*.abi.json" })
const artifacts = globSync(`${forgeOutDir}/**/*.json`, { ignore: "**/*.abi.json", posix: true })
.sort()
.map((path) => JSON.parse(readFileSync(path, "utf8")));

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/deploy/resolveConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "path";
import path from "node:path/posix";
import { loadSystemsManifest, resolveSystems } from "@latticexyz/world/node";
import { Library, System, WorldFunction } from "./common";
import { Hex, isHex, toFunctionSelector, toFunctionSignature } from "viem";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/runDeploy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "node:path";
import path from "node:path/posix";
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { InferredOptionTypes, Options } from "yargs";
import { deploy } from "./deploy/deploy";
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/getContractData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSync } from "fs";
import path from "path";
import path from "node:path/posix";
import { MUDError } from "@latticexyz/common/errors";
import { Abi, Hex, size } from "viem";
import { LibraryPlaceholder } from "../deploy/common";
Expand Down
14 changes: 0 additions & 14 deletions packages/cli/src/utils/getExistingContracts.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/cli/src/utils/postDeploy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { existsSync } from "fs";
import path from "path";
import path from "node:path/posix";
import chalk from "chalk";
import { getScriptDirectory, forge } from "@latticexyz/common/foundry";

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { defineConfig } from "tsup";
import { globSync } from "glob";
import { readFileSync } from "node:fs";
import path from "node:path";
import path from "node:path/posix";
import { MudPackages } from "./src/common";

const mudWorkspace = path.normalize(`${__dirname}/../..`);

const mudPackages: MudPackages = Object.fromEntries(
globSync(path.join(mudWorkspace, `packages/*/package.json`))
globSync(path.join(mudWorkspace, `packages/*/package.json`), { posix: true })
.sort()
.map((filename) => [
path.relative(mudWorkspace, path.dirname(filename)),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from "node:path";
import path from "node:path/posix";

// This will probably break for backslash-escaped POSIX paths,
// but we'll worry about that later.
Expand Down
3 changes: 1 addition & 2 deletions packages/common/src/codegen/utils/formatAndWrite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from "node:fs/promises";
import path from "node:path";
import path from "node:path/posix";
import { formatSolidity, formatTypescript } from "./format";
import { debug } from "../debug";

Expand All @@ -13,7 +13,6 @@ export async function formatAndWriteSolidity(output: string, fullOutputPath: str
const formattedOutput = await formatSolidity(output);

await fs.mkdir(path.dirname(fullOutputPath), { recursive: true });

await fs.writeFile(fullOutputPath, formattedOutput);
debug(`${logPrefix}: ${fullOutputPath}`);
}
Expand Down
1 change: 1 addition & 0 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"@latticexyz/schema-type": "workspace:*",
"esbuild": "^0.17.15",
"find-up": "^6.3.0",
"upath": "^2.0.1",
"viem": "catalog:"
},
"devDependencies": {
Expand Down
Loading
Loading