diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..af2a1ee --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_TERM_COLOR: always + # Make sure CI fails on all warnings, including Clippy lints + RUSTFLAGS: "-Dwarnings" + +jobs: + lint: + # Name the Job + name: Lint Code Base + # Set the agent to run on + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + # Full git history is needed to get a proper + # list of changed files within `super-linter` + fetch-depth: 0 + + - name: Lint Code Base + uses: super-linter/super-linter@v5 + env: + VALIDATE_ALL_CODEBASE: true + VALIDATE_RUST_2021: true + VALIDATE_RUST_CLIPPY: true + DEFAULT_BRANCH: master + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + test: + name: Rust tests + strategy: + matrix: + environment: [ubuntu-latest, macos-latest, windows-latest] + + runs-on: ${{ matrix.environment }} + + steps: + - uses: actions/checkout@v3 + - run: rustup update + - run: cargo test \ No newline at end of file diff --git a/README.md b/README.md index 3446792..0d47019 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ `roundme` is a human-assisted rounding analyzer. It helps its operator determine whether an arithmetic operation should round up or down. ## Features + - Recommends whether an arithmetic operation needs to round up or down - Generates LaTeX-based reports in PDF @@ -12,7 +13,7 @@ - `A + B => rounding(A), rounding(B)` (addition does not change the rounding direction) - `A - B => rounding(A), ! rounding(B)` (the rounding direction of the substracted element is inverse of the expected rounding) -- `A * B => rounding(A), rounding(B), rounding(*) ` (multiplication does not change the rounding direction) +- `A * B => rounding(A), rounding(B), rounding(*)` (multiplication does not change the rounding direction) - `A / B => rounding(A), ! rounding(B), rounding(/)` (the rounding direction of the denominator is the inverse of the expected rounding) - `A ** B` - `If A>=1 => rounding(A), rounding(B)` @@ -20,8 +21,8 @@ ## How to use -- Run `roundme init` to generate a default configuration file. -- Run `roundme config` to generate user configuration file. +- Run `roundme init` to generate a default configuration file. +- Run `roundme config` to generate user configuration file. - Run `roundme analyze` to analyze the configuration file - Run `roundme pdf` to generate a PDF (require `latexmk`) @@ -31,12 +32,14 @@ Running `roundme pdf` on the default configuration will generate the following: ### Configuration `roundme` relies on a configuration file: + ```yaml formula: a * b / c round_up: true less_than_one: ["a * b"] # optional greater_than_one: ["c"] # optional ``` + - `formula` contains the formula to be analyze - `round_up` determines if the result of the formula should round up or down - `less_than_one` is used for the `**` [rules](#rules) *(raw string comparison and sensible to space)* @@ -47,11 +50,13 @@ See the [balancer V2](./examples/balancer/README.md) example. ## Install Install with + ```bash cargo install roundme ``` To install the latest GitHub version + ```bash git clone git@github.com:crytic/roundme.git cd roundme