-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
57bcb8f
commit a0a00ca
Showing
9 changed files
with
566 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Run tests | ||
name: CI Checks (Linting and Tests) | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
|
||
concurrency: | ||
group: tests-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
JWT_SECRET: test | ||
AWS_ACCESS_KEY_ID: test | ||
AWS_SECRET_ACCESS_KEY: test | ||
AWS_ENDPOINT_URL_DYNAMODB: http://localhost:8000 | ||
AWS_REGION: us-east-1 | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
test: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Run cargo test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
|
||
lints: | ||
name: Lints | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
- name: Run cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# .gitignore | ||
|
||
# Rust | ||
/target | ||
Cargo.lock | ||
**/*.rs.bk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[workspace] | ||
|
||
members = ["klang"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# /usr/bin/env klang | ||
# Defines a simple klang program. | ||
# This program is designed to get a robot to clean up soda cans. | ||
|
||
action <Teleop> { | ||
outcomes { | ||
success [Success] | ||
failure [Failure] | ||
} | ||
} | ||
|
||
action <Find {item}> { | ||
notes { | ||
prefer [Move quickly] | ||
avoid [Bumping into other objects] | ||
avoid [Moving too hastily] | ||
avoid [Moving slowly or staying in the same place for a long time] | ||
} | ||
|
||
outcomes { | ||
success [Found {item}] | ||
failure [Haven't moved in a while] | ||
} | ||
} | ||
|
||
action <Pick up {item}> { | ||
outcomes { | ||
success [Holding {item}] | ||
failure [Knocked over {item}] | ||
retry [Not holding {item}] | ||
} | ||
} | ||
|
||
action <Put {item} into {container}> { | ||
outcomes { | ||
success [{item} is inside {container} and we are not holding it] | ||
failure [Dropped {item} outside the {container}] | ||
retry [Still holding {item}] | ||
} | ||
} | ||
|
||
action <Empty the soda can into the sink> { | ||
outcomes { | ||
success [Successfully emptied the soda can into the sink] | ||
failure [Spilled soda outside the sink] | ||
retry [There is still soda in the can] | ||
} | ||
} | ||
|
||
loop { | ||
<Find a soda can> | ||
<Pick up the soda can> | ||
<Find the sink> | ||
<Empty the soda can into the sink> | ||
<Find the recycling bin> | ||
<Put the soda can into the recycling bin> | ||
} until { | ||
[No more soda cans] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[package] | ||
|
||
name = "klang" | ||
version = "0.1.0" | ||
authors = ["K-Scale Labs"] | ||
edition = "2021" | ||
|
||
[dependencies] | ||
|
||
pest = "2.6" | ||
pest_derive = "2.6" | ||
thiserror = "1.0" | ||
|
||
[[bin]] | ||
|
||
name = "klang" | ||
path = "src/main.rs" |
Oops, something went wrong.