Skip to content

Commit 614f2d5

Browse files
chore: cleanup CI debugging things
1 parent 245ebd7 commit 614f2d5

File tree

3 files changed

+24
-56
lines changed

3 files changed

+24
-56
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- run: expect -v
5050

5151
- name: Build platform binary
52-
run: ./roc_nightly/roc ./build.roc --release --path ./ --roc ./roc_nightly/roc
52+
run: ./roc_nightly/roc ./build.roc --release --cli ./roc_nightly/roc
5353

5454
- name: Run all tests
5555
run: ROC=./roc_nightly/roc EXAMPLES_DIR=./examples/ ./ci/all_tests.sh

.github/workflows/ci_nix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: uname -m
3333

3434
- name: Build platform binary
35-
run: nix develop -c sh -c 'roc ./build.roc --release --path ./ --roc roc'
35+
run: nix develop -c sh -c 'roc ./build.roc --release'
3636

3737
- name: Run all tests
3838
run: nix develop -c sh -c 'export ROC=roc && export EXAMPLES_DIR=./examples/ && ./ci/all_tests.sh'

build.roc

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,16 @@ import cli.Task exposing [Task]
77
import cli.Cmd
88
import cli.Stdout
99
import cli.Env
10-
import cli.File
1110
import cli.Arg
1211
import weaver.Opt
1312
import weaver.Cli
1413

15-
RocTarget : [
16-
MacosArm64,
17-
MacosX64,
18-
LinuxArm64,
19-
LinuxX64,
20-
WindowsArm64,
21-
WindowsX64,
22-
]
23-
2414
main =
2515

2616
cliParser =
2717
Cli.weave {
2818
release: <- Opt.flag { short: "r", long: "release", help: "Release build" },
29-
path: <- Opt.maybeStr { short: "p", long: "path", help: "Path to the workspace root"},
30-
roc: <- Opt.str { short: "d", long: "roc", help: "Path to the roc binary"},
19+
maybeRoc: <- Opt.maybeStr { short: "c", long: "cli", help: "Path to the roc cli"},
3120
}
3221
|> Cli.finish {
3322
name: "basic-webserver",
@@ -41,36 +30,25 @@ main =
4130
Ok args -> run args
4231
Err message -> Task.err (Exit 1 message)
4332

44-
run = \{ release, path, roc } ->
45-
46-
root = path |> Result.withDefault ""
33+
run = \{ release, maybeRoc } ->
4734

48-
info! "Checking working directory ..."
49-
"$(root)flake.nix"
50-
|> File.isFile
51-
|> Task.await \exists -> if exists then Task.ok {} else Task.err (ErrInvalidWorkingDir root)
52-
|> Task.mapErr! \err -> ErrWorkingDirectory err root
53-
54-
info! "Listing working directory ..."
55-
"ls"
56-
|> Cmd.exec ["-R", "$(root)"]
57-
|> Task.mapErr! ErrListingWorkingDir
35+
roc = maybeRoc |> Result.withDefault "roc"
5836

5937
info! "Generating glue for builtins ..."
6038
roc
61-
|> Cmd.exec ["glue", "$(root)glue.roc", "$(root)crates/", "$(root)platform/main.roc"]
39+
|> Cmd.exec ["glue", "glue.roc", "crates/", "platform/main.roc"]
6240
|> Task.mapErr! ErrGeneratingGlue
6341

6442
info! "Getting the native target ..."
6543
target =
6644
Env.platform
6745
|> Task.await! getNativeTarget
6846

69-
stubPath = "$(root)platform/libapp.$(stubExt target)"
47+
stubPath = "platform/libapp.$(stubExt target)"
7048

7149
info! "Building stubbed app shared library ..."
7250
roc
73-
|> Cmd.exec ["build", "--lib", "$(root)platform/libapp.roc", "--output", stubPath]
51+
|> Cmd.exec ["build", "--lib", "platform/libapp.roc", "--output", stubPath]
7452
|> Task.mapErr! ErrBuildingAppStub
7553

7654
(cargoBuildArgs, message) =
@@ -84,31 +62,31 @@ run = \{ release, path, roc } ->
8462
|> Cmd.exec cargoBuildArgs
8563
|> Task.mapErr! ErrBuildingHostBinaries
8664

87-
hostBuildPath = if release then "$(root)target/release/libhost.a" else "$(root)target/debug/libhost.a"
88-
hostDestPath = "$(root)platform/$(prebuiltStaticLibrary target)"
65+
hostBuildPath = if release then "target/release/libhost.a" else "target/debug/libhost.a"
66+
hostDestPath = "platform/$(prebuiltStaticLibrary target)"
8967

9068
info! "Moving the prebuilt binary from $(hostBuildPath) to $(hostDestPath) ..."
9169
"cp"
9270
|> Cmd.exec [hostBuildPath, hostDestPath]
9371
|> Task.mapErr! ErrMovingPrebuiltLegacyBinary
9472

95-
# TODO remove this, just a temporary workaround to see if this makes CI happy
96-
# if so we know that linux requires an object `.o` file for some reason...
97-
prebuiltObjectPath = "$(root)platform/$(prebuiltObject target)"
98-
info! "Moving the prebuilt binary from $(hostBuildPath) to $(prebuiltObjectPath) ..."
99-
"cp"
100-
|> Cmd.exec [hostBuildPath, prebuiltObjectPath]
101-
|> Task.mapErr! ErrMovingPrebuiltLegacyObject
102-
103-
# SURGICAL LINKER IS NOT YET SUPPORTED need to merge https://github.com/roc-lang/roc/pull/6808
104-
#info! "Preprocessing surgical host ..."
105-
#surgicalBuildPath = if release then "target/release/host" else "target/debug/host"
106-
#roc
107-
# |> Cmd.exec ["preprocess-host", surgicalBuildPath, "platform/main.roc", stubPath]
108-
# |> Task.mapErr! ErrPreprocessingSurgicalBinary
73+
info! "Preprocessing surgical host ..."
74+
surgicalBuildPath = if release then "target/release/host" else "target/debug/host"
75+
roc
76+
|> Cmd.exec ["preprocess-host", surgicalBuildPath, "platform/main.roc", stubPath]
77+
|> Task.mapErr! ErrPreprocessingSurgicalBinary
10978

11079
info! "Successfully completed building platform binaries."
11180

81+
RocTarget : [
82+
MacosArm64,
83+
MacosX64,
84+
LinuxArm64,
85+
LinuxX64,
86+
WindowsArm64,
87+
WindowsX64,
88+
]
89+
11290
getNativeTarget : _ -> Task RocTarget _
11391
getNativeTarget =\{os, arch} ->
11492
when (os, arch) is
@@ -135,16 +113,6 @@ prebuiltStaticLibrary = \target ->
135113
WindowsArm64 -> "windows-arm64.lib"
136114
WindowsX64 -> "windows-x64.lib"
137115

138-
prebuiltObject : RocTarget -> Str
139-
prebuiltObject = \target ->
140-
when target is
141-
MacosArm64 -> "macos-arm64.a"
142-
MacosX64 -> "macos-x64.a"
143-
LinuxArm64 -> "linux-arm64.a"
144-
LinuxX64 -> "linux-x64.a"
145-
WindowsArm64 -> "windows-arm64.lib"
146-
WindowsX64 -> "windows-x64.lib"
147-
148116
info : Str -> Task {} _
149117
info = \msg ->
150118
Stdout.line! "\u(001b)[34mINFO:\u(001b)[0m $(msg)"

0 commit comments

Comments
 (0)