Skip to content

Commit c49d191

Browse files
authored
Setup CI (#1)
* feat: Add CI Signed-off-by: Ethan Uppal <[email protected]> * chore: Bump marlin to 0.6.1 Signed-off-by: Ethan Uppal <[email protected]> * ci: Debug stuff Signed-off-by: Ethan Uppal <[email protected]> * ci: ? Signed-off-by: Ethan Uppal <[email protected]> * test: Rework how Marlin testing is done Signed-off-by: Ethan Uppal <[email protected]> * test: Bring back calling veryl build on independent test runs Signed-off-by: Ethan Uppal <[email protected]> * fix: Remove testing code Signed-off-by: Ethan Uppal <[email protected]> --------- Signed-off-by: Ethan Uppal <[email protected]>
1 parent ae8df19 commit c49d191

File tree

4 files changed

+43
-6
lines changed

4 files changed

+43
-6
lines changed

.github/workflows/marlin.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Marlin CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
CARGO_INCREMENTAL: 1 # since we cache
12+
13+
jobs:
14+
test_veryl:
15+
strategy:
16+
matrix:
17+
os: [ubuntu-latest, macos-15]
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: dtolnay/rust-toolchain@stable
22+
- uses: Swatinem/rust-cache@v2
23+
- name: Install Verilator
24+
run: |
25+
if [[ "$(uname)" == "Darwin" ]]; then
26+
brew install verilator
27+
else
28+
sudo apt-get install -y verilator
29+
fi
30+
- name: Install Veryl
31+
uses: veryl-lang/setup-veryl@v1
32+
- name: Test
33+
run: veryl build && cargo test

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ edition = "2024"
66
[dependencies]
77

88
[dev-dependencies]
9-
marlin = { version = "0.5.0", features = ["veryl"] }
9+
marlin = { version = "0.6.1", features = ["veryl"] }
1010
snafu = "0.8.5"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ fn test_alu() -> Result<(), Whatever> {
9292
To run tests and capture the output:
9393

9494
```shell
95+
veryl build
9596
cargo test -- --nocapture
9697
```
9798

tests/veryl_tests.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// file: tests/simple_test.rs
1+
use std::env;
2+
23
use marlin::veryl::prelude::*;
34
use snafu::Whatever;
45

@@ -12,8 +13,9 @@ pub struct Alu32;
1213
#[snafu::report]
1314
fn test_full_adder() -> Result<(), Whatever> {
1415
let runtime = VerylRuntime::new(VerylRuntimeOptions {
15-
call_veryl_build: true, /* warning: not thread safe! don't use if you
16-
* have multiple tests */
16+
call_veryl_build: env::var("RUNNING_TESTS_INDEPENDENTLY")
17+
.map(|value| &value == "1")
18+
.unwrap_or(false),
1719
..Default::default()
1820
})?;
1921

@@ -68,8 +70,9 @@ fn test_alu() -> Result<(), Whatever> {
6870
}
6971

7072
let runtime = VerylRuntime::new(VerylRuntimeOptions {
71-
call_veryl_build: true, /* warning: not thread safe! don't use if you
72-
* have multiple tests */
73+
call_veryl_build: env::var("RUNNING_TESTS_INDEPENDENTLY")
74+
.map(|value| &value == "1")
75+
.unwrap_or(false),
7376
..Default::default()
7477
})?;
7578

0 commit comments

Comments
 (0)