Skip to content

Commit 2f7b6b2

Browse files
committed
fix windows cache
1 parent 14ae194 commit 2f7b6b2

File tree

4 files changed

+47
-15
lines changed

4 files changed

+47
-15
lines changed

.github/workflows/ci.yml

+44-12
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ jobs:
108108
- name: Checkout
109109
uses: actions/checkout@v4
110110

111+
- name: Setup Python for ninja build
112+
uses: actions/setup-python@v5
113+
with:
114+
python-version: '3.10'
115+
111116
- name: Build compiler binaries
112117
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01
113118
with:
@@ -116,7 +121,7 @@ jobs:
116121
- name: Build ninja binary
117122
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01
118123
with:
119-
args: sh -c "cd ninja && LDFLAGS=-static python3 configure.py --bootstrap"
124+
args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap"
120125

121126
- name: "Upload artifacts"
122127
uses: actions/upload-artifact@v4
@@ -223,26 +228,32 @@ jobs:
223228
chmod +x rewatch/rewatch
224229
chmod +x _build/install/default/bin/*
225230
226-
- name: Install dependencies
231+
- name: Install dependencies (Linux)
227232
if: runner.os == 'Linux'
228233
uses: awalsh128/[email protected]
229234
with:
230-
# See https://github.com/ocaml/setup-ocaml/blob/92dde8cf/packages/setup-ocaml/src/unix.ts#L13
235+
# See https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/unix.ts#L9
231236
packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync
232237
version: v1
233238

239+
- name: Setup Python for ninja build
240+
uses: actions/setup-python@v5
241+
with:
242+
python-version: '3.10'
243+
234244
- name: Restore OPAM environment
235245
id: cache-opam-env
236246
uses: actions/cache/restore@v4
237247
with:
238248
path: |
239249
${{ runner.tool_cache }}/opam
240250
~/.opam
241-
~/cygwin
242251
_opam
243252
.opam-path
244253
.opam-env
245-
key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }}
254+
D:\cygwin
255+
D:\.opam
256+
key: opam-env-v8-${{ matrix.os }}-${{ hashFiles('dune-project') }}
246257

247258
- name: Use OCaml ${{matrix.ocaml_compiler}}
248259
uses: ocaml/setup-ocaml@v2
@@ -252,7 +263,7 @@ jobs:
252263
opam-pin: false
253264
opam-depext: false
254265

255-
- name: Use OCaml ${{matrix.ocaml_compiler}} (Win)
266+
- name: Use OCaml ${{matrix.ocaml_compiler}} (Windows)
256267
uses: ocaml/setup-ocaml@v2
257268
if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
258269
with:
@@ -281,36 +292,57 @@ jobs:
281292
path: |
282293
${{ runner.tool_cache }}/opam
283294
~/.opam
284-
~/cygwin
285295
_opam
286296
.opam-path
287297
.opam-env
288-
key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }}
298+
D:\cygwin
299+
D:\.opam
300+
key: opam-env-v8-${{ matrix.os }}-${{ hashFiles('dune-project') }}
289301

290302
- name: Use cached OPAM environment
291303
if: steps.cache-opam-env.outputs.cache-hit == 'true'
292304
run: |
305+
# https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/installer.ts#L33
306+
echo "OPAMVERBOSE=$RUNNER_DEBUG" >> "$GITHUB_ENV"
307+
echo "OPAMCOLOR=always" >> "$GITHUB_ENV"
308+
echo "OPAMCONFIRMLEVEL=unsafe-yes" >> "$GITHUB_ENV"
309+
echo "OPAMERRLOGLEN=0" >> "$GITHUB_ENV"
310+
echo "OPAMPRECISETRACKING=1" >> "$GITHUB_ENV"
311+
echo "OPAMYES=1" >> "$GITHUB_ENV"
312+
313+
if [[ "$RUNNER_OS" != "Windows" ]]; then
314+
echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV"
315+
else
316+
echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV"
317+
fi
318+
293319
if [[ "$RUNNER_OS" != "Windows" ]]; then
294320
OPAM_PATH="$(cat .opam-path)"
295321
chmod +x "$OPAM_PATH"
296322
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
297323
298324
else
325+
fsutil behavior query SymlinkEvaluation
326+
fsutil behavior set symlinkEvaluation R2L:1 R2R:1
327+
fsutil behavior query SymlinkEvaluation
328+
299329
CYGWIN="winsymlinks:native"
300330
CYGWIN_ROOT="D:\\cygwin"
301-
CYGWIN_ROOT_BIN="D:\\cygwin\\bin"
331+
CYGWIN_ROOT_BIN="D:\\cygwin/bin"
302332
CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin"
303333
334+
echo "HOME=$USERPROFILE" >> "$GITHUB_ENV"
335+
echo "MSYS=winsymlinks:native" >> "$GITHUB_ENV"
304336
echo "CYGWIN=$CYGWIN" >> "$GITHUB_ENV"
305337
echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV"
306338
echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV"
307339
echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV"
308340
309-
echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH"
341+
# echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH"
310342
echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH"
311343
fi
312344
313-
sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV"
345+
# sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV"
314346
shell: bash
315347

316348
- name: Build compiler
@@ -325,7 +357,7 @@ jobs:
325357
- name: Install npm packages
326358
run: npm ci --ignore-scripts
327359

328-
- name: "Windows: Use MSVC for ninja build"
360+
- name: Setup MSVC for ninja build (Windows)
329361
if: runner.os == 'Windows'
330362
uses: TheMrMilchmann/setup-msvc-dev@v3
331363
with:

ninja/misc/ci.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env python
22

33
import os
44

ninja/misc/output_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python3
1+
#!/usr/bin/env python
22

33
"""Runs ./ninja and checks if the output is correct.
44

scripts/buildNinjaBinary.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const path = require("path");
55

66
const platform = process.platform;
77
const ninjaDir = path.join(__dirname, "..", "ninja");
8-
const buildCommand = "python3 configure.py --bootstrap --verbose";
8+
const buildCommand = "python configure.py --bootstrap --verbose";
99

1010
if (platform === "win32") {
1111
// On Windows, the build uses the MSVC compiler which needs to be on the path.

0 commit comments

Comments
 (0)