Skip to content

Commit

Permalink
Merge branch 'main' into basic-ws-0-6-0
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-4 authored Aug 23, 2024
2 parents 0667fce + e35e564 commit f4ca132
Show file tree
Hide file tree
Showing 617 changed files with 27,578 additions and 16,570 deletions.
3 changes: 2 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustflags = ["-Clink-args=/FORCE:UNRESOLVED"]
# https://github.com/rust-lang/cargo/issues/3946#issuecomment-973132993
ROC_WORKSPACE_DIR = { value = "", relative = true }

# Debug flags. Keep this up-to-date with compiler/debug_flags/src/lib.rs.
# Debug flags. Explanations for these are in compiler/debug_flags/src/lib.rs.
# Set = "1" to turn a debug flag on.
ROC_PRETTY_PRINT_ALIAS_CONTENTS = "0"
ROC_PRINT_UNIFICATIONS = "0"
Expand All @@ -49,6 +49,7 @@ ROC_PRINT_IR_AFTER_TRMC = "0"
ROC_PRINT_IR_AFTER_DROP_SPECIALIZATION = "0"
ROC_DEBUG_ALIAS_ANALYSIS = "0"
ROC_PRINT_RUNTIME_ERROR_GEN = "0"
ROC_NO_UNBOUND_LAYOUT = "0"
ROC_PRINT_LLVM_FN_VERIFICATION = "0"
ROC_WRITE_FINAL_WASM = "0"
ROC_LOG_WASM_INTERP = "0"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/ci_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ jobs:
if: needs.check-changes.outputs.run_tests == 'full'
uses: ./.github/workflows/ubuntu_x86_64.yml

start-ubuntu-x86-64-nix-tests-debug:
needs: check-changes
if: needs.check-changes.outputs.run_tests == 'full'
uses: ./.github/workflows/ubuntu_x86_64_nix_debug.yml

start-windows-release-build-test:
needs: check-changes
if: needs.check-changes.outputs.run_tests == 'full'
Expand All @@ -128,6 +133,7 @@ jobs:
start-nix-macos-apple-silicon-tests,
start-macos-x86-64-tests,
start-ubuntu-x86-64-tests,
start-ubuntu-x86-64-nix-tests-debug,
start-windows-release-build-test,
start-windows-tests,
start-roc-benchmarks
Expand Down
26 changes: 14 additions & 12 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
on:
workflow_dispatch:
# pull_request:
# TODO remove pull_request trigger

name: Docker images tests

Expand All @@ -15,10 +17,10 @@ jobs:
run: cp docker/nightly-ubuntu-latest/docker-compose.example.yml docker/nightly-ubuntu-latest/docker-compose.yml

- name: Build image
run: docker-compose -f docker/nightly-ubuntu-latest/docker-compose.yml build
run: docker compose -f docker/nightly-ubuntu-latest/docker-compose.yml build

- name: Run hello world test
run: docker-compose -f docker/nightly-ubuntu-latest/docker-compose.yml run roc examples/helloWorld.roc
run: docker compose -f docker/nightly-ubuntu-latest/docker-compose.yml run roc examples/helloWorld.roc


nightly-ubuntu-2204:
Expand All @@ -32,10 +34,10 @@ jobs:
run: cp docker/nightly-ubuntu-2204/docker-compose.example.yml docker/nightly-ubuntu-2204/docker-compose.yml

- name: Build image
run: docker-compose -f docker/nightly-ubuntu-2204/docker-compose.yml build
run: docker compose -f docker/nightly-ubuntu-2204/docker-compose.yml build

- name: Run hello world test
run: docker-compose -f docker/nightly-ubuntu-2204/docker-compose.yml run roc examples/helloWorld.roc
run: docker compose -f docker/nightly-ubuntu-2204/docker-compose.yml run roc examples/helloWorld.roc

nightly-ubuntu-2004:
name: nightly-ubuntu-2004
Expand All @@ -48,10 +50,10 @@ jobs:
run: cp docker/nightly-ubuntu-2004/docker-compose.example.yml docker/nightly-ubuntu-2004/docker-compose.yml

- name: Build image
run: docker-compose -f docker/nightly-ubuntu-2004/docker-compose.yml build
run: docker compose -f docker/nightly-ubuntu-2004/docker-compose.yml build

- name: Run hello world test
run: docker-compose -f docker/nightly-ubuntu-2004/docker-compose.yml run roc examples/helloWorld.roc
run: docker compose -f docker/nightly-ubuntu-2004/docker-compose.yml run roc examples/helloWorld.roc

nightly-debian-latest:
name: nightly-debian-latest
Expand All @@ -64,10 +66,10 @@ jobs:
run: cp docker/nightly-debian-latest/docker-compose.example.yml docker/nightly-debian-latest/docker-compose.yml

- name: Build image
run: docker-compose -f docker/nightly-debian-latest/docker-compose.yml build
run: docker compose -f docker/nightly-debian-latest/docker-compose.yml build

- name: Run hello world test
run: docker-compose -f docker/nightly-debian-latest/docker-compose.yml run roc examples/helloWorld.roc
run: docker compose -f docker/nightly-debian-latest/docker-compose.yml run roc examples/helloWorld.roc

nightly-debian-bookworm:
name: nightly-debian-bookworm
Expand All @@ -80,10 +82,10 @@ jobs:
run: cp docker/nightly-debian-bookworm/docker-compose.example.yml docker/nightly-debian-bookworm/docker-compose.yml

- name: Build image
run: docker-compose -f docker/nightly-debian-bookworm/docker-compose.yml build
run: docker compose -f docker/nightly-debian-bookworm/docker-compose.yml build

- name: Run hello world test
run: docker-compose -f docker/nightly-debian-bookworm/docker-compose.yml run roc examples/helloWorld.roc
run: docker compose -f docker/nightly-debian-bookworm/docker-compose.yml run roc examples/helloWorld.roc

nightly-debian-buster:
name: nightly-debian-buster
Expand All @@ -96,7 +98,7 @@ jobs:
run: cp docker/nightly-debian-buster/docker-compose.example.yml docker/nightly-debian-buster/docker-compose.yml

- name: Build image
run: docker-compose -f docker/nightly-debian-buster/docker-compose.yml build
run: docker compose -f docker/nightly-debian-buster/docker-compose.yml build

- name: Run hello world test
run: docker-compose -f docker/nightly-debian-buster/docker-compose.yml run roc examples/helloWorld.roc
run: docker compose -f docker/nightly-debian-buster/docker-compose.yml run roc examples/helloWorld.roc
27 changes: 27 additions & 0 deletions .github/workflows/ubuntu_x86_64_nix_debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
workflow_call:

name: cargo test debug nix

env:
RUST_BACKTRACE: 1

jobs:
cargo-test-debug-nix:
name: cargo test debug nix
runs-on: [ubuntu-22.04]
timeout-minutes: 90
steps:
- uses: actions/checkout@v4

# install nix
- uses: cachix/install-nix-action@v23
with:
nix_path: nixpkgs=channel:nixos-unstable

- 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 -- --skip tests/exhaustive/match_on_result_with_uninhabited_error_destructuring_in_lambda_syntax.txt --skip tests::identity_lambda --skip tests::issue_2300 --skip tests::issue_2582_specialize_result_value --skip tests::sum_lambda'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ zig-cache
.envrc
*.rs.bk
*.o
*.a
*.so
*.so.*
*.obj
Expand Down
14 changes: 2 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,9 @@ Execute `cargo fmt --all` to fix the formatting.
- The [compiler's README](https://github.com/roc-lang/roc/tree/main/crates/compiler) contains important info.
- The AI chat in the [cursor editor](https://www.cursor.com/) can also help you find your way in the codebase.

<details>
<summary>:beetle: Debugging Tips</summary>

- At the bottom of [.cargo/config.toml](https://github.com/roc-lang/roc/blob/main/.cargo/config.toml) we have useful debug flags that activate certain debug prints.
- For Roc code; minimize the code that produces the issue.
- For segmentation faults:
+ In general we recommend using linux to investigate, it has better tools for this.
+ Use `roc build myApp.roc --linker=legacy` followed by `valgrind ./myApp`.
+ Use gdb to step through the code, [this gdb script](https://roc.zulipchat.com/#narrow/stream/395097-compiler-development/topic/gdb.20script/near/424422545) can be helpful.
+ Inspect the generated LLVM IR (`roc build myApp.roc --emit-llvm-ir`) between Roc code that encounters the segfault and code that doesn't.

### Debugging tips

</details>
If you need to do some debugging, check out [our tips](devtools/debug_tips.md).

### Commit signing

Expand Down
70 changes: 1 addition & 69 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ maplit = "1.0.2"
memmap2 = "0.5.10"
mimalloc = { version = "0.1.34", default-features = false }
nonempty = "0.8.1"
object = { version = "0.32.2", features = ["read", "write"] }
object = { version = "0.32.2", default-features = false, features = ["read", "write"] }
packed_struct = "0.10.1"
page_size = "0.5.0"
palette = "0.6.1"
Expand Down Expand Up @@ -171,7 +171,6 @@ serde_json = "1.0.94" # update roc_std/Cargo.toml on change
serial_test = "1.0.0"
signal-hook = "0.3.15"
smallvec = { version = "1.10.0", features = ["const_generics", "const_new"] }
snafu = { version = "0.7.4", features = ["backtraces"] }
static_assertions = "1.1.0" # update roc_std/Cargo.toml on change
strip-ansi-escapes = "0.1.1"
strum = { version = "0.24.1", features = ["derive"] }
Expand Down
4 changes: 0 additions & 4 deletions ci/basic_nightly_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ if [ -n "$(ls | grep -v "roc_nightly.*tar\.gz" | grep -v "^ci$")" ]; then
done
fi

if [[ "$(uname)" == "Darwin" ]]; then
brew install z3 # used by llvm
fi

# decompress the tar
ls | grep "roc_nightly.*tar\.gz" | xargs tar -xzvf

Expand Down
22 changes: 22 additions & 0 deletions ci/check_debug_vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
set -euo pipefail

# Extract vars from .cargo/config.toml
config_vars=$(grep -E "^ROC_.*= \"[01]\"" .cargo/config.toml | cut -d'=' -f1 | tr -d ' ')

# Extract vars from crates/compiler/debug_flags/src/lib.rs
lib_vars=$(grep -E "^ ROC_.*" crates/compiler/debug_flags/src/lib.rs | tr -d ' ')

# Sort both lists
sorted_config_vars=$(echo "$config_vars" | sort)
sorted_lib_vars=$(echo "$lib_vars" | sort)

# Compare the sorted lists
if diff <(echo "$sorted_config_vars") <(echo "$sorted_lib_vars") > /dev/null; then
echo "The flags in both files are identical."
else
echo "Looks like some flags are out of sync between .cargo/config.toml and crates/compiler/debug_flags/src/lib.rs:"
diff <(echo "$sorted_config_vars") <(echo "$sorted_lib_vars")
fi
Loading

0 comments on commit f4ca132

Please sign in to comment.