Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6ba1155
initial migration - support just Sdout and native target
lukewilliamboswell Dec 30, 2025
b1f3ce5
migrate Env and File effects, examples and tests
lukewilliamboswell Dec 30, 2025
5779c84
migrate test script
lukewilliamboswell Dec 30, 2025
c2b3e05
migrate command line example and test
lukewilliamboswell Dec 30, 2025
519d2af
add linux binaries libc and libunwind
lukewilliamboswell Dec 30, 2025
4774794
add linux CRT files
lukewilliamboswell Dec 30, 2025
08e14d4
migrate print-test
lukewilliamboswell Dec 30, 2025
e914e0a
migrate Dir functionality
lukewilliamboswell Dec 30, 2025
41f75f5
migrate Path
lukewilliamboswell Dec 30, 2025
3e6246a
update CI
lukewilliamboswell Dec 30, 2025
4f62b3b
improve error handling, use open tag union
lukewilliamboswell Dec 30, 2025
1fcef27
implement Random, Sleep, Utc modules
lukewilliamboswell Dec 30, 2025
953ed5f
migrate Cmd
lukewilliamboswell Dec 31, 2025
8c951de
fix some things
lukewilliamboswell Jan 5, 2026
1b6f5c6
remove Path.type! due to opaque type ABI issue
lukewilliamboswell Jan 5, 2026
49eb5d0
Restructure Cmd module and clean up orphaned tests
lukewilliamboswell Jan 5, 2026
73ca5fa
Update Cmd module to use static dispatch for effects
lukewilliamboswell Jan 7, 2026
41f87a4
Delete test-cmd-method-chaining
lukewilliamboswell Jan 7, 2026
6db4a74
Make Cmd an opaque nominal type
lukewilliamboswell Jan 7, 2026
c1d5baf
remove nix for now
lukewilliamboswell Jan 7, 2026
912b156
Fix command-line argument handling for static library builds
lukewilliamboswell Jan 7, 2026
4179f25
Use c_char instead of i8 for cross-platform compatibility
lukewilliamboswell Jan 7, 2026
b919143
Fix SIGPIPE error in release workflow on Linux
lukewilliamboswell Jan 7, 2026
f538094
Add explicit permissions blocks to CI workflows
lukewilliamboswell Jan 7, 2026
28a376e
small CI improvements
Anton-4 Jan 7, 2026
188e1b5
same setup-zig version everywhere
Anton-4 Jan 7, 2026
c0d20d9
use flaky-retry action
Anton-4 Jan 8, 2026
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
83 changes: 29 additions & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: CI

on:
pull_request:
workflow_dispatch:
Expand All @@ -8,71 +10,44 @@ concurrency:
cancel-in-progress: true

# Do not add permissions here! Configure them at the job level!
permissions: {}
permissions:
contents: read

jobs:
build-and-test-native:
build-and-test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-24.04-arm, macos-15]
steps:
- uses: actions/checkout@v4
os:
- macos-15 # Apple Silicon
- macos-15-intel # Intel Mac
- ubuntu-22.04 # Linux x86_64
- ubuntu-24.04-arm # Linux ARM64
defaults:
run:
shell: bash

- name: Does init() in platform/src/lib.rs contain all roc_fx functions? (Imperfect check)
run: cat platform/src/lib.rs | grep -oP 'roc_fx_[^(\s]*' | sort | uniq -u | grep -q . && exit 1 || exit 0
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: roc-lang/setup-roc@39c354a6a838a0089eea9068a0414f49b62c5c08
- name: Install Zig
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/[email protected]
with:
# Note: nightly hashes are not verified because they are updated regularly.
version: nightly
version: 0.15.2

- run: roc version

- name: Install dependencies (Ubuntu)
- name: Install expect (Ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt install -y expect ncat ripgrep
run: sudo apt-get install -y expect

- name: Install dependencies (macOS)
- name: Install expect (macOS)
if: startsWith(matrix.os, 'macos-')
run: |
brew install expect # expect for testing
brew install nmap # includes ncat, for tcp-client example
brew install ripgrep # ripgrep for ci/check_all_exposed_funs_tested.roc

- run: expect -v
run: brew install expect

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

- name: Install dependencies for musl build
if: startsWith(matrix.os, 'ubuntu-')
run: |
sudo apt-get install -y musl-tools
if [[ "${{ matrix.os }}" == *"-arm" ]]; then
# TODO re-enable once TODO below is done: rustup target add aarch64-unknown-linux-musl
echo "no-op"
else
rustup target add x86_64-unknown-linux-musl
fi

- name: Test building with musl target
if: startsWith(matrix.os, 'ubuntu-')
env:
ROC: roc
run: |
if [[ "${{ matrix.os}}" == *"-arm" ]]; then
# TODO debug this: CARGO_BUILD_TARGET=aarch64-unknown-linux-musl $ROC build.roc
echo "no-op"
else
CARGO_BUILD_TARGET=x86_64-unknown-linux-musl $ROC build.roc
fi

- name: Test using musl build
if: startsWith(matrix.os, 'ubuntu-')
run: |
# TODO remove `if` when above TODOs are done
if [[ "${{ matrix.os }}" != *"-arm" ]]; then
NO_BUILD=1 IS_MUSL=1 ROC=roc EXAMPLES_DIR=./examples/ ./ci/all_tests.sh
fi
uses: roc-lang/roc/.github/actions/flaky-retry@main
with:
command: ./ci/all_tests.sh
error_string_contains: "error: unable"
54 changes: 0 additions & 54 deletions .github/workflows/ci_nix.yml

This file was deleted.

230 changes: 230 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
name: Release

on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag (e.g., v0.1.0)'
required: true
type: string
pull_request:

# Ensure only one release workflow runs at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Do not add permissions here! Configure them at the job level!
permissions:
contents: read

env:
ZIG_VERSION: 0.15.2

jobs:
build-and-bundle:
name: Build and Bundle Platform
runs-on: macos-15 # macOS can cross-compile to all targets
outputs:
bundle_filename: ${{ steps.bundle.outputs.bundle_filename }}
defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Zig
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/[email protected]
with:
version: ${{ env.ZIG_VERSION }}

- name: Install Rust cross-compilation targets
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
rustup target add x86_64-unknown-linux-musl
rustup target add aarch64-unknown-linux-musl

- name: Build Roc from pinned commit
run: |
echo "Building roc from pinned commit..."
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"

zig build roc

echo "$(pwd)/zig-out/bin" >> "$GITHUB_PATH"

- name: Build platform for all targets
run: ./build.sh --all

- name: Bundle platform
id: bundle
run: |
# Run bundle.sh and capture output
BUNDLE_OUTPUT=$(./bundle.sh 2>&1)
echo "$BUNDLE_OUTPUT"

# Extract the tar.zst filename from "Created: /path/to/HASH.tar.zst" line
BUNDLE_PATH=$(echo "$BUNDLE_OUTPUT" | grep "^Created:" | awk '{print $2}')
BUNDLE_FILENAME=$(basename "$BUNDLE_PATH")

if [ -z "$BUNDLE_FILENAME" ]; then
echo "Error: Could not extract bundle filename from output"
echo "Bundle output was:"
echo "$BUNDLE_OUTPUT"
exit 1
fi

echo "Bundle created: $BUNDLE_FILENAME"
echo "bundle_filename=$BUNDLE_FILENAME" >> "$GITHUB_OUTPUT"

- name: Upload bundle artifact
uses: actions/upload-artifact@v4
with:
name: platform-bundle
path: ${{ steps.bundle.outputs.bundle_filename }}
retention-days: 30

test-bundle:
name: Test Bundle (${{ matrix.os }})
needs: build-and-bundle
strategy:
fail-fast: false
matrix:
os:
- macos-15 # Apple Silicon
- macos-15-intel # Intel Mac
- ubuntu-22.04 # Linux x86_64
- ubuntu-24.04-arm # Linux ARM64
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Zig
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/[email protected]
with:
version: ${{ env.ZIG_VERSION }}

- name: Install expect (Ubuntu)
if: startsWith(matrix.os, 'ubuntu-')
run: sudo apt-get install -y expect

- name: Install expect (macOS)
if: startsWith(matrix.os, 'macos-')
run: brew install expect

- name: Build Roc from pinned commit
run: |
echo "Building roc from pinned commit..."
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"

zig build roc

echo "$(pwd)/zig-out/bin" >> "$GITHUB_PATH"

- name: Download bundle artifact
uses: actions/download-artifact@v4
with:
name: platform-bundle

- name: Start HTTP server for bundle
run: |
# Start Python HTTP server in background on port 8000
python3 -m http.server 8000 &
HTTP_SERVER_PID=$!
echo "HTTP_SERVER_PID=$HTTP_SERVER_PID" >> "$GITHUB_ENV"

# Wait for server to start
sleep 5

# Verify server is running and bundle is accessible
if ! curl -f -I "http://localhost:8000/${{ needs.build-and-bundle.outputs.bundle_filename }}" > /dev/null 2>&1; then
echo "Error: HTTP server not accessible or bundle not found"
kill $HTTP_SERVER_PID || true
exit 1
fi

echo "HTTP server started on port 8000 (PID: $HTTP_SERVER_PID)"
echo "Bundle accessible at: http://localhost:8000/${{ needs.build-and-bundle.outputs.bundle_filename }}"

- name: Modify examples to use bundled platform
run: |
# Replace local platform path with HTTP URL in all examples
for example in examples/*.roc; do
sed -i.bak "s|platform \"../platform/main.roc\"|platform \"http://localhost:8000/${{ needs.build-and-bundle.outputs.bundle_filename }}\"|g" "$example"
done

# Show diff for verification
echo "Modified examples:"
git diff examples/ | head -50 || true

# Skip native build since we're using the bundle
# The test script will detect all targets exist and use bundle testing
# Run all tests against the bundled platform
- name: Run tests with bundled platform
uses: roc-lang/roc/.github/actions/flaky-retry@main
with:
command: bash ci/all_tests.sh
error_string_contains: "error: unable"
env:
NO_BUILD: "1"

create-release:
name: Create GitHub Release
needs: [build-and-bundle, test-bundle]
runs-on: ubuntu-24.04
# Only run on manual trigger
if: github.event_name == 'workflow_dispatch'
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download bundle artifact
uses: actions/download-artifact@v4
with:
name: platform-bundle

- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
BUNDLE_FILE=$(ls *.tar.zst | head -1)

if [ -z "$BUNDLE_FILE" ]; then
echo "Error: No bundle file found"
exit 1
fi

ROC_COMMIT=$(python3 ci/get_roc_commit.py | cut -c1-8)

# Create release with auto-generated notes
gh release create "${{ github.event.inputs.release_tag }}" \
"$BUNDLE_FILE" \
--title "${{ github.event.inputs.release_tag }}" \
--generate-notes \
--notes "Platform bundle built with Rust (stable) and Roc $ROC_COMMIT"

echo "Release created: ${{ github.event.inputs.release_tag }}"
echo "Bundle uploaded: $BUNDLE_FILE"
Loading
Loading