mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-15 10:31:30 +00:00
fix nightly testing + updates
This commit is contained in:
parent
ef2f813a30
commit
17960d1154
14 changed files with 39 additions and 104 deletions
2
.github/workflows/ci_manager.yml
vendored
2
.github/workflows/ci_manager.yml
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
on:
|
on:
|
||||||
pull_request:
|
# pull_request:
|
||||||
|
|
||||||
name: CI manager
|
name: CI manager
|
||||||
|
|
||||||
|
|
|
||||||
2
.github/workflows/nightly_linux_x86_64.yml
vendored
2
.github/workflows/nightly_linux_x86_64.yml
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
on:
|
on:
|
||||||
#pull_request:
|
pull_request:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 9 * * *"
|
- cron: "0 9 * * *"
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,19 @@ set -euxo pipefail
|
||||||
strip ./target/release-with-lto/roc
|
strip ./target/release-with-lto/roc
|
||||||
strip ./target/release-with-lto/roc_language_server
|
strip ./target/release-with-lto/roc_language_server
|
||||||
|
|
||||||
mkdir -p $1 $1/examples $1/crates/compiler/builtins/bitcode
|
mkdir -p $1 $1/examples
|
||||||
|
|
||||||
mv target/release-with-lto/{roc,roc_language_server,lib} $1
|
mv target/release-with-lto/{roc,roc_language_server,lib} $1
|
||||||
mv LICENSE LEGAL_DETAILS $1
|
mv LICENSE LEGAL_DETAILS $1
|
||||||
|
|
||||||
mv examples/platform-switching $1/examples
|
mv examples/platform-switching $1/examples
|
||||||
|
|
||||||
mv crates/roc_std $1/crates
|
# temporary github.com/roc-lang/roc/pull/7231
|
||||||
mv crates/compiler/builtins/bitcode/src $1/crates/compiler/builtins/bitcode
|
rm $1/examples/platform-switching/rocLovesRust.roc
|
||||||
|
rm -rf $1/examples/platform-switching/rust-platform
|
||||||
|
|
||||||
|
# copy zig builtins
|
||||||
|
mkdir $1/examples/platform-switching/zig-platform/glue
|
||||||
|
mv crates/compiler/builtins/bitcode/src/* $1/examples/platform-switching/zig-platform/glue
|
||||||
|
|
||||||
tar -czvf "$1.tar.gz" $1
|
tar -czvf "$1.tar.gz" $1
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ mod cli_tests {
|
||||||
const TEST_LEGACY_LINKER: bool = false;
|
const TEST_LEGACY_LINKER: bool = false;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[ignore = "Works when run manually, but not in CI"]
|
#[ignore = "Needs investigation, see also github.com/roc-lang/roc/pull/7231"]
|
||||||
fn platform_switching_rust() {
|
fn platform_switching_rust() {
|
||||||
// pre-build the platform
|
// pre-build the platform
|
||||||
std::process::Command::new("bash")
|
std::process::Command::new("bash")
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ fn nixos_error_if_dynamic(url: &str, dest_dir: &Path) {
|
||||||
Dynamically linked platforms can't be used on NixOS.\n\n\
|
Dynamically linked platforms can't be used on NixOS.\n\n\
|
||||||
You can:\n\n\t\
|
You can:\n\n\t\
|
||||||
- Download the source of the platform and build it locally, like in this example:\n\t \
|
- Download the source of the platform and build it locally, like in this example:\n\t \
|
||||||
https://github.com/roc-lang/roc/blob/main/examples/platform-switching/rocLovesRust.roc.\n\t \
|
https://github.com/roc-lang/roc/blob/main/examples/platform-switching/rocLovesC.roc.\n\t \
|
||||||
For some graphical platforms you may need to use https://github.com/guibou/nixGL.\n\n\t\
|
For some graphical platforms you may need to use https://github.com/guibou/nixGL.\n\n\t\
|
||||||
- Contact the author of the platform to ask them to statically link their platform.\n\t \
|
- Contact the author of the platform to ask them to statically link their platform.\n\t \
|
||||||
musl can be used to prevent a dynamic dependency on the systems' libc.\n\t \
|
musl can be used to prevent a dynamic dependency on the systems' libc.\n\t \
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ $ source <(cargo llvm-cov show-env --export-prefix)
|
||||||
$ cargo llvm-cov clean --workspace
|
$ cargo llvm-cov clean --workspace
|
||||||
$ cargo build --bin roc
|
$ cargo build --bin roc
|
||||||
# Replace with the command you want to generate coverage for:
|
# Replace with the command you want to generate coverage for:
|
||||||
$ ./target/debug/roc build ./examples/platform-switching/rocLovesRust.roc
|
$ ./target/debug/roc build yourFile.roc
|
||||||
# To view in editor
|
# To view in editor
|
||||||
$ cargo llvm-cov report --lcov --output-path lcov.info
|
$ cargo llvm-cov report --lcov --output-path lcov.info
|
||||||
# To view in browser. This html report also allows you to see how many times each line of code was run.
|
# To view in browser. This html report also allows you to see how many times each line of code was run.
|
||||||
|
|
@ -71,7 +71,7 @@ Viewing lcov.info will depend on your editor. For vscode, you can use the [cover
|
||||||
|
|
||||||
## Trace all Function Calls
|
## Trace all Function Calls
|
||||||
|
|
||||||
[uftrace](https://github.com/namhyung/uftrace) allows you to trace all functions that were called in the compiler in order. For example, you can use it with `./target/debug/roc build examples/platform-switching/rocLovesRust.roc`. The output looks like this:
|
[uftrace](https://github.com/namhyung/uftrace) allows you to trace all functions that were called in the compiler in order. For example, you can use it with `./target/debug/roc build yourFile.roc`. The output looks like this:
|
||||||
```
|
```
|
||||||
roc::main() {
|
roc::main() {
|
||||||
roc_tracing::setup_tracing();
|
roc_tracing::setup_tracing();
|
||||||
|
|
@ -92,7 +92,7 @@ It can be valuable if you want to compare two compiler versions/commits and see
|
||||||
2. In the roc repo in rust-toolchain.toml, switch to the commented out nightly channel
|
2. In the roc repo in rust-toolchain.toml, switch to the commented out nightly channel
|
||||||
3. `export RUSTFLAGS="-Awarnings -Z instrument-mcount -C passes=ee-instrument<post-inline>"`
|
3. `export RUSTFLAGS="-Awarnings -Z instrument-mcount -C passes=ee-instrument<post-inline>"`
|
||||||
4. `cargo build --bin roc`
|
4. `cargo build --bin roc`
|
||||||
5. Example usage: `uftrace record --filter 'roc_*' ./target/debug/roc build examples/platform-switching/rocLovesRust.roc`
|
5. Example usage: `uftrace record --filter 'roc_*' ./target/debug/roc build yourFile.roc`
|
||||||
6. Show the trace and drop all functions that do not start with `roc`: `uftrace replay -f none --notrace '^[^r]|^r[^o]|^ro[^c]' -D 5`. `-D 5` sets the function call depth, feel free to modify it to best suit your purpose.
|
6. Show the trace and drop all functions that do not start with `roc`: `uftrace replay -f none --notrace '^[^r]|^r[^o]|^ro[^c]' -D 5`. `-D 5` sets the function call depth, feel free to modify it to best suit your purpose.
|
||||||
|
|
||||||
Depending on which functions you are interested in, you may also want to set `let threads = Threads::Single;` in the function `load` in `crates/compiler/load_internal/src/file.rs`. That avoids function calls from being obscured between multiple threads.
|
Depending on which functions you are interested in, you may also want to set `let threads = Threads::Single;` in the function `load` in `crates/compiler/load_internal/src/file.rs`. That avoids function calls from being obscured between multiple threads.
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,14 @@
|
||||||
|
|
||||||
# Platform switching
|
# Platform switching
|
||||||
|
|
||||||
To run, `cd` into this directory and run this in your terminal:
|
To run, `cd` into this directory and run this in your terminal:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
roc run
|
roc --build-host --suppress-build-host-warning rocLovesC.roc
|
||||||
```
|
```
|
||||||
|
|
||||||
This will run `main.roc` because, unless you explicitly give it a filename, `roc run`
|
## About these examples
|
||||||
defaults to running a file named `main.roc`. Other `roc` commands (like `roc build`, `roc test`, and so on) also default to `main.roc` unless you explicitly give them a filename.
|
|
||||||
|
|
||||||
## About this example
|
They use a very simple [platform](https://www.roc-lang.org/platforms) which does nothing more than printing the string you give it.
|
||||||
|
|
||||||
This uses a very simple platform which does nothing more than printing the string you give it.
|
|
||||||
|
|
||||||
The line `main = "Which platform am I running on now?\n"` sets this string to be `"Which platform am I running on now?"` with a newline at the end, and the lines `packages { pf: "c-platform/main.roc" }` and `provides [main] to pf` specify that the `c-platform/` directory contains this app's platform.
|
|
||||||
|
|
||||||
This platform is called `c-platform` because its lower-level code is written in C. There's also a `rust-platform`, `zig-platform`, and so on; if you like, you can try switching `pf: "c-platform/main.roc"` to `pf: "zig-platform/main.roc"` or `pf: "rust-platform/main.roc"` to try one of those platforms instead. They all do similar things, so the application won't look any different.
|
|
||||||
|
|
||||||
If you want to start building your own platforms, these are some very simple example platforms to use as starting points.
|
If you want to start building your own platforms, these are some very simple example platforms to use as starting points.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
app [main] { pf: platform "c-platform/main.roc" }
|
|
||||||
|
|
||||||
main = "Which platform am I running on now?\n"
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
app [main] { pf: platform "c-platform/main.roc" }
|
app [main] { pf: platform "c-platform/main.roc" }
|
||||||
|
|
||||||
# run with `roc --build-host --suppress-build-host-warning rocLovesZig.roc`
|
# may require:
|
||||||
|
# ubuntu: sudo apt install build-essential clang
|
||||||
|
# fedora: sudo dnf install clang
|
||||||
|
|
||||||
|
# run with `roc --build-host --suppress-build-host-warning rocLovesC.roc`
|
||||||
|
|
||||||
main = "Roc <3 C!\n"
|
main = "Roc <3 C!\n"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,10 @@
|
||||||
app [main] { pf: platform "zig-platform/main.roc" }
|
app [main] { pf: platform "zig-platform/main.roc" }
|
||||||
|
|
||||||
# run with `roc --build-host --suppress-build-host-warning rocLovesZig.roc`
|
# To run:
|
||||||
|
# cd examples/platform-switching/zig-platform
|
||||||
|
# mkdir glue
|
||||||
|
# cp crates/compiler/builtins/bitcode/src/* ./glue
|
||||||
|
# cd -
|
||||||
|
# roc --build-host --suppress-build-host-warning rocLovesZig.roc
|
||||||
|
|
||||||
main = "Roc <3 Zig!\n"
|
main = "Roc <3 Zig!\n"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ which includes the Roc compiler and some helpful utilities.
|
||||||
|
|
||||||
1. Check everything worked by executing `roc version`
|
1. Check everything worked by executing `roc version`
|
||||||
|
|
||||||
1. Install libc development files and ld (binutils) if you'd like to use the repl (`roc repl`):
|
1. If you'd like to use the repl (`roc repl`); install libc development files and ld (binutils) :
|
||||||
- On Ubuntu/Debian:
|
- On Ubuntu/Debian:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
@ -41,37 +41,10 @@ which includes the Roc compiler and some helpful utilities.
|
||||||
sudo dnf install glibc-devel binutils
|
sudo dnf install glibc-devel binutils
|
||||||
```
|
```
|
||||||
|
|
||||||
## How to install Roc platform dependencies
|
1. Run [hello world](https://github.com/roc-lang/examples/blob/main/examples/HelloWorld/main.roc):
|
||||||
|
|
||||||
This step is not necessary if you only want to use the [basic-cli platform](https://github.com/roc-lang/basic-cli), like in the tutorial.
|
|
||||||
But, if you want to compile Roc apps with other platforms (either in [`examples/`](https://github.com/roc-lang/roc/tree/main/examples) or in your own projects),
|
|
||||||
you'll need to install one or more of these platform languages too.
|
|
||||||
|
|
||||||
1. Install the Rust compiler, for apps with Rust-based platforms:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
roc hello.roc
|
||||||
```
|
|
||||||
|
|
||||||
1. For Zig-based platforms: [download zig 0.13.0](https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz), extract the archive and add export PATH=$PATH:~/path/to/zig to your shell startup script (.profile, .zshrc, …).
|
|
||||||
|
|
||||||
1. Install a C compiler, for apps with C-based platforms:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# On a Debian-based distro like Ubuntu
|
|
||||||
sudo apt update && sudo apt install build-essential clang
|
|
||||||
|
|
||||||
# On an RPM-based distro like Fedora
|
|
||||||
sudo dnf check-update && sudo dnf install clang
|
|
||||||
```
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Note: If you installed Rust in this terminal session, you'll need to open a new one first!
|
|
||||||
./roc examples/platform-switching/rocLovesRust.roc
|
|
||||||
|
|
||||||
./roc examples/platform-switching/rocLovesZig.roc
|
|
||||||
|
|
||||||
./roc examples/platform-switching/rocLovesC.roc
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
|
||||||
|
|
@ -32,29 +32,11 @@ which includes the Roc compiler and some helpful utilities.
|
||||||
|
|
||||||
1. Check everything worked by executing `roc version`
|
1. Check everything worked by executing `roc version`
|
||||||
|
|
||||||
## How to install Roc platform dependencies
|
|
||||||
|
|
||||||
This step is not necessary if you only want to use the [basic-cli platform](https://github.com/roc-lang/basic-cli), like in the tutorial.
|
1. Run [hello world](https://github.com/roc-lang/examples/blob/main/examples/HelloWorld/main.roc):
|
||||||
But, if you want to compile Roc apps with other platforms (either in [`examples/`](https://github.com/roc-lang/roc/tree/main/examples) or in your own projects),
|
|
||||||
you'll need to install one or more of these platform languages too.
|
|
||||||
|
|
||||||
1. Install the Rust compiler, for apps with Rust-based platforms:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
roc hello.roc
|
||||||
```
|
|
||||||
|
|
||||||
1. If you'd like to use Zig-based platforms: download [zig 0.13.0](https://ziglang.org/download/0.13.0/zig-macos-aarch64-0.13.0.tar.xz), extract the archive and add `export PATH=$PATH:~/path/to/zig` to your shell startup script (.profile, .zshrc, …). Note: zig 0.13.0 is currently available on homebrew, but future update may remove it.
|
|
||||||
|
|
||||||
1. Run examples:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Note: If you installed rust in this terminal session, you'll need to open a new one first!
|
|
||||||
./roc examples/platform-switching/rocLovesRust.roc
|
|
||||||
|
|
||||||
./roc examples/platform-switching/rocLovesZig.roc
|
|
||||||
|
|
||||||
./roc examples/platform-switching/rocLovesC.roc
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
|
||||||
|
|
@ -26,29 +26,10 @@ which includes the Roc compiler and some helpful utilities.
|
||||||
|
|
||||||
1. Check everything worked by executing `roc version`
|
1. Check everything worked by executing `roc version`
|
||||||
|
|
||||||
## How to install Roc platform dependencies
|
1. Run [hello world](https://github.com/roc-lang/examples/blob/main/examples/HelloWorld/main.roc):
|
||||||
|
|
||||||
This step is not necessary if you only want to use the [basic-cli platform](https://github.com/roc-lang/basic-cli), like in the tutorial.
|
|
||||||
But, if you want to compile Roc apps with other platforms (either in [`examples/`](https://github.com/roc-lang/roc/tree/main/examples) or in your own projects),
|
|
||||||
you'll need to install one or more of these platform languages too.
|
|
||||||
|
|
||||||
1. Install the Rust compiler, for apps with Rust-based platforms:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
roc hello.roc
|
||||||
```
|
|
||||||
|
|
||||||
1. If you'd like to use Zig-based platforms: download [zig 0.13.0](https://ziglang.org/download/0.13.0/zig-macos-x86_64-0.13.0.tar.xz), extract the archive and add `export PATH=$PATH:~/path/to/zig` to your shell startup script (.profile, .zshrc, …). Note: zig 0.13.0 is not available on homebrew.
|
|
||||||
|
|
||||||
1. Run examples:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
# Note: If you installed rust in this terminal session, you'll need to open a new one first!
|
|
||||||
./roc examples/platform-switching/rocLovesRust.roc
|
|
||||||
|
|
||||||
./roc examples/platform-switching/rocLovesZig.roc
|
|
||||||
|
|
||||||
./roc examples/platform-switching/rocLovesC.roc
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,10 @@
|
||||||
|
|
||||||
1. [Build Roc from source](https://github.com/roc-lang/roc/blob/main/BUILDING_FROM_SOURCE.md)
|
1. [Build Roc from source](https://github.com/roc-lang/roc/blob/main/BUILDING_FROM_SOURCE.md)
|
||||||
|
|
||||||
1. Run examples:
|
1. Run [hello world](https://github.com/roc-lang/examples/blob/main/examples/HelloWorld/main.roc):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
cargo run examples/platform-switching/rocLovesRust.roc
|
roc hello.roc
|
||||||
|
|
||||||
# This requires installing the Zig compiler, too.
|
|
||||||
cargo run examples/platform-switching/rocLovesZig.roc
|
|
||||||
|
|
||||||
# This requires installing the `clang` C compiler, too.
|
|
||||||
cargo run examples/platform-switching/rocLovesC.roc
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue