OliverFM / rust_light

A tensor processing library in rust.
MIT License
3 stars 0 forks source link

Enforce everything passing with clippy before merging PRs #29

Open OliverFM opened 1 year ago

OliverFM commented 1 year ago

Currently many things are failing, and I probably won't fix them all unless I have to. This is in large part because I have added various helper methods that I know I will need even if I haven't run into the need to use them yet.

aidenfoxivey commented 1 year ago

I'm gonna start working on this. From what I can tell, a git hook is what we're looking for here.

https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks

This is cool, but it only seems to work on the client side.

Maybe there's some GitHub feature to do verification here?

https://git-scm.com/book/en/v2/Customizing-Git-An-Example-Git-Enforced-Policy#_an_example_git_enforced_policy

I'll give the server-side hooks a shot.

aidenfoxivey commented 1 year ago

Hmm, okay so I've found something for just pushes in general to the server, but something for merging PRs is rather difficult.

aidenfoxivey commented 1 year ago
name: Rust

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Build
      run: cargo build --verbose
    - name: Run tests
      run: cargo test --verbose
    - name: Format code
      run: cargo fmt
    - name: Run Clippy
      run: cargo clippy

This might actually be the solution to the problem here. I tried testing it locally but no luck. I'll try to test it on a remote repository.

aidenfoxivey commented 1 year ago

Okay, yeah so the important part is this:

cargo clippy --verbose --all-features -- -D warnings ^^^^^^^^^^^

This allows it to fail on warnings.

aidenfoxivey commented 1 year ago

Covered in #35.

aidenfoxivey commented 1 year ago

Can this be closed now?

OliverFM commented 1 year ago

Can this be closed now?

@aidenfoxivey not quite, since the PRs aren't yet blocked on this check, so it is 90% of the way there. I haven't found the time to get it completely over the line though 😿