Skip to content

Commit

Permalink
Merge branch 'roc-lang:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dadhi authored Nov 12, 2024
2 parents 0f044e0 + 7180930 commit 0ce75cf
Show file tree
Hide file tree
Showing 244 changed files with 3,604 additions and 5,674 deletions.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Require roc files to be checked out with Unix line endings, even on windows
*.roc text eol=lf
* text=auto eol=lf

crates/compiler/test_mono/generated/* linguist-generated=true
crates/compiler/test_mono/generated/* linguist-generated=true
19 changes: 10 additions & 9 deletions .github/workflows/nightly_macos_apple_silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ on:
#pull_request:
workflow_dispatch:
schedule:
- cron: '0 9 * * *'
- cron: "0 9 * * *"

name: Nightly Release macOS Apple Silicon

Expand Down Expand Up @@ -30,15 +30,15 @@ jobs:
run: cargo test --locked --release

- name: get commit SHA
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV

- name: get date
run: echo "DATE=$(date "+%Y-%m-%d")" >> $GITHUB_ENV

- name: build file name
env:
DATE: ${{ env.DATE }}
SHA: ${{ env.SHA }}
DATE: ${{ env.DATE }}
SHA: ${{ env.SHA }}
run: echo "RELEASE_FOLDER_NAME=roc_nightly-macos_apple_silicon-$DATE-$SHA" >> $GITHUB_ENV

- name: write version to file
Expand All @@ -56,8 +56,9 @@ jobs:
- name: extract tar for a quick test
run: ls | grep tar | xargs tar -xf

- name: test with rust platform
run: cd ${{ env.RELEASE_FOLDER_NAME }} && ./roc examples/platform-switching/rocLovesRust.roc
- name: test with zig platform
run: |
cd ${{ env.RELEASE_FOLDER_NAME }} && ./roc --build-host --suppress-build-host-warning crates/cli/tests/test-projects/test-platform-simple-zig/app.roc
- name: print short commit SHA
run: git rev-parse --short "$GITHUB_SHA"
Expand All @@ -66,6 +67,6 @@ jobs:
- name: Upload artifact Actually uploading to github releases has to be done manually
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
retention-days: 4
name: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
path: ${{ env.RELEASE_FOLDER_NAME }}.tar.gz
retention-days: 4
2 changes: 1 addition & 1 deletion .github/workflows/nix_linux_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: roc test all builtins
run: nix develop -c ./ci/roc_test_builtins.sh

- name: test wasm32 cli_run
- name: test wasm32 cli_tests
run: nix develop -c cargo test --locked --release --features="wasm32-cli-run"

- name: test the dev backend # these tests require an explicit feature flag
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/nix_macos_apple_silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,11 @@ jobs:

# for skipped tests: see issue 6274
- name: execute tests with --release
run: nix develop -c cargo test --locked --release -- --skip cli_run::inspect_gui --skip cli_run::hello_gui
run: nix develop -c cargo test --locked --release -- --skip cli_tests::inspect_gui --skip cli_tests::hello_gui

- name: roc test all builtins
run: nix develop -c ./ci/roc_test_builtins.sh

- name: make a libapp.so for the next step
run: nix develop -c cargo run -- gen-stub-lib examples/platform-switching/rocLovesRust.roc

- name: check that the platform`s produced dylib is loadable
run: cd examples/platform-switching/rust-platform && nix develop -c cargo test --release --locked

- name: test aarch64 dev backend
run: nix develop -c cargo nextest-gen-dev --locked --release --no-fail-fast

Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/nix_macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@ jobs:

- uses: cachix/install-nix-action@v22

- name: execute cli_run tests only, the full tests take too long but are run nightly
- name: execute cli_tests tests only, the full tests take too long but are run nightly
run: nix develop -c cargo test --locked --release -p roc_cli -- --skip hello_gui
# see 5932 for hello_gui

- name: roc test all builtins
run: nix develop -c ./ci/roc_test_builtins.sh

- name: make a libapp.so for the next step
run: nix develop -c cargo run -- gen-stub-lib examples/platform-switching/rocLovesRust.roc

- name: check that the platform`s produced dylib is loadable
run: cd examples/platform-switching/rust-platform && nix develop -c cargo test --release --locked
3 changes: 0 additions & 3 deletions .github/workflows/test_nightly_macos_apple_silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ jobs:
- name: test roc hello world
run: cd roc_nightly && ./roc examples/helloWorld.roc

- name: test platform switching rust
run: cd roc_nightly && ./roc examples/platform-switching/rocLovesRust.roc

- name: test platform switching zig
run: cd roc_nightly && ./roc examples/platform-switching/rocLovesZig.roc

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/ubuntu_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ jobs:

- name: regular rust tests
# see #5904 for skipped test
run: cargo test --locked --release -- --skip cli_run::expects_dev_and_test
run: cargo test --locked --release -- --skip cli_tests::expects_dev_and_test

- name: tests examples in docs
run: cargo test --doc --release

- name: check that the platform`s produced dylib is loadable
run: cd examples/platform-switching/rust-platform && LD_LIBRARY_PATH=. cargo test --release --locked
run: cargo test --doc --release

- name: test the dev backend # these tests require an explicit feature flag
run: cargo test --locked --release --package test_gen --no-default-features --features gen-dev
Expand Down
33 changes: 8 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
"crates/fs",
"crates/glue",
"crates/cli",
"crates/cli_utils",
"crates/cli_test_utils",
"crates/highlight",
"crates/error_macros",
"crates/reporting",
Expand All @@ -19,7 +19,7 @@ members = [
"crates/roc_std",
"crates/test_utils",
"crates/test_utils_dir",
"crates/valgrind",
"crates/valgrind_tests",
"crates/tracing",
"crates/utils/*",
"crates/soa",
Expand Down Expand Up @@ -173,7 +173,6 @@ schemars = "0.8.12"
serde = { version = "1.0.153", features = [
"derive",
] } # update roc_std/Cargo.toml on change
serde-xml-rs = "0.6.0"
serde_json = "1.0.94" # update roc_std/Cargo.toml on change
serial_test = "1.0.0"
signal-hook = "0.3.15"
Expand Down
7 changes: 4 additions & 3 deletions ci/basic_nightly_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ set -euxo pipefail

# if to prevent unset vars errror
if [ -n "$(ls | grep -v "roc_nightly.*tar\.gz" | grep -v "^ci$")" ]; then

# Remove everything in this dir except the tar and ci folder.
# We want to test like a user who would have downloaded the release, so we clean up all files from the repo checkout.
to_delete=$(ls | grep -v "roc_nightly.*tar\.gz" | grep -v "^ci$")

for file_or_dir in $to_delete
do
echo "Removing: $file_or_dir"
echo "Removing: $file_or_dir"
rm -rf "$file_or_dir"
done
fi
Expand All @@ -31,7 +31,8 @@ cd roc_nightly
# test roc hello world
./roc examples/helloWorld.roc

# test rust platform
# test rust platform (first prebuild the host)
examples/platform-switching/rust-platform/build.sh
./roc examples/platform-switching/rocLovesRust.roc

# test zig platform
Expand Down
4 changes: 2 additions & 2 deletions crates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ cargo doc --package roc_ast --open

The `roc` binary that brings together all functionality in the Roc toolset.

## `cli_utils/` - `cli_utils`
## `cli_test_utils/` - `cli_test_utils`

Provides shared code for cli tests and benchmarks.
Provides shared code for cli tests, cli benchmarks, glue tests, valgrind crate.

## `compiler/`

Expand Down
15 changes: 7 additions & 8 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ target-x86 = ["roc_build/target-x86", "roc_repl_cli/target-x86"]
target-x86_64 = ["roc_build/target-x86_64", "roc_repl_cli/target-x86_64"]

target-all = [
"target-aarch64",
"target-arm",
"target-x86",
"target-x86_64",
"target-wasm32",
"target-aarch64",
"target-arm",
"target-x86",
"target-x86_64",
"target-wasm32",
]

sanitizers = ["roc_build/sanitizers"]
Expand Down Expand Up @@ -90,15 +90,14 @@ roc_repl_expect = { path = "../repl_expect" }


[dev-dependencies]
cli_utils = { path = "../cli_utils" }
roc_test_utils = { path = "../test_utils" }
cli_test_utils = { path = "../cli_test_utils" }
roc_command_utils = { path = "../utils/command" }

criterion.workspace = true
indoc.workspace = true
parking_lot.workspace = true
pretty_assertions.workspace = true
serial_test.workspace = true
insta.workspace = true

[build-dependencies]
chrono.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/benches/time_bench.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::time::Duration;

use cli_utils::bench_utils::{
use cli_test_utils::bench_utils::{
bench_cfold, bench_deriv, bench_nqueens, bench_quicksort, bench_rbtree_ck,
};
use criterion::{measurement::WallTime, BenchmarkGroup, Criterion, SamplingMode};
Expand Down
8 changes: 2 additions & 6 deletions crates/cli/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ mod tests {
use std::io::Write;
use tempfile::{tempdir, TempDir};

const FORMATTED_ROC: &str = r#"app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }
const FORMATTED_ROC: &str = r#"app [main] { pf: platform "platform/main.roc" }
import pf.Stdout
import pf.Stdin
Expand All @@ -273,11 +273,7 @@ main =
name = Stdin.line!
Stdout.line! "Hi $(name)!""#;

const UNFORMATTED_ROC: &str = r#"app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.16.0/O00IPk-Krg_diNS2dVWlI0ZQP794Vctxzv0ha96mK0E.tar.br" }
import pf.Stdout
import pf.Stdin
const UNFORMATTED_ROC: &str = r#"app [main] { pf: platform "platform/main.roc" }
main =
Stdout.line! "What's your name?"
Expand Down
Loading

0 comments on commit 0ce75cf

Please sign in to comment.