Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/actions/setup-rust/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'Setup Rust Environment'
description: 'Sets up Rust and caches dependencies'
inputs:
components:
description: "Rust components to install (e.g., rustfmt, clippy)"
required: false
default: ""
runs:
using: "composite"
steps:
- name: Extract Rust version from rust-toolchain.toml
id: rustver
shell: bash
run: |
rust_version=$(grep -E '^[[:space:]]*channel[[:space:]]*=' rust-toolchain.toml \
| sed -E 's/.*"([^"]+)".*/\1/')
echo "rust_version=${rust_version}" >>"$GITHUB_OUTPUT"
echo "Rust version: ${rust_version}"

- name: Install Rust
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ steps.rustver.outputs.rust_version }}
components: ${{ inputs.components }}

- name: Add Rust Cache
uses: Swatinem/rust-cache@v2
55 changes: 55 additions & 0 deletions .github/workflows/pr_main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Integration Tests
on:
push:
branches: ["main"]
merge_group:
pull_request:
branches: ["**"]

permissions:
contents: read
actions: write

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
# "Lint" is a required check, don't change the name
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup Rust Environment
uses: ./.github/actions/setup-rust
with:
components: rustfmt, clippy

- name: Run cargo check
run: cargo check

- name: Run cargo clippy
run: |
cargo clippy -- -D warnings

- name: Run cargo fmt
run: |
cargo fmt --all -- --check

test:
# "Test" is a required check, don't change the name
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup Rust Environment
uses: ./.github/actions/setup-rust

- name: Run tests
run: |
make test-no-compile
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/target
/program_artifacts
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ clean:
-rm -rf $(RUST_ARTIFACTS_DIR)
mkdir -p $(RUST_ARTIFACTS_DIR)

test: compile-programs
cargo test
test: compile-programs test-no-compile

test-asm: compile-programs-asm
cargo test --test asm

test-rust: compile-programs-rust
cargo test --test rust

test-no-compile:
cargo test
Binary file added program_artifacts/asm/basic_program.elf
Binary file not shown.
Binary file added program_artifacts/rust/basic_rust.elf
Binary file not shown.
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.90.0"
profile = "default"
3 changes: 1 addition & 2 deletions src/vm/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum InstructionFormat {
I,
S,
B,
U,
_U,
J,
}

Expand All @@ -54,7 +54,6 @@ impl Opcode {
&Opcode::Store => InstructionFormat::S,
&Opcode::Branch => InstructionFormat::B,
&Opcode::JumpAndLink => InstructionFormat::J,
_ => unimplemented!(),
}
}
}
Expand Down