From 40e3b55be68bcc82823904801a3e9bb850e8bea2 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 01:46:34 +0200 Subject: [PATCH 1/9] Try to set base --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c75ccb6..3e5921b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,4 +52,5 @@ jobs: - name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: + base: origin/create_release/${{ steps.vars.outputs.result }}" branch: main From 71760f5d18f9fe8210e0a78ac2981de20b0e3123 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 01:52:04 +0200 Subject: [PATCH 2/9] Debug --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3e5921b..f7aa05b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,8 +49,8 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }} - - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 - with: - base: origin/create_release/${{ steps.vars.outputs.result }}" - branch: main + # - name: Create Pull Request + # uses: peter-evans/create-pull-request@v4 + # with: + # base: origin/create_release/${{ steps.vars.outputs.result }}" + # branch: main From 5a61f80b4eb3b5d7efe8d3ce1cef72a0b280e3e2 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 01:54:35 +0200 Subject: [PATCH 3/9] Set cargo-edit version --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7aa05b..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 From b5df2944b58fdd9b24c2cd7be3ea3c49c4e7e3b5 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 02:01:10 +0200 Subject: [PATCH 4/9] Add cache --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f050bd2..9b9e1ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,10 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 + - uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} - name: Install latest stable uses: actions-rs/toolchain@v1 From e617f8c662470e946cdf0c32d5b42b8263577522 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 02:07:48 +0200 Subject: [PATCH 5/9] Add caching --- .github/workflows/ci.yml | 64 ++++++++++++++++++++++++----------- .github/workflows/publish.yml | 1 + 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c35ff9..3881030 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,26 +5,6 @@ on: - '**' - '!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 +15,57 @@ jobs: - 8080:8080 steps: - uses: actions/checkout@v3 + + - uses: actions/cache@v2 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ 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 + + - 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/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 From 14e09d74a149572a8c975277e68753da66852436 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 02:09:17 +0200 Subject: [PATCH 6/9] Cargo fmt fix --- qbittorrent-web-api-gen/src/group.rs | 6 +++++- qbittorrent-web-api-gen/src/lib.rs | 4 ++-- qbittorrent-web-api-gen/src/parser/group_parser/mod.rs | 4 ++-- .../src/parser/group_parser/return_type.rs | 5 ++++- 4 files changed, 13 insertions(+), 6 deletions(-) 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 From 7f7c372e59211ed8aad4d5e3a881edb20877381f Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 02:16:38 +0200 Subject: [PATCH 7/9] More caching --- .github/workflows/ci.yml | 7 ++++++- .github/workflows/release.yml | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3881030..b37f3c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/cache@v2 with: path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} + key: ${{ runner.os }}-cargo-test-${{ hashFiles('Cargo.lock') }} - name: Install latest stable uses: actions-rs/toolchain@v1 @@ -57,6 +57,11 @@ jobs: 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: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b9e1ad..d42ae12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,10 +8,11 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 + - uses: actions/cache@v2 with: path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} + key: ${{ runner.os }}-cargo-release-${{ hashFiles('Cargo.lock') }} - name: Install latest stable uses: actions-rs/toolchain@v1 From 9e6ce59d8b6283ab95150eca174473ab8055a448 Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 02:35:18 +0200 Subject: [PATCH 8/9] Run on main branch to utilize cache --- .github/workflows/ci.yml | 11 ++++++++++- .github/workflows/release.yml | 5 ----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b37f3c3..2f80b20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,6 @@ on: push: branches: - '**' - - '!main' jobs: test: runs-on: ubuntu-22.04 @@ -74,3 +73,13 @@ jobs: with: command: clippy args: -- -D warnings + + 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d42ae12..f050bd2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,11 +9,6 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/cache@v2 - with: - path: ~/.cargo/registry - key: ${{ runner.os }}-cargo-release-${{ hashFiles('Cargo.lock') }} - - name: Install latest stable uses: actions-rs/toolchain@v1 with: From 290831c867cdc29ba22773368690dd6b9050ebfa Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Mon, 11 Jul 2022 02:39:21 +0200 Subject: [PATCH 9/9] Only build extras on main --- .github/workflows/ci.yml | 10 ---------- .github/workflows/extra.yml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/extra.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f80b20..bb50c19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,13 +73,3 @@ jobs: with: command: clippy args: -- -D warnings - - 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 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