diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c35ff9..bb50c19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,28 +3,7 @@ on: push: branches: - '**' - - '!main' jobs: - lint: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v3 - - name: Install latest stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - components: rustfmt, clippy - - - name: Run cargo check - uses: actions-rs/cargo@v1 - with: - command: check - - - name: Run cargo clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings test: runs-on: ubuntu-22.04 services: @@ -35,13 +14,62 @@ jobs: - 8080:8080 steps: - uses: actions/checkout@v3 + + - uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock') }} + - name: Install latest stable uses: actions-rs/toolchain@v1 with: toolchain: stable + profile: minimal + override: true - name: Run tests uses: actions-rs/cargo@v1 with: command: test args: --workspace + + fmt: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Install latest stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt + override: true + + - name: Run cargo fmt + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + clippy: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-clippy-${{ hashFiles('Cargo.lock') }} + + - name: Install latest stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: clippy + override: true + + - name: Run cargo clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: -- -D warnings diff --git a/.github/workflows/extra.yml b/.github/workflows/extra.yml new file mode 100644 index 0000000..9409ea2 --- /dev/null +++ b/.github/workflows/extra.yml @@ -0,0 +1,15 @@ +name: Extra +on: + push: + branches: + - main +jobs: + extra: + runs-on: ubuntu-22.04 + steps: + # build and cache this here in order to reuse it's cache in feature branches + - name: Install cargo-edit + uses: baptiste0928/cargo-install@v1 + with: + crate: cargo-edit + version: 0.9.1 \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2e7a7cd..33c4d8b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,6 +46,7 @@ jobs: with: toolchain: stable profile: minimal + override: true - name: Login uses: actions-rs/cargo@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c75ccb6..f050bd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,6 +20,7 @@ jobs: uses: baptiste0928/cargo-install@v1 with: crate: cargo-edit + version: 0.9.1 - name: Determine version id: vars @@ -49,7 +50,8 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - branch: main + # - name: Create Pull Request + # uses: peter-evans/create-pull-request@v4 + # with: + # base: origin/create_release/${{ steps.vars.outputs.result }}" + # branch: main diff --git a/qbittorrent-web-api-gen/src/group.rs b/qbittorrent-web-api-gen/src/group.rs index 67cc7e0..b7809eb 100644 --- a/qbittorrent-web-api-gen/src/group.rs +++ b/qbittorrent-web-api-gen/src/group.rs @@ -4,7 +4,11 @@ use case::CaseExt; use quote::{format_ident, quote}; use regex::Regex; -use crate::{parser::{self, types::TypeInfo}, skeleton::auth_ident, util}; +use crate::{ + parser::{self, types::TypeInfo}, + skeleton::auth_ident, + util, +}; pub fn generate_groups(groups: Vec) -> proc_macro2::TokenStream { let gr = groups diff --git a/qbittorrent-web-api-gen/src/lib.rs b/qbittorrent-web-api-gen/src/lib.rs index 75a9b9c..e66d01d 100644 --- a/qbittorrent-web-api-gen/src/lib.rs +++ b/qbittorrent-web-api-gen/src/lib.rs @@ -1,8 +1,8 @@ mod group; +mod md_parser; +mod parser; mod skeleton; mod util; -mod parser; -mod md_parser; use case::CaseExt; use proc_macro::TokenStream; diff --git a/qbittorrent-web-api-gen/src/parser/group_parser/mod.rs b/qbittorrent-web-api-gen/src/parser/group_parser/mod.rs index 0683654..7b8d799 100644 --- a/qbittorrent-web-api-gen/src/parser/group_parser/mod.rs +++ b/qbittorrent-web-api-gen/src/parser/group_parser/mod.rs @@ -1,8 +1,8 @@ use crate::md_parser::TokenTree; -use self::{return_type::get_return_type, parameters::get_parameters}; +use self::{parameters::get_parameters, return_type::get_return_type}; -use super::{ApiGroup, ApiMethod, util}; +use super::{util, ApiGroup, ApiMethod}; mod description; mod parameters; diff --git a/qbittorrent-web-api-gen/src/parser/group_parser/return_type.rs b/qbittorrent-web-api-gen/src/parser/group_parser/return_type.rs index 241d4d0..c79c929 100644 --- a/qbittorrent-web-api-gen/src/parser/group_parser/return_type.rs +++ b/qbittorrent-web-api-gen/src/parser/group_parser/return_type.rs @@ -1,4 +1,7 @@ -use crate::{md_parser::MdContent, parser::{ReturnType, object_types::get_object_types, ReturnTypeParameter, types::Type}}; +use crate::{ + md_parser::MdContent, + parser::{object_types::get_object_types, types::Type, ReturnType, ReturnTypeParameter}, +}; pub fn get_return_type(content: &[MdContent]) -> Option { let table = content