Skip to content

Commit 3346b9c

Browse files
committed
bulndle on release
1 parent 19d7789 commit 3346b9c

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed

.github/workflows/release.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build on Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
# Allow for manual trigger for now
9+
workflow_dispatch:
10+
11+
jobs:
12+
bundle-and-release:
13+
name: Bundle and release library
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
18+
steps:
19+
- name: Check out the repository
20+
uses: actions/checkout@v4
21+
22+
- name: Install Roc
23+
uses: hasnep/setup-roc@main
24+
with:
25+
roc-version: nightly
26+
27+
- name: Install Go
28+
uses: actions/setup-go@v5
29+
with:
30+
go-version-file: 'host/go.mod'
31+
32+
- name: Install Zig
33+
uses: goto-bus-stop/setup-zig@v2
34+
with:
35+
version: 0.11.0
36+
37+
- name: Build platform
38+
run: roc run build_ci.roc
39+
40+
- name: Bundle and release the library
41+
uses: hasnep/bundle-roc-library@main
42+
with:
43+
library: platform/main.roc
44+
token: ${{ github.token }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
generated-docs/
22

33
build
4+
build_ci
45
app
56

67
*.a
@@ -9,6 +10,8 @@ app
910
*.ll
1011
*.so
1112
*.o
13+
*.h
14+
*.obj
1215

1316
host/libhost.h
1417

build_ci.roc

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
app [main] { cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
2+
3+
import cli.Cmd
4+
import cli.Stdout
5+
6+
main =
7+
buildForLegacyLinker!
8+
9+
buildForLegacyLinker =
10+
[MacosArm64, MacosX64, LinuxArm64, LinuxX64, WindowsArm64, WindowsX64]
11+
|> List.map \target -> buildDotA target
12+
|> Task.sequence
13+
|> Task.map \_ -> {}
14+
|> Task.mapErr! \_ -> BuildForLegacyLinker
15+
16+
buildDotA = \target ->
17+
(goos, goarch, zigTarget, prebuiltBinary) =
18+
when target is
19+
MacosArm64 -> ("darwin", "arm64", "aarch64-macos", "macos-arm64.a")
20+
MacosX64 -> ("darwin", "amd64", "x86_64-macos", "macos-x64.a")
21+
LinuxArm64 -> ("linux", "arm64", "aarch64-linux", "linux-arm64.a")
22+
LinuxX64 -> ("linux", "amd64", " x86_64-linux", "linux-x64.a")
23+
WindowsArm64 -> ("windows", "arm64", "aarch64-windows", "windows-arm64.obj")
24+
WindowsX64 -> ("windows", "amd64", "x86_64-windows", "windows-x64.obj")
25+
Stdout.line! "build host for $(Inspect.toStr target)"
26+
Cmd.new "go"
27+
|> Cmd.envs [("GOOS", goos), ("GOARCH", goarch), ("CC", "zig cc -target $(zigTarget)"), ("CGO_ENABLED", "1")]
28+
|> Cmd.args ("build -C host -buildmode c-archive -o ../platform/$(prebuiltBinary) -tags legacy,netgo" |> Str.split " ")
29+
|> Cmd.status
30+
|> Task.mapErr! \err -> BuildErr target (Inspect.toStr err)

host/roc/roc_std.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define ROC_STD
33

44
#include <stdlib.h>
5+
#include <stdint.h>
56

67
struct RocStr {
78
char* bytes;

0 commit comments

Comments
 (0)