From 16abff03de38f6c55e4997ab35314ae9372f6e6d Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Sun, 19 Jul 2026 15:22:52 +0200 Subject: [PATCH 1/5] json update + fmt --- examples/headers.roc | 12 +++++------- examples/router.roc | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/examples/headers.roc b/examples/headers.roc index c2ee92f..34e0fba 100644 --- a/examples/headers.roc +++ b/examples/headers.roc @@ -21,13 +21,11 @@ main! : List(Str) => Try({}, [Exit(I32), StdoutErr(Str), ..]) main! = |_args| { request = Request.from_method(GET) .with_uri("https://api.example.com/items") - .with_headers( - [ - { name: "Accept", value: "application/json" }, - { name: "X-Trace-Id", value: "demo-123" }, - { name: "X-Trace-Id", value: "demo-456" }, - ], - ) + .with_headers([ + { name: "Accept", value: "application/json" }, + { name: "X-Trace-Id", value: "demo-123" }, + { name: "X-Trace-Id", value: "demo-456" }, + ]) Stdout.line!(Str.inspect(request.headers()))? diff --git a/examples/router.roc b/examples/router.roc index 03cbda9..5165302 100644 --- a/examples/router.roc +++ b/examples/router.roc @@ -31,14 +31,14 @@ JsonOkBody : { ok : Bool, } -WidgetRequestError : [BadBodyUtf8, BadBodyJson(Json)] +WidgetRequestError : [BadBodyUtf8, BadBodyJson(Json.ParseErr)] body_str : Response -> Str body_str = |response| Str.from_utf8(response.body()) ?? "" json_response : U16, _ -> Try(Response, _) json_response = |status, body| { - json = Json.encode(body)? + json = Json.to_str_try(body)? Ok( Response.from_status(status) From 61aefe89ccee074a2c55fe462012d1140522831c Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Sun, 19 Jul 2026 15:25:29 +0200 Subject: [PATCH 2/5] add aarch64 macos --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a08fe74..261abfb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,8 @@ jobs: matrix: os: - ubuntu-24.04 - - macos-15-intel + - macos-26 + - macos-26-intel - windows-2025 defaults: run: From af78c5faf2a75ba6246d5d17ce6bfeb4c95d3265 Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Sun, 19 Jul 2026 16:20:29 +0200 Subject: [PATCH 3/5] actually updatee to latest Roc --- examples/headers.roc | 12 ++++++++++-- examples/router.roc | 15 +++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/examples/headers.roc b/examples/headers.roc index 34e0fba..f5b40a0 100644 --- a/examples/headers.roc +++ b/examples/headers.roc @@ -44,7 +44,15 @@ expect { } ## Header parsing reports missing required fields. -expect parse_headers("content-length: 42\r\nx-trace-id: demo-123\r\n") == Err(Encoding.HttpHeader.MissingRequired) +expect + match parse_headers("content-length: 42\r\nx-trace-id: demo-123\r\n") { + Err(Encoding.HttpHeader.MissingRequired) => Bool.True + _ => Bool.False + } ## Header parsing reports invalid field values. -expect parse_headers("accept: application/json\r\ncontent-length: nope\r\nx-trace-id: demo-123\r\n") == Err(Encoding.HttpHeader.BadHeader) +expect + match parse_headers("accept: application/json\r\ncontent-length: nope\r\nx-trace-id: demo-123\r\n") { + Err(Encoding.HttpHeader.BadHeader) => Bool.True + _ => Bool.False + } diff --git a/examples/router.roc b/examples/router.roc index 8e350be..9de1d7c 100644 --- a/examples/router.roc +++ b/examples/router.roc @@ -36,16 +36,11 @@ WidgetRequestError : [BadBodyUtf8, BadBodyJson(Json.ParseErr)] body_str : Response -> Str body_str = |response| Str.from_utf8(response.body()) ?? "" -json_response : U16, _ -> Try(Response, _) -json_response = |status, body| { - json = Json.to_str_try(body)? - - Ok( - Response.from_status(status) - .add_header("Content-Type", "application/json") - .with_body(json.to_utf8()), - ) -} +json_response : U16, _ -> Response +json_response = |status, body| + Response.from_status(status) + .add_header("Content-Type", "application/json") + .with_body(Json.to_str(body).to_utf8()) json_error : U16, Str -> Response json_error = |status, message| { From 886b96dcb301f8ba02f82ca47c4fcfa336dfd2cb Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Sun, 19 Jul 2026 16:27:28 +0200 Subject: [PATCH 4/5] CI updates --- .github/workflows/release.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9958069..5c28782 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install Zig uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1 @@ -65,7 +65,7 @@ jobs: echo "bundle_filename=$BUNDLE_FILENAME" >> "$GITHUB_OUTPUT" - name: Upload package bundle artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: package-bundle path: dist/${{ steps.bundle.outputs.bundle_filename }} @@ -80,7 +80,9 @@ jobs: matrix: os: - ubuntu-24.04 - - macos-15-intel + - ubuntu-24.04-arm + - macos-26 + - macos-26-intel - windows-2025 defaults: run: @@ -88,7 +90,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install Zig uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1 @@ -103,7 +105,7 @@ jobs: version: nightly-new-compiler - name: Download package bundle artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: package-bundle path: dist @@ -126,10 +128,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Download package bundle artifact - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: package-bundle path: dist From b970bcddffd0bee480af663087fb80f1173f0d8c Mon Sep 17 00:00:00 2001 From: Anton-4 <17049058+Anton-4@users.noreply.github.com> Date: Sun, 19 Jul 2026 16:28:02 +0200 Subject: [PATCH 5/5] test on ubuntu arm64 too --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 261abfb..e0c2d6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ jobs: matrix: os: - ubuntu-24.04 + - ubuntu-24.04-arm - macos-26 - macos-26-intel - windows-2025