Skip to content

Commit

Permalink
Merge branch 'main' into ayaz/error-on-invalid-generalized-types
Browse files Browse the repository at this point in the history
Signed-off-by: Ayaz <[email protected]>
  • Loading branch information
ayazhafiz authored Jan 10, 2025
2 parents a046167 + a69a326 commit ee3c71d
Show file tree
Hide file tree
Showing 766 changed files with 20,538 additions and 34,891 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ jobs:
if: needs.check-changes.outputs.run_tests == 'full'
uses: ./.github/workflows/benchmarks.yml

start-panic-check:
start-fuzzer-tests:
needs: check-changes
if: needs.check-changes.outputs.run_tests == 'full'
uses: ./.github/workflows/improve_panics.yml
uses: ./.github/workflows/fuzzer.yml

ran-full:
runs-on: ubuntu-22.04
Expand All @@ -141,8 +141,7 @@ jobs:
start-ubuntu-x86-64-nix-tests-debug,
start-windows-release-build-test,
start-windows-tests,
start-roc-benchmarks,
start-panic-check
start-roc-benchmarks
]
steps:
- run: echo "all workflows succeeded!"
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/fuzzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
on:
workflow_call:

name: CI

env:
RUST_BACKTRACE: 1

jobs:
fuzz-test-parser:
name: Fuzz test parser (allowed to fail). Do check this if you've made changes to the parser.
runs-on: [self-hosted, i7-6700K]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: run fuzz tests - ok to merge if this one fails # for now!
run: |
cargo +nightly-2024-02-03 install --locked cargo-fuzz
cd crates/compiler/test_syntax/fuzz && cargo +nightly-2024-02-03 fuzz run -j4 fuzz_expr --sanitizer=none -- -dict=dict.txt -max_total_time=60
56 changes: 0 additions & 56 deletions .github/workflows/improve_panics.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/nightly_macos_apple_silicon.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
#pull_request:
# pull_request:
workflow_dispatch:
schedule:
- cron: "0 9 * * *"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nix_linux_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ jobs:
run: nix-build

- name: execute tests with --release
# skipping glue tests due to difficult multithreading bug, we run them single threaded in the next step
# skipping glue tests due to difficult multithreading bug, we run them single threaded in the next step, see #7476
run: nix develop -c cargo test --locked --release -- --skip glue_cli_tests

- name: glue_cli_tests
# single threaded due to difficult bug when multithreading
# single threaded due to difficult bug when multithreading, see #7476
run: nix develop -c cargo test --locked --release glue_cli_tests -- --test-threads=1

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

- name: test wasm32 cli_tests
# skipping glue tests due to difficult multithreading bug, we run them single threaded in the next step
# skipping glue tests due to difficult multithreading bug, we run them single threaded in the next step, see #7476
run: nix develop -c cargo test --locked --release --features="wasm32-cli-run" -- --skip glue_cli_tests

- name: wasm32 glue_cli_tests
# single threaded due to difficult bug when multithreading
# single threaded due to difficult bug when multithreading, see #7476
run: nix develop -c cargo test --locked --release --features="wasm32-cli-run" glue_cli_tests -- --test-threads=1

- name: test the dev backend # these tests require an explicit feature flag
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ubuntu_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: test website build script
run: bash www/build.sh

- name: run fuzz tests - ok to merge if this one fails # for now!
run: |
cargo +nightly-2024-02-03 install --locked cargo-fuzz
cd crates/compiler/test_syntax/fuzz && cargo +nightly-2024-02-03 fuzz run -j4 fuzz_expr --sanitizer=none -- -dict=dict.txt -max_total_time=60
#- name: run fuzz tests - ok to merge if this one fails # for now!
# run: |
# cargo +nightly-2024-02-03 install --locked cargo-fuzz
# cd crates/compiler/test_syntax/fuzz && cargo +nightly-2024-02-03 fuzz run -j4 fuzz_expr --sanitizer=none -- -dict=dict.txt -max_total_time=60
8 changes: 6 additions & 2 deletions .github/workflows/ubuntu_x86_64_nix_debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
- name: Check if debug flag files are in sync
run: ./ci/check_debug_vars.sh

# for skipped tests; see #6946, #6947
- name: cargo test without --release
run: nix develop -c sh -c 'export ROC_CHECK_MONO_IR=1 && cargo test'
# skipping glue tests due to difficult multithreading bug, we run them single threaded in the next step, see #7476
run: nix develop -c sh -c 'export ROC_CHECK_MONO_IR=1 && cargo test --locked -- --skip glue_cli_tests'

- name: glue_cli_tests
# single threaded due to difficult bug when multithreading, see #7476
run: nix develop -c sh -c 'export ROC_CHECK_MONO_IR=1 && cargo test --locked glue_cli_tests -- --test-threads=1'
13 changes: 8 additions & 5 deletions .github/workflows/www.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
name: deploy www.roc-lang.org

# Whenever a commit lands on `main`, deploy the site
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Whenever a commit lands on `main`, deploy the site
push:
branches:
- deploy-www

jobs:
deploy:
name: 'Deploy to Netlify'
name: "Deploy to Netlify"
runs-on: [self-hosted, linux]
steps:
- uses: jsmrcaga/[email protected]
with:
install_command: 'pwd; cd ../../www'
build_command: 'bash build.sh'
build_directory: 'build'
install_command: "pwd; cd ../../www"
build_command: "bash build.sh"
build_directory: "build"
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_DEPLOY_MESSAGE: "Deploy git ref ${{ github.ref }}"
Expand Down
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,4 @@ Isak Jones <[email protected]>
Ch1n3du <[email protected]>
Elias Mulhall <[email protected]>
ABuffSeagull <[email protected]>
Timon Krebs <[email protected]>
18 changes: 9 additions & 9 deletions BUILDING_FROM_SOURCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,24 @@ sudo apt-get install libz-dev libzstd-dev

### Zig

**version: 0.11.0**
**version: 0.13.0**

For any OS, you can use [`zigup`](https://github.com/marler8997/zigup) to manage zig installations.

If you prefer a package manager, you can try the following:

- MacOS: `brew install zig@0.11.0`
- MacOS: `brew install zig`
- Systems with snap (such as Ubuntu): `snap install zig --classic --beta`
- Other systems: refer to the [zig documentation](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager)

If you want to install it manually, you can [download the binary](https://ziglang.org/download/#release-0.11.0) and place it on your PATH.
If you want to install it manually, you can [download the binary](https://ziglang.org/download/#release-0.13.0) and place it on your PATH.
Apart from the binary, the archive contains a `lib` folder, which needs to be copied next to the binary.

> WINDOWS NOTE: when you unpack the Zig archive on windows, the result is nested in an extra directory. The instructions on the zig website will seem to not work. So, double-check that the path to zig executable does not include the same directory name twice.
### LLVM

**version: 16.0.x**
**version: 18.0.x**

See below for operating system specific installation instructions.

Expand Down Expand Up @@ -167,10 +167,10 @@ chmod +x llvm.sh
```

If you use this script, you'll need to add `clang` to your `PATH`.
By default, the script installs it as `clang-16`. You can address this with symlinks like so:
By default, the script installs it as `clang-18`. You can address this with symlinks like so:

```sh
sudo ln -s /usr/bin/clang-16 /usr/bin/clang
sudo ln -s /usr/bin/clang-18 /usr/bin/clang
```

There are also alternative installation options at <http://releases.llvm.org/download.html>
Expand Down Expand Up @@ -203,7 +203,7 @@ Add `export LLVM_SYS_180_PREFIX=/usr/lib/llvm-18` to your `~/.bashrc` or equival

For macOS, you can install LLVM 18 using `brew install llvm@18` and then adding
`$(brew --prefix llvm@18)/bin` to your `PATH`. You can confirm this worked by
running `llc --version` - it should mention "LLVM version 16.0.x" at the top.
running `llc --version` - it should mention "LLVM version 18.x.x" at the top.
You may also need to manually specify a prefix env var like so:

```sh
Expand Down Expand Up @@ -261,8 +261,8 @@ Create `~/.cargo/config.toml` if it does not exist and add this to it:
rustflags = ["-C", "link-arg=-fuse-ld=lld", "-C", "target-cpu=native"]
```

Then install `lld` version 16 (e.g. with `$ sudo apt-get install lld-16`)
Then install `lld` version 18 (e.g. with `$ sudo apt-get install lld-18`)
and add make sure there's a `ld.lld` executable on your `PATH` which
is symlinked to `lld-16`.
is symlinked to `lld-18`.

That's it! Enjoy the faster builds.
1 change: 0 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion ci/package_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ mkdir -p $1 $1/examples
mv target/release-with-lto/{roc,roc_language_server,lib} $1
mv LICENSE LEGAL_DETAILS $1

mv examples/platform-switching $1/examples
mv crates/cli/tests/platform-switching $1/examples
mv examples/README.md $1/examples

# temporary github.com/roc-lang/roc/pull/7231
rm $1/examples/platform-switching/rocLovesRust.roc
Expand Down
22 changes: 17 additions & 5 deletions crates/cli/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub enum FormatProblem {

pub fn format_src(arena: &Bump, src: &str, flags: MigrationFlags) -> Result<String, FormatProblem> {
let ast = arena.alloc(parse_all(arena, src).unwrap_or_else(|e| {
user_error!("Unexpected parse failure when parsing this formatting:\n\n{:?}\n\nParse error was:\n\n{:?}\n\n", src, e)
user_error!("Unexpected parse failure when parsing this formatting:\n\n{src}\n\nParse error was:\n\n{:#?}\n\n", e)
}));
let mut buf = Buf::new_in(arena, flags);
fmt_all(&mut buf, ast);
Expand Down Expand Up @@ -305,7 +305,10 @@ main =
fn test_single_file_needs_reformatting() {
let dir = tempdir().unwrap();
let file_path = setup_test_file(dir.path(), "test1.roc", UNFORMATTED_ROC);
let flags = MigrationFlags::new(false);
let flags = MigrationFlags {
snakify: false,
parens_and_commas: false,
};

let result = format_files(vec![file_path.clone()], FormatMode::CheckOnly, flags);
assert!(result.is_err());
Expand All @@ -325,7 +328,10 @@ main =
let dir = tempdir().unwrap();
let file1 = setup_test_file(dir.path(), "test1.roc", UNFORMATTED_ROC);
let file2 = setup_test_file(dir.path(), "test2.roc", UNFORMATTED_ROC);
let flags = MigrationFlags::new(false);
let flags = MigrationFlags {
snakify: false,
parens_and_commas: false,
};

let result = format_files(vec![file1, file2], FormatMode::CheckOnly, flags);
assert!(result.is_err());
Expand All @@ -339,7 +345,10 @@ main =
fn test_no_files_need_reformatting() {
let dir = tempdir().unwrap();
let file_path = setup_test_file(dir.path(), "formatted.roc", FORMATTED_ROC);
let flags = MigrationFlags::new(false);
let flags = MigrationFlags {
snakify: false,
parens_and_commas: false,
};

let result = format_files(vec![file_path], FormatMode::CheckOnly, flags);
assert!(result.is_ok());
Expand All @@ -353,7 +362,10 @@ main =
let file_formatted = setup_test_file(dir.path(), "formatted.roc", FORMATTED_ROC);
let file1_unformated = setup_test_file(dir.path(), "test1.roc", UNFORMATTED_ROC);
let file2_unformated = setup_test_file(dir.path(), "test2.roc", UNFORMATTED_ROC);
let flags = MigrationFlags::new(false);
let flags = MigrationFlags {
snakify: false,
parens_and_commas: false,
};

let result = format_files(
vec![file_formatted, file1_unformated, file2_unformated],
Expand Down
8 changes: 8 additions & 0 deletions crates/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ pub const FLAG_PP_HOST: &str = "host";
pub const FLAG_PP_PLATFORM: &str = "platform";
pub const FLAG_PP_DYLIB: &str = "lib";
pub const FLAG_MIGRATE: &str = "migrate";
pub const FLAG_DOCS_ROOT: &str = "root-dir";

pub const VERSION: &str = env!("ROC_VERSION");
const DEFAULT_GENERATED_DOCS_DIR: &str = "generated-docs";
Expand Down Expand Up @@ -184,6 +185,12 @@ pub fn build_app() -> Command {
.num_args(0..)
.allow_hyphen_values(true);

let flag_docs_root_dir = Arg::new(FLAG_DOCS_ROOT)
.long(FLAG_DOCS_ROOT)
.help("Set a root directory path to be used as a prefix for URL links in the generated documentation files.")
.value_parser(value_parser!(Option<String>))
.required(false);

let build_target_values_parser =
PossibleValuesParser::new(Target::iter().map(Into::<&'static str>::into));

Expand Down Expand Up @@ -405,6 +412,7 @@ pub fn build_app() -> Command {
.required(false)
.default_value(DEFAULT_ROC_FILENAME),
)
.arg(flag_docs_root_dir)
)
.subcommand(Command::new(CMD_GLUE)
.about("Generate glue code between a platform's Roc API and its host language")
Expand Down
Loading

0 comments on commit ee3c71d

Please sign in to comment.