Skip to content

Commit 74b0003

Browse files
authored
Merge branch 'main' into spellcheck
2 parents bc82a6b + a27ff91 commit 74b0003

File tree

23 files changed

+881
-420
lines changed

23 files changed

+881
-420
lines changed

.github/workflows/pr_benchmarks.yml

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- id: get_branch
1717
if: github.event.pull_request.merged == true && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
18-
run: echo "branch_name=master" >> "$GITHUB_OUTPUT"
18+
run: echo "branch_name=main" >> "$GITHUB_OUTPUT"
1919

2020
backup_branch:
2121
runs-on: ubuntu-latest
@@ -26,8 +26,7 @@ jobs:
2626
if: github.event.pull_request.merged == true || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
2727
run: echo "branch_name=$GITHUB_REF_NAME" >> "$GITHUB_OUTPUT"
2828

29-
30-
benchmark_pr_with_bencher:
29+
benchmark_pr_with_bencher_iai:
3130
needs: [target_branch, backup_branch]
3231
permissions:
3332
pull-requests: write
@@ -37,7 +36,37 @@ jobs:
3736
BENCHER_PROJECT: sl-sh
3837
BENCHER_TESTBED: ubuntu-latest
3938
BENCHER_ADAPTER: rust_iai_callgrind
40-
BRANCH: ${{ needs.target_branch.outputs.branch_name || needs.backup_branch.outputs.branch_name || github.event.pull_request.base.ref || 'master' }}
39+
BRANCH: ${{ needs.target_branch.outputs.branch_name || needs.backup_branch.outputs.branch_name || github.event.pull_request.base.ref || 'main' }}
40+
steps:
41+
- run: sudo apt-get update
42+
- run: sudo apt install -y valgrind gnuplot
43+
- uses: actions/checkout@v4
44+
- uses: bencherdev/bencher@main
45+
- run: cargo install iai-callgrind-runner --version 0.10.2
46+
- name: cargo test --no-run benches (debug mode) to check compile
47+
run: cargo test --benches --no-run
48+
- name: Track Benchmarks with Bencher
49+
run: |
50+
echo "Running bencher for branch ${BRANCH}."
51+
bencher run \
52+
--if-branch "${BRANCH}" \
53+
--else-if-branch "main" \
54+
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
55+
--token "${{ secrets.BENCHER_API_TOKEN }}" \
56+
--err \
57+
"cargo bench --all"
58+
59+
benchmark_pr_with_bencher_criterion:
60+
needs: [target_branch, backup_branch]
61+
permissions:
62+
pull-requests: write
63+
name: Continuous Benchmarking with Bencher
64+
runs-on: ubuntu-latest
65+
env:
66+
BENCHER_PROJECT: sl-sh
67+
BENCHER_TESTBED: ubuntu-latest
68+
BENCHER_ADAPTER: rust_criterion
69+
BRANCH: ${{ needs.target_branch.outputs.branch_name || needs.backup_branch.outputs.branch_name || github.event.pull_request.base.ref || 'main' }}
4170
steps:
4271
- run: sudo apt-get update
4372
- run: sudo apt install -y valgrind gnuplot
@@ -46,12 +75,13 @@ jobs:
4675
- run: cargo install iai-callgrind-runner --version 0.10.2
4776
- name: cargo test --no-run benches (debug mode) to check compile
4877
run: cargo test --benches --no-run
78+
4979
- name: Track Benchmarks with Bencher
5080
run: |
51-
echo "Running bencher for branch $BRANCH."
81+
echo "Running bencher for branch ${BRANCH}."
5282
bencher run \
53-
--if-branch "$BRANCH" \
54-
--else-if-branch "master" \
83+
--if-branch "${BRANCH}" \
84+
--else-if-branch "main" \
5585
--github-actions "${{ secrets.GITHUB_TOKEN }}" \
5686
--token "${{ secrets.BENCHER_API_TOKEN }}" \
5787
--err \

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ cargo run -p slosh
6464
- install binary
6565

6666
```
67-
sudo install -D -m 755 target/release/slosh /usr/local/bin/
67+
mkdir -p /usr/local/bin
68+
sudo install -m 755 target/release/slosh /usr/local/bin/
6869
```
6970
7071
- add slosh to /etc/shells and change login shell to slosh
@@ -73,6 +74,11 @@ sudo install -D -m 755 target/release/slosh /usr/local/bin/
7374
echo /usr/local/bin/slosh | sudo tee -a /etc/shells
7475
chsh -s /usr/local/bin/slosh
7576
```
77+
### 4. (Optional) Configure slosh
78+
The slosh configuration file lives at ~/.config/slosh/init.slosh. <br>
79+
If you run slosh and the file does not exist, a default one will be created for you. <br>
80+
Review your existing shell configuration files like ~/.bashrc and ~/.bash_profile and manually translate them to slosh syntax and add to your init.slosh file <br>
81+
For example, `export JAVA_HOME="/usr/local/opt/openjdk@11/bin/java"` becomes `(sh "export JAVA_HOME='/usr/local/opt/openjdk@11/bin/java'")`
7682
7783
## Compiler
7884

builtins/src/collections.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ pub fn occurs(environment: &mut SloshVm, haystack: Value, needle: Value) -> VMRe
152152
/// Section: collection
153153
///
154154
/// Example:
155-
/// (assert-true (in? [1 2 3 4 5] 3))
156-
/// (assert-false (in? [1 2 3 4 5] 9))
157-
/// (assert-true (in? (list 1 2 3 4 5) 3))
158-
/// (assert-true (in? '(1 2 3 4 5) 5))
155+
/// (test::assert-true (in? [1 2 3 4 5] 3))
156+
/// (test::assert-false (in? [1 2 3 4 5] 9))
157+
/// (test::assert-true (in? (list 1 2 3 4 5) 3))
158+
/// (test::assert-true (in? '(1 2 3 4 5) 5))
159159
#[sl_sh_fn(fn_name = "in?", takes_env = true)]
160160
pub fn is_in(environment: &mut SloshVm, haystack: Value, needle: Value) -> VMResult<Value> {
161161
let mut stack = vec![];
@@ -254,12 +254,12 @@ pub fn flatten(vm: &mut SloshVm, registers: &[Value]) -> VMResult<Value> {
254254
///
255255
/// Example:
256256
/// (let (tmap [1 2 3 0])
257-
/// (assert-false (empty? tmap))
257+
/// (test::assert-false (empty? tmap))
258258
/// (set! tmap (reverse tmap))
259-
/// (assert-equal 2 (get tmap 2))
260-
/// (assert-equal 1 (get tmap 3))
261-
/// (assert-equal 0 (get tmap 0))
262-
/// (assert-error (reverse "string")))
259+
/// (test::assert-equal 2 (get tmap 2))
260+
/// (test::assert-equal 1 (get tmap 3))
261+
/// (test::assert-equal 0 (get tmap 0))
262+
/// (test::assert-error (reverse "string")))
263263
#[sl_sh_fn(fn_name = "reverse", takes_env = true)]
264264
pub fn reverse(environment: &mut SloshVm, seq: Value) -> VMResult<Value> {
265265
match seq {
@@ -332,10 +332,10 @@ it into one vector of values.
332332
Section: collection
333333
334334
Example:
335-
(assert-equal [1 2 3 1 2 3] (flatten 1 2 3 (list 1 2 3)))
336-
(assert-equal [1 2 3 1 2 3] (flatten 1 2 3 [1 2 3]))
337-
(assert-equal [1 2 3 1 2] (flatten 1 2 3 (list 1 2)))
338-
(assert-equal [1 2 3 1 2 3 1 2] (flatten 1 2 3 (list 1 2 3 (list 1 2))))
335+
(test::assert-equal [1 2 3 1 2 3] (flatten 1 2 3 (list 1 2 3)))
336+
(test::assert-equal [1 2 3 1 2 3] (flatten 1 2 3 [1 2 3]))
337+
(test::assert-equal [1 2 3 1 2] (flatten 1 2 3 (list 1 2)))
338+
(test::assert-equal [1 2 3 1 2 3 1 2] (flatten 1 2 3 (list 1 2 3 (list 1 2))))
339339
",
340340
);
341341
add_builtin(

builtins/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ Remainder from dividing first int by the second.
191191
Section: math
192192
193193
Example:
194-
(ns-import 'math)
195194
(test::assert-equal 0 (rem 50 10))
196195
(test::assert-equal 5 (rem 55 10))
197196
(test::assert-equal 1 (rem 1 2))

builtins/src/print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub fn fprn(vm: &mut SloshVm, registers: &[Value]) -> VMResult<Value> {
153153
} else {
154154
Err(VMError::new(
155155
"io",
156-
"fpr: require a writable IO object as first parameter",
156+
"fprn: require a writable IO object as first parameter",
157157
))
158158
}
159159
}

0 commit comments

Comments
 (0)