Skip to content

Commit 80ee298

Browse files
Clean up migrate zig compiler branch
2 parents e25412e + d46ca95 commit 80ee298

80 files changed

Lines changed: 46 additions & 6316 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-docs.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
uses: actions/checkout@v4
3434

3535
- name: Install Zig
36-
uses: mlugg/setup-zig@v2
36+
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/setup-zig@v2.0.5
3737
with:
3838
version: 0.16.0
3939

@@ -97,7 +97,7 @@ jobs:
9797
uses: actions/checkout@v4
9898

9999
- name: Install Zig
100-
uses: mlugg/setup-zig@v2
100+
uses: mlugg/setup-zig@8d6198c65fb0feaa111df26e6b467fea8345e46f # ratchet:mlugg/setup-zig@v2.0.5
101101
with:
102102
version: 0.16.0
103103

.github/workflows/test_latest_release.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,7 @@ bench-folder*
5757
*.roc-format-failed-ast-after
5858
*.roc-format-failed-ast-before
5959

60-
# Tests
61-
file-test
62-
example-stdin
63-
http-get-json
64-
file-read-buffered
65-
temp-dir
66-
env-var
60+
# Test artifacts
6761
out.txt
6862

6963
# Downloaded Roc nightly
@@ -83,9 +77,6 @@ all_tests_output.log
8377
# Old build artifacts (platform/*.a was pre-migration location)
8478
platform/*.a
8579

86-
ci/check_all_exposed_funs_tested
87-
ci/check_cargo_versions_match
88-
8980
# build script artifacts
9081
build
9182

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ The pinned Roc compiler commit lives in `.roc-version`. To update it:
1212
2. Run `./ci/regenerate_glue.sh` to refresh `src/roc_platform_abi.rs`.
1313
3. Run `cargo check` and `./ci/all_tests.sh` to verify the new compiler works.
1414

15-
## How to generate docs?
15+
## Documentation
1616

17-
TODO describe how to generate docs once `roc docs` is implemented in the new compiler
17+
Generated Roc docs are currently disabled for this migration branch because `roc docs` is not implemented in the new compiler backend yet. Update this section and restore docs CI when that command is available again.
1818

1919
## Regenerating Rust Glue
2020

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
# basic-cli
77

8-
A Roc [platform](https://github.com/roc-lang/roc/wiki/Roc-concepts-explained#platform) to work with files, commands, HTTP, TCP, command line arguments,...
8+
A Roc [platform](https://github.com/roc-lang/roc/wiki/Roc-concepts-explained#platform) for command-line programs.
9+
10+
This migration branch supports command execution, directories, environment variables, files, locales, paths, random seeds, sleeping, standard input/output/error, terminal raw mode, and UTC time. HTTP, TCP, SQLite, and URL helpers from the old API have not been ported to the new compiler backend yet.
911

1012
:eyes: **examples**:
1113
- [latest main branch](https://github.com/roc-lang/basic-cli/tree/main/examples)
@@ -36,3 +38,13 @@ The Rust host ABI is generated from `platform/main.roc` using Roc's `RustGlue.ro
3638
```
3739

3840
Commit `src/roc_platform_abi.rs` with any platform API change and the matching Rust host updates.
41+
42+
### Verification
43+
44+
Run the full local check before opening release or CI-facing changes:
45+
46+
```sh
47+
./ci/all_tests.sh
48+
```
49+
50+
The script checks generated glue, builds the host, checks and builds every example, and runs expect tests for examples with maintained scripts. When all target host libraries are present, it also bundles the platform, serves it from localhost, and tests examples against that bundle.

ci/all_tests.sh

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ ROOT_DIR="$(dirname "$SCRIPT_DIR")"
66

77
cd "$ROOT_DIR"
88

9+
EXAMPLE_NAMES=()
10+
911
# Cleanup function to restore examples and stop HTTP server
1012
cleanup() {
1113
echo ""
@@ -24,7 +26,7 @@ cleanup() {
2426
fi
2527

2628
# Remove built binaries
27-
for example in "${MIGRATED_EXAMPLES[@]}"; do
29+
for example in "${EXAMPLE_NAMES[@]:-}"; do
2830
rm -f "examples/${example}"
2931
done
3032

@@ -106,8 +108,15 @@ else
106108
echo "=== Skipping platform build (NO_BUILD=1) ==="
107109
fi
108110

109-
# List of migrated examples that have expect tests
110-
MIGRATED_EXAMPLES=(
111+
EXAMPLES_DIR="${ROOT_DIR}/examples/"
112+
export EXAMPLES_DIR
113+
114+
TESTS_DIR="${ROOT_DIR}/tests/"
115+
export TESTS_DIR
116+
117+
# Examples with maintained expect tests. All examples are checked and built
118+
# below; this list only controls which built binaries are executed.
119+
EXPECT_EXAMPLES=(
111120
"command-line-args"
112121
"hello-world"
113122
"stdin-basic"
@@ -122,11 +131,9 @@ MIGRATED_EXAMPLES=(
122131
"env-var"
123132
)
124133

125-
EXAMPLES_DIR="${ROOT_DIR}/examples/"
126-
export EXAMPLES_DIR
127-
128-
TESTS_DIR="${ROOT_DIR}/tests/"
129-
export TESTS_DIR
134+
for roc_file in "${EXAMPLES_DIR}"*.roc; do
135+
[ -f "$roc_file" ] && EXAMPLE_NAMES+=("$(basename "${roc_file%.roc}")")
136+
done
130137

131138
# Check if all target libraries exist for bundling
132139
ALL_TARGETS_EXIST=true
@@ -188,10 +195,9 @@ else
188195
echo "Run './build.sh --all' first to test with bundled platform"
189196
fi
190197

191-
# roc check migrated examples
192198
echo ""
193199
echo "=== Checking examples ==="
194-
for example in "${MIGRATED_EXAMPLES[@]}"; do
200+
for example in "${EXAMPLE_NAMES[@]}"; do
195201
echo "Checking: ${example}.roc"
196202
roc check "examples/${example}.roc"
197203
done
@@ -208,14 +214,13 @@ for test in "${TESTS_FILES[@]}"; do
208214
roc check "tests/${test}.roc"
209215
done
210216

211-
# roc build migrated examples
212217
echo ""
213218
if [ "$USE_BUNDLE" = true ]; then
214219
echo "=== Building examples (using bundle) ==="
215220
else
216221
echo "=== Building examples (using local platform) ==="
217222
fi
218-
for example in "${MIGRATED_EXAMPLES[@]}"; do
223+
for example in "${EXAMPLE_NAMES[@]}"; do
219224
echo "Building: ${example}.roc"
220225
roc build "examples/${example}.roc"
221226
mv "./${example}" "examples/"
@@ -225,9 +230,14 @@ done
225230
echo ""
226231
echo "=== Running expect tests ==="
227232
FAILED=0
228-
for example in "${MIGRATED_EXAMPLES[@]}"; do
233+
for example in "${EXPECT_EXAMPLES[@]}"; do
229234
echo ""
230235
echo "--- Testing: $example ---"
236+
if [ ! -f "ci/expect_scripts/${example}.exp" ]; then
237+
echo "FAIL: missing expect script for $example"
238+
FAILED=1
239+
continue
240+
fi
231241
set +e
232242
expect "ci/expect_scripts/${example}.exp"
233243
EXIT_CODE=$?

0 commit comments

Comments
 (0)