Skip to content

Commit

Permalink
Merge branch 'main' of github.com:roc-lang/roc into clippy-1.74
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton-4 committed Dec 25, 2023
2 parents aaba3f4 + 0bd15a5 commit cd632fe
Show file tree
Hide file tree
Showing 271 changed files with 7,542 additions and 7,218 deletions.
78 changes: 55 additions & 23 deletions .github/workflows/basic_cli_build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,31 @@ concurrency:

env:
# use .tar.gz for quick testing
ARCHIVE_FORMAT: .tar.gz
BASIC_CLI_BRANCH: main
ARCHIVE_FORMAT: .tar.br
# Make a new basic-cli git tag and set it here before starting this workflow
RELEASE_TAG: 0.7.1

jobs:
fetch-releases:
prepare:
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
with:
repository: roc-lang/basic-cli

- name: check if provided RELEASE_TAG is fresh
run: |
git fetch --tags
TAG_DATE=$(git log -1 --format=%ai ${{ env.RELEASE_TAG }})
CURRENT_DATE=$(date +%Y-%m-%d)
TAG_AGE=$(( ($(date -d $CURRENT_DATE +%s) - $(date -d "$TAG_DATE" +%s) )/(60*60*24) ))
if [ $TAG_AGE -gt 4 ]; then
echo "The provided RELEASE_TAG (${{ env.RELEASE_TAG }}) seems stale, it is $TAG_AGE days old. Did you set it correctly at the top of this workflow?"
exit 1
fi
# get latest nightly releases
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_x86_64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-linux_arm64-latest.tar.gz
- run: curl -fOL https://github.com/roc-lang/roc/releases/download/nightly/roc_nightly-macos_x86_64-latest.tar.gz
Expand All @@ -30,7 +46,7 @@ jobs:

build-linux-x86_64-files:
runs-on: [ubuntu-20.04]
needs: [fetch-releases]
needs: [prepare]
steps:
- uses: actions/checkout@v3

Expand All @@ -47,14 +63,14 @@ jobs:
with:
name: linux-x86_64-files
path: |
basic-cli/src/metadata_linux-x64.rm
basic-cli/src/linux-x64.rh
basic-cli/src/linux-x64.o
basic-cli/platform/metadata_linux-x64.rm
basic-cli/platform/linux-x64.rh
basic-cli/platform/linux-x64.o
build-linux-arm64-files:
runs-on: [self-hosted, Linux, ARM64]
needs: [fetch-releases]
needs: [prepare]
steps:
- uses: actions/checkout@v3

Expand All @@ -74,11 +90,11 @@ jobs:
with:
name: linux-arm64-files
path: |
basic-cli/src/linux-arm64.o
basic-cli/platform/linux-arm64.o
build-macos-x86_64-files:
runs-on: [macos-11] # I expect the generated files to work on macOS 12 and up
needs: [fetch-releases]
needs: [prepare]
steps:
- uses: actions/checkout@v3

Expand All @@ -92,12 +108,12 @@ jobs:
with:
name: macos-x86_64-files
path: |
basic-cli/src/macos-x64.o
basic-cli/platform/macos-x64.o
build-macos-apple-silicon-files:
name: build apple silicon .o file
runs-on: [self-hosted, macOS, ARM64]
needs: [fetch-releases]
needs: [prepare]
steps:
- uses: actions/checkout@v3

Expand All @@ -111,7 +127,7 @@ jobs:
with:
name: macos-apple-silicon-files
path: |
basic-cli/src/macos-arm64.o
basic-cli/platform/macos-arm64.o
create-release-archive:
needs: [build-linux-x86_64-files, build-linux-arm64-files, build-macos-x86_64-files, build-macos-apple-silicon-files]
Expand Down Expand Up @@ -140,17 +156,25 @@ jobs:

- run: git clone https://github.com/roc-lang/basic-cli.git

- run: cp macos-apple-silicon-files/* ./basic-cli/src
- run: cp macos-apple-silicon-files/* ./basic-cli/platform

- run: cp linux-x86_64-files/* ./basic-cli/src
- run: cp linux-x86_64-files/* ./basic-cli/platform

- run: cp linux-arm64-files/* ./basic-cli/src
- run: cp linux-arm64-files/* ./basic-cli/platform

- run: cp macos-x86_64-files/* ./basic-cli/src
- run: cp macos-x86_64-files/* ./basic-cli/platform

- run: ./roc_nightly/roc build --bundle=${{ env.ARCHIVE_FORMAT }} ./basic-cli/src/main.roc
- name: bundle basic-cli release archive
run: ./roc_nightly/roc build --bundle=${{ env.ARCHIVE_FORMAT }} ./basic-cli/platform/main.roc

- run: echo "TAR_FILENAME=$(ls -d basic-cli/src/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV
- name: build basic-cli docs
env:
ROC_DOCS_URL_ROOT: /packages/basic-cli/${{ env.RELEASE_TAG }}
run: |
./roc_nightly/roc docs ./basic-cli/platform/main.roc
tar -czvf docs.tar.gz generated-docs/
- run: echo "TAR_FILENAME=$(ls -d basic-cli/platform/* | grep ${{ env.ARCHIVE_FORMAT }})" >> $GITHUB_ENV

- name: Upload platform archive
uses: actions/upload-artifact@v3
Expand All @@ -159,6 +183,13 @@ jobs:
path: |
${{ env.TAR_FILENAME }}
- name: Upload docs archive
uses: actions/upload-artifact@v3
with:
name: release-assets-docs
path: |
docs.tar.gz
test-release-ubuntu:
needs: [create-release-archive]
runs-on: [ubuntu-20.04]
Expand Down Expand Up @@ -194,18 +225,19 @@ jobs:
- name: Install ncat for tests if we dont have it yet
run: if ! dpkg -l | grep -qw ncat; then sudo apt install -y ncat; fi

- name: prep testing
- name: prepare testing
run: |
mv roc_nightly basic-cli-platform/.
cd basic-cli-platform
mkdir src
find . -maxdepth 1 -type f -exec mv {} src/ \;
mkdir platform
# move all files to platform dir
find . -maxdepth 1 -type f -exec mv {} platform/ \;
mkdir temp-basic-cli
cd temp-basic-cli
git clone https://github.com/roc-lang/basic-cli.git
cd basic-cli
git checkout ${{ env.BASIC_CLI_BRANCH }}
git checkout ${{ env.RELEASE_TAG }}
cp -r examples ../..
cp -r ci ../..
cp -r LICENSE ../..
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/ci_manager.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
pull_request:

name: CI manager

# cancel current runs when a new commit is pushed
Expand All @@ -21,7 +21,7 @@ jobs:
id: filecheck
run: |
git fetch origin ${{ github.base_ref }}
if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -qvE '(\.md$|\.css$|\.html$)'; then
if git diff --name-only origin/${{ github.base_ref }} HEAD | grep -qvE '(\.md$|\.css$|\.html$|^AUTHORS$)'; then
echo "run_tests=full" >> $GITHUB_OUTPUT
else
echo "run_tests=none" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
start-macos-x86-64-tests:
needs: check-changes
if: needs.check-changes.outputs.run_tests == 'full'
uses: ./.github/workflows/ubuntu_x86_64.yml
uses: ./.github/workflows/macos_x86_64.yml

start-ubuntu-x86-64-tests:
needs: check-changes
Expand Down Expand Up @@ -103,12 +103,16 @@ jobs:
needs: [ran-full, ran-none]
if: |
always()
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
&& !contains(needs.*.result, 'cancelled')
&& !(needs.ran-full.result == 'skipped' && needs.ran-none.result == 'skipped')
steps:
- run: echo "Workflow succeeded :)"
- name: Check previous job results
run: |
if [ "${{ needs.ran-full.result }}" != "success" ] && [ "${{ needs.ran-none.result }}" != "success" ]; then
echo "One or more jobs failed."
exit 1
fi
- run: echo "Workflow succeeded :)"






2 changes: 1 addition & 1 deletion .github/workflows/nightly_linux_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: ./ci/write_version.sh

- name: build release with lto
run: cargo build --profile=release-with-lto --locked --bin roc
run: cargo build --profile=release-with-lto --locked --bin roc --bin roc_ls

- name: get commit SHA
run: echo "SHA=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_linux_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: ./ci/write_version.sh

- name: build release with lto
run: RUSTFLAGS="-C target-cpu=x86-64" cargo build --profile=release-with-lto --locked --bin roc
run: RUSTFLAGS="-C target-cpu=x86-64" cargo build --profile=release-with-lto --locked --bin roc --bin roc_ls
# target-cpu=x86-64 -> For maximal compatibility for all CPU's. This was also faster in our tests: https://roc.zulipchat.com/#narrow/stream/231635-compiler-development/topic/.2Ecargo.2Fconfig.2Etoml/near/325726299

- name: get commit SHA
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/nightly_macos_apple_silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ jobs:
run: ./ci/write_version.sh

- name: build nightly release
run: cargo build --locked --profile=release-with-lto --bin roc

# this makes the roc binary a lot smaller
- name: strip debug info
run: strip ./target/release-with-lto/roc
run: cargo build --locked --profile=release-with-lto --bin roc --bin roc_ls

- name: package release
run: ./ci/package_release.sh ${{ env.RELEASE_FOLDER_NAME }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly_macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
# this issue may be caused by using older versions of XCode

- name: build release
run: RUSTFLAGS="-C target-cpu=x86-64" cargo build --profile=release-with-lto --locked --bin roc
run: RUSTFLAGS="-C target-cpu=x86-64" cargo build --profile=release-with-lto --locked --bin roc --bin roc_ls
# target-cpu=x86-64 -> For maximal compatibility for all CPU's.

- name: get commit SHA
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/nix_linux_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- name: execute tests with --release
run: nix develop -c cargo test --locked --release

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

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

Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/nix_macos_apple_silicon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ jobs:
- name: test building default.nix
run: nix-build

# for skipped tests: see issue 6274
- name: execute tests with --release
run: nix develop -c cargo test --locked --release
run: nix develop -c cargo test --locked --release -- --skip cli_run::inspect_gui --skip cli_run::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
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/nix_macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
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

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 @@ -47,11 +47,8 @@ jobs:
- name: test gen-wasm single threaded # gen-wasm has some multithreading problems to do with the wasmer runtime
run: cargo test --locked --release --package test_gen --no-default-features --features gen-wasm -- --test-threads=1 && sccache --show-stats

- name: run `roc test` on Str builtins
run: cargo run --locked --release -- test crates/compiler/builtins/roc/Str.roc && sccache --show-stats

- name: run `roc test` on Dict builtins
run: cargo run --locked --release -- test crates/compiler/builtins/roc/Dict.roc && sccache --show-stats
- name: roc test all builtins
run: ./ci/roc_test_builtins.sh

- name: wasm repl test
run: crates/repl_test/test_wasm.sh && sccache --show-stats
Expand Down
2 changes: 1 addition & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Luca Cervello <[email protected]>
Josh Mak <[email protected]>
Jakub Kozłowski <[email protected]>
Travis Staloch <[email protected]>
Nick Gravgaard <nick@nickgravgaard.com>
Nick Gravgaard <nick@nick-gravgaard.com>
Keerthana Kasthuril <[email protected]>
Salman Shaik <[email protected]>
Austin Clements <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion BUILDING_FROM_SOURCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ To run the test suite (via `cargo test`), you additionally need to install:
- [`valgrind`](https://www.valgrind.org/) (needs special treatment to [install on macOS](https://stackoverflow.com/a/61359781)
Alternatively, you can use `cargo test --no-fail-fast` or `cargo test -p specific_tests` to skip over the valgrind failures & tests.

For debugging LLVM IR, we use [DebugIR](https://github.com/vaivaswatha/debugir). This dependency is only required to build with the `--debug` flag, and for normal development you should be fine without it.
For emitting LLVM IR for debugging purposes, the `--emit-llvm-ir` flag can be used.

### libxcb libraries

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Check [Building from source](BUILDING_FROM_SOURCE.md) for instructions.
Most contributors execute the following commands before pushing their code:

```sh
cargo test
cargo test --release
cargo fmt --all -- --check
cargo clippy --workspace --tests -- --deny warnings
```
Expand Down
4 changes: 1 addition & 3 deletions Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ build-nightly-release:
COPY --dir .git LICENSE LEGAL_DETAILS ci ./
# version.txt is used by the CLI: roc --version
RUN ./ci/write_version.sh
RUN RUSTFLAGS=$RUSTFLAGS cargo build --profile=release-with-lto --locked --bin roc
# strip debug info
RUN strip ./target/release-with-lto/roc
RUN RUSTFLAGS=$RUSTFLAGS cargo build --profile=release-with-lto --locked --bin roc --bin roc_ls
RUN ./ci/package_release.sh $RELEASE_FOLDER_NAME
RUN ls
SAVE ARTIFACT ./$RELEASE_FOLDER_NAME.tar.gz AS LOCAL $RELEASE_FOLDER_NAME.tar.gz
31 changes: 30 additions & 1 deletion LEGAL_DETAILS
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,33 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

===========================================================

* ankerl::unordered_dense - https://github.com/martinus/unordered_dense

A rather direct port of the source into Roc is currently the implementation for our Dict type.
Source code is in crates/compiler/builtins/roc/Dict.roc

MIT License

Copyright (c) 2022 Martin Leitner-Ankerl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit cd632fe

Please sign in to comment.