Skip to content

Commit d0927ce

Browse files
authored
feat: windows support (#219)
* feat: windows support * fix: try simpler glob path * ci: add windows to test matrix * fix: path append before eval * fix: update ci matrix script * fix: pass the whole env to the engine node * feat: add task to run plain release with tcp I got tired of building burrito releases on windows * fix: dialyzer warning * refactor: use quote + base64 to pass eval string This is the same method Livebook uses for the very same reasons * fix: ensure port mapper module is namespaced * fix: update tests for windows * fix: update option handling for unix * fix: broken rebase * fix: extend start timeout windows is slow :/ * chore: update ci matrix * fix: increase timeout in test for windows * fix: simple retry for flaky tests on windows * fix: increase timeout for windows horrible "fix" but I can't reproduce this issue locally and I don't know if it's CI slowness or something else going on
1 parent 123588e commit d0927ce

File tree

19 files changed

+386
-183
lines changed

19 files changed

+386
-183
lines changed

.github/matrix.json

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,141 @@
11
{
22
"include": [
33
{
4+
"os": "ubuntu-latest",
45
"otp": "28",
56
"elixir": "1.19",
67
"project": "engine"
78
},
89
{
10+
"os": "ubuntu-latest",
911
"otp": "28",
1012
"elixir": "1.18.4",
1113
"project": "engine"
1214
},
1315
{
16+
"os": "ubuntu-latest",
1417
"otp": "27",
1518
"elixir": "1.18",
1619
"project": "engine"
1720
},
1821
{
22+
"os": "ubuntu-latest",
1923
"otp": "26",
2024
"elixir": "1.18",
2125
"project": "engine"
2226
},
2327
{
28+
"os": "ubuntu-latest",
2429
"otp": "27",
2530
"elixir": "1.17",
2631
"project": "engine"
2732
},
2833
{
34+
"os": "ubuntu-latest",
2935
"otp": "26",
3036
"elixir": "1.17",
3137
"project": "engine"
3238
},
3339
{
40+
"os": "ubuntu-latest",
3441
"otp": "26",
3542
"elixir": "1.16",
3643
"project": "engine"
3744
},
3845
{
46+
"os": "ubuntu-latest",
3947
"otp": "28",
4048
"elixir": "1.19",
4149
"project": "expert_credo"
4250
},
4351
{
52+
"os": "ubuntu-latest",
4453
"otp": "28",
4554
"elixir": "1.18.4",
4655
"project": "expert_credo"
4756
},
4857
{
58+
"os": "ubuntu-latest",
4959
"otp": "27",
5060
"elixir": "1.18",
5161
"project": "expert_credo"
5262
},
5363
{
64+
"os": "ubuntu-latest",
5465
"otp": "26",
5566
"elixir": "1.18",
5667
"project": "expert_credo"
5768
},
5869
{
70+
"os": "ubuntu-latest",
5971
"otp": "27",
6072
"elixir": "1.17",
6173
"project": "expert_credo"
6274
},
6375
{
76+
"os": "ubuntu-latest",
6477
"otp": "26",
6578
"elixir": "1.17",
6679
"project": "expert_credo"
6780
},
6881
{
82+
"os": "ubuntu-latest",
6983
"otp": "26",
7084
"elixir": "1.16",
7185
"project": "expert_credo"
7286
},
7387
{
88+
"os": "ubuntu-latest",
7489
"otp": "28",
7590
"elixir": "1.19",
7691
"project": "forge"
7792
},
7893
{
94+
"os": "ubuntu-latest",
7995
"otp": "28",
8096
"elixir": "1.18.4",
8197
"project": "forge"
8298
},
8399
{
100+
"os": "ubuntu-latest",
84101
"otp": "27",
85102
"elixir": "1.18",
86103
"project": "forge"
87104
},
88105
{
106+
"os": "ubuntu-latest",
89107
"otp": "26",
90108
"elixir": "1.18",
91109
"project": "forge"
92110
},
93111
{
112+
"os": "ubuntu-latest",
94113
"otp": "27",
95114
"elixir": "1.17",
96115
"project": "forge"
97116
},
98117
{
118+
"os": "ubuntu-latest",
99119
"otp": "26",
100120
"elixir": "1.17",
101121
"project": "forge"
102122
},
103123
{
124+
"os": "ubuntu-latest",
104125
"otp": "26",
105126
"elixir": "1.16",
106127
"project": "forge"
107128
},
108129
{
130+
"os": "ubuntu-latest",
109131
"otp": "27.3.4.1",
110-
"elixir": "1.17.3",
132+
"elixir": "1.18.4",
133+
"project": "expert"
134+
},
135+
{
136+
"os": "windows-2022",
137+
"otp": "27.3.4.1",
138+
"elixir": "1.18.4",
111139
"project": "expert"
112140
}
113141
]

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,15 @@ jobs:
186186
run: echo "matrix=$(jq -c . < .github/matrix.json)" >> $GITHUB_OUTPUT
187187

188188
test:
189-
runs-on: ubuntu-latest
190-
name: Test ${{ matrix.project }} on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
189+
runs-on: ${{matrix.os}}
190+
name: Test ${{ matrix.project }} on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} / ${{matrix.os}}
191191
needs: prep-matrix
192192
strategy:
193193
matrix: ${{ fromJson(needs.prep-matrix.outputs.matrix) }}
194194
steps:
195+
- name: Set git to use original line ending (Windows)
196+
if: runner.os == 'Windows'
197+
run: git config --global core.autocrlf false
195198
- name: Checkout code
196199
uses: actions/checkout@v6
197200

apps/engine/lib/engine/mix.tasks.deps.safe_compile.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ unless Elixir.Features.compile_keeps_current_directory?() do
282282
makefile_win? = makefile_win?(dep)
283283

284284
command =
285-
case :os.type() do
285+
case Forge.OS.type() do
286286
{:win32, _} when makefile_win? ->
287287
"nmake /F Makefile.win"
288288

apps/engine/lib/engine/module/loader.ex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,18 @@ defmodule Engine.Module.Loader do
2323

2424
state ->
2525
result = Code.ensure_loaded(module_name)
26-
{result, Map.put(state, module_name, result)}
26+
# Note(doorgan): I'm not sure if it's just a timing issue, but on Windows it
27+
# can sometimes take a little bit before this function returns {:module, name}
28+
# so I figured not caching the error result here should work. This module is a
29+
# cache and I think most of the time this is called the module will already
30+
# have been loaded.
31+
new_state =
32+
case result do
33+
{:module, ^module_name} -> Map.put(state, module_name, result)
34+
_ -> state
35+
end
36+
37+
{result, new_state}
2738
end)
2839
end
2940

apps/engine/lib/engine/search/indexer.ex

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ defmodule Engine.Search.Indexer do
7070
with {:ok, contents} <- File.read(path),
7171
{:ok, entries} <- Indexer.Source.index(path, contents) do
7272
Enum.filter(entries, fn entry ->
73-
if contained_in?(path, deps_dir) do
73+
if Forge.Path.contains?(path, deps_dir) do
7474
entry.subtype == :definition
7575
else
7676
true
@@ -185,20 +185,15 @@ defmodule Engine.Search.Indexer do
185185
build_dir = build_dir()
186186

187187
[root_dir, "**", @indexable_extensions]
188-
|> Path.join()
189-
|> Path.wildcard()
190-
|> Enum.reject(&contained_in?(&1, build_dir))
188+
|> Forge.Path.glob()
189+
|> Enum.reject(&Forge.Path.contains?(&1, build_dir))
191190
end
192191

193192
# stat(path) is here for testing so it can be mocked
194193
defp stat(path) do
195194
File.stat(path)
196195
end
197196

198-
defp contained_in?(file_path, possible_parent) do
199-
String.starts_with?(file_path, possible_parent)
200-
end
201-
202197
defp deps_dir do
203198
case Engine.Mix.in_project(&Mix.Project.deps_path/0) do
204199
{:ok, path} -> path

0 commit comments

Comments
 (0)