Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ name: CI

on:
pull_request:
push:
branches:
- main
schedule:
# Run daily at 10 AM UTC, after the nightlies are typically published.
- cron: '0 10 * * *'
workflow_dispatch: # Allow manual triggering

jobs:
test:
Expand All @@ -15,7 +16,7 @@ jobs:
matrix:
os:
- ubuntu-24.04
- macos-15
- macos-15-intel
- windows-2025
defaults:
run:
Expand All @@ -26,29 +27,17 @@ jobs:
uses: actions/checkout@v4

- name: Install Zig
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/setup-zig@v2.0.5
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
with:
version: 0.15.2
version: 0.16.0
use-cache: false

- name: Clone Roc source
run: |
ROC_COMMIT=$(python3 ci/get_roc_commit.py)

git init roc-src
cd roc-src
git remote add origin https://github.com/roc-lang/roc
git fetch --depth 1 origin "$ROC_COMMIT"
git checkout --detach "$ROC_COMMIT"

- name: Build Roc
uses: roc-lang/roc/.github/actions/flaky-retry@3d0fdde9ae6ffb5ef411f8c8c2fc2cdce22a74fe
- name: Install Roc
uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b
with:
command: cd roc-src && zig build roc
error_string_contains: "build.zig.zon"
# Installs the latest nightly from https://github.com/roc-lang/nightlies
version: nightly-new-compiler

- name: Add Roc to PATH
run: echo "$(pwd)/roc-src/zig-out/bin" >> "$GITHUB_PATH"

- name: Run checks
run: ci/all_tests.sh
65 changes: 24 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
type: string
pull_request:

env:
ZIG_VERSION: "0.16.0"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -28,29 +31,16 @@ jobs:
uses: actions/checkout@v4

- name: Install Zig
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/setup-zig@v2.0.5
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
with:
version: 0.15.2
version: ${{ env.ZIG_VERSION }}
use-cache: false

- name: Clone Roc source
run: |
ROC_COMMIT=$(python3 ci/get_roc_commit.py)

git init roc-src
cd roc-src
git remote add origin https://github.com/roc-lang/roc
git fetch --depth 1 origin "$ROC_COMMIT"
git checkout --detach "$ROC_COMMIT"

- name: Build Roc
uses: roc-lang/roc/.github/actions/flaky-retry@3d0fdde9ae6ffb5ef411f8c8c2fc2cdce22a74fe
- name: Install Roc
uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b
with:
command: cd roc-src && zig build roc
error_string_contains: "build.zig.zon"

- name: Add Roc to PATH
run: echo "$(pwd)/roc-src/zig-out/bin" >> "$GITHUB_PATH"
# Installs the latest nightly from https://github.com/roc-lang/nightlies
version: nightly-new-compiler

- name: Check format and package
run: |
Expand Down Expand Up @@ -90,7 +80,7 @@ jobs:
matrix:
os:
- ubuntu-24.04
- macos-15
- macos-15-intel
- windows-2025
defaults:
run:
Expand All @@ -101,29 +91,16 @@ jobs:
uses: actions/checkout@v4

- name: Install Zig
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/setup-zig@v2.0.5
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # 2.2.1
with:
version: 0.15.2
version: ${{ env.ZIG_VERSION }}
use-cache: false

- name: Clone Roc source
run: |
ROC_COMMIT=$(python3 ci/get_roc_commit.py)

git init roc-src
cd roc-src
git remote add origin https://github.com/roc-lang/roc
git fetch --depth 1 origin "$ROC_COMMIT"
git checkout --detach "$ROC_COMMIT"

- name: Build Roc
uses: roc-lang/roc/.github/actions/flaky-retry@3d0fdde9ae6ffb5ef411f8c8c2fc2cdce22a74fe
- name: Install Roc
uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b
with:
command: cd roc-src && zig build roc
error_string_contains: "build.zig.zon"

- name: Add Roc to PATH
run: echo "$(pwd)/roc-src/zig-out/bin" >> "$GITHUB_PATH"
# Installs the latest nightly from https://github.com/roc-lang/nightlies
version: nightly-new-compiler

- name: Download package bundle artifact
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -157,15 +134,21 @@ jobs:
name: package-bundle
path: dist

- name: Install Roc
uses: roc-lang/setup-roc@bd311e2fb815a3d2255f7ee14a922f0b736e020b
with:
# Installs the latest nightly from https://github.com/roc-lang/nightlies
version: nightly-new-compiler

- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
BUNDLE_FILE="dist/${{ needs.build-bundle.outputs.bundle_filename }}"
ROC_COMMIT=$(python3 ci/get_roc_commit.py | cut -c1-8)
ROC_VERSION=$(roc version)

gh release create "${{ github.event.inputs.release_tag }}" \
"$BUNDLE_FILE" \
--title "${{ github.event.inputs.release_tag }}" \
--generate-notes \
--notes "HTTP package bundle built with Roc $ROC_COMMIT."
--notes "HTTP package bundle built with Roc $ROC_VERSION."
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist/
generated-docs/
roc-src/
__pycache__/
.roc-http-tmp/
1 change: 0 additions & 1 deletion ci/ROC_COMMIT

This file was deleted.

13 changes: 10 additions & 3 deletions ci/all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ cd "$root_dir"

if [ -n "${ROC_HTTP_TMPDIR:-}" ]; then
tmp_base="$ROC_HTTP_TMPDIR"
elif [ -d /private/tmp ]; then
tmp_base=/private/tmp
else
tmp_base="${TMPDIR:-/tmp}"
tmp_base="$root_dir/.roc-http-tmp"
fi
export ROC_HTTP_TMPDIR="$tmp_base"

tmp_dir="$tmp_base/roc-http-ci"
docs_dir="$tmp_dir/docs"
Expand All @@ -37,6 +36,14 @@ echo ""
echo "Generating package docs..."
roc docs package/main.roc --output="$docs_dir"

case "$(uname -s)" in
MINGW* | MSYS* | CYGWIN*)
echo ""
echo "Skipping package bundling on Windows."
exit 0
;;
esac

echo ""
echo "Bundling package..."
scripts/bundle.sh --output-dir "$bundle_dir"
Expand Down
19 changes: 0 additions & 19 deletions ci/get_roc_commit.py

This file was deleted.

13 changes: 6 additions & 7 deletions ci/test_bundle_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,25 +85,23 @@ def copy_examples_with_bundle_url(examples_dir: Path, bundle_url: str) -> list[P


def run_example_checks(examples: list[Path]) -> None:
run(["roc", "fmt", "--check", str(examples[0].parent)])

for example in examples:
run(["roc", "check", str(example), "--no-cache"])
run(["roc", "check", example.name, "--no-cache"], cwd=example.parent)


def run_example_apps(examples: list[Path]) -> None:
for example in examples:
if example.name == "tests.roc":
continue
run(["roc", str(example), "--no-cache"])
run(["roc", example.name, "--no-cache"], cwd=example.parent)


def run_example_tests(examples: list[Path]) -> None:
tests = [example for example in examples if example.name == "tests.roc"]
if len(tests) != 1:
raise SystemExit("Expected exactly one examples/tests.roc file")

run(["roc", "test", str(tests[0]), "--no-cache"])
run(["roc", "test", tests[0].name, "--no-cache"], cwd=tests[0].parent)


def build_and_run_examples(examples: list[Path], build_dir: Path) -> None:
Expand All @@ -115,7 +113,7 @@ def build_and_run_examples(examples: list[Path], build_dir: Path) -> None:
continue

output = build_dir / f"{example.stem}{exe_suffix}"
run(["roc", "build", str(example), f"--output={output}", "--no-cache"])
run(["roc", "build", example.name, f"--output={output}", "--no-cache"], cwd=example.parent)
run([str(output)])


Expand All @@ -125,8 +123,9 @@ def main() -> None:
parser.add_argument("--skip-build-run", action="store_true", help="Skip compiled example execution")
args = parser.parse_args()

default_tmp = Path("/private/tmp") if Path("/private/tmp").exists() else Path(tempfile.gettempdir())
default_tmp = ROOT / ".roc-http-tmp"
tmp_parent = Path(os.environ.get("ROC_HTTP_TMPDIR", default_tmp))
tmp_parent.mkdir(parents=True, exist_ok=True)

with tempfile.TemporaryDirectory(prefix="roc-http-bundle-", dir=tmp_parent) as tmp:
tmp_dir = Path(tmp)
Expand Down
2 changes: 1 addition & 1 deletion examples/body_bytes.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/custom_method.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
4 changes: 2 additions & 2 deletions examples/headers.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand All @@ -11,7 +11,7 @@ header_to_str = |(name, value)|
"${name}: ${value}"

headers_to_str = |headers|
headers.map(header_to_str).join_with("\n")
Str.join_with(headers.map(header_to_str), "\n")

main! = |_args| {
request0 = Request.from_method(GET)
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_request.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/mock_send.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/response.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/router.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/tests.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
2 changes: 1 addition & 1 deletion examples/timeouts.roc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.7/DuRUyJh31Gt41YArMcVcvybLa2bCWboccWQ7Zq1KZPZ6.tar.zst",
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.9/8GdFEvQYS3TeAZxKvTzCLVdQiomweGtXcdZkXNDEeABq.tar.zst",
http: "../package/main.roc",
}

Expand Down
Loading