Skip to content

Commit

Permalink
Setup CI (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddoktorski authored Aug 8, 2024
1 parent 43a461f commit 9229242
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 4 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI

on:
pull_request:
push:
branches:
- main

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84
- run: cargo test --release

rustfmt:
name: Check rust formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84
- run: cargo fmt --check

scarbfmt:
name: Check cairo formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: software-mansion/[email protected]
- run: |
output=$(find . -type f -name "Scarb.toml" -execdir sh -c '
echo "Running \"scarb fmt\" in directory: $PWD"
scarb fmt --check
' \;)
echo "$output"
if grep -iq "Diff" <<< "$output"; then
exit 1
fi
exit 0
clippy:
name: Check linter
runs-on: ubuntu-latest
env:
# Make sure CI fails on all warnings - including Clippy lints.
RUSTFLAGS: "-Dwarnings"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84
- run: cargo lint

typos:
name: Check typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: typos-action
uses: crate-ci/[email protected]
3 changes: 1 addition & 2 deletions crates/cairo-coverage/tests/data/test_project/src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@

fn increase_by_two(arg: u8) -> u8 {
assert(2 == 2, 'prevents const folding');
increase_by_one(arg + 1) // inlines
}
}

fn increase_by_one(arg: u8) -> u8 {
assert(1 == 1, 'prevents const folding');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use test_project::{increase_by_one, increase_by_two};

#[test]
fn my_test() {
assert(increase_by_two(1) == 3, ''); // inlines
assert(increase_by_one(1) == 2, ''); // inlines
assert(increase_by_two(1) == 3, ''); // inlines
assert(increase_by_one(1) == 2, ''); // inlines
}

1 change: 1 addition & 0 deletions crates/cairo-coverage/tests/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

0 comments on commit 9229242

Please sign in to comment.