From 92110afeb3af205776589ccd7b482bf8d46b24d0 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Mon, 18 Sep 2023 21:06:10 +0200 Subject: [PATCH] ci: add ci for testing and linting --- .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ src/command.rs | 8 +++----- 2 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fdb472a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +on: + push: + branches: + - 'master' + pull_request: + +name: build-and-test + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + check: + name: Build and Check + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v4 + + - run: rustup toolchain install stable --profile minimal + - uses: Swatinem/rust-cache@v2 + - run: cargo fmt --check + - run: cargo clippy --workspace -- -Dwarnings + - run: cargo build --workspace + - run: cargo test --workspace diff --git a/src/command.rs b/src/command.rs index 03c2473..bcc5471 100644 --- a/src/command.rs +++ b/src/command.rs @@ -62,11 +62,9 @@ impl CommandParser { let args = args?; Some(Sandwich { to: args[0] }) } - x => { - self.url_commands_json.get(x).map(|url| Url { - url: url.as_str().unwrap(), - }) - } + x => self.url_commands_json.get(x).map(|url| Url { + url: url.as_str().unwrap(), + }), } } else if self.backticked_help_regex.is_match(string).unwrap() { let mut docs = self