From 11b269179916cf45458d10e6cbc58184a02e7f9d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 06:38:48 +0000 Subject: [PATCH 1/5] build(deps): bump env_logger from 0.10.2 to 0.11.2 Bumps [env_logger](https://github.com/rust-cli/env_logger) from 0.10.2 to 0.11.2. - [Release notes](https://github.com/rust-cli/env_logger/releases) - [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-cli/env_logger/compare/v0.10.2...v0.11.2) --- updated-dependencies: - dependency-name: env_logger dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 91 ++++++++++++++++++++++++++++++++++++++++++++---------- Cargo.toml | 2 +- 2 files changed, 76 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5122de..9f73842 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,6 +109,54 @@ dependencies = [ "winapi", ] +[[package]] +name = "anstream" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" + +[[package]] +name = "anstyle-parse" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +dependencies = [ + "windows-sys 0.52.0", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +dependencies = [ + "anstyle", + "windows-sys 0.52.0", +] + [[package]] name = "anyhow" version = "1.0.80" @@ -772,6 +820,12 @@ dependencies = [ "inout", ] +[[package]] +name = "colorchoice" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" + [[package]] name = "common-path" version = "1.0.0" @@ -1238,17 +1292,27 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" +[[package]] +name = "env_filter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" +dependencies = [ + "log", + "regex", +] + [[package]] name = "env_logger" -version = "0.10.2" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" +checksum = "6c012a26a7f605efc424dd53697843a72be7dc86ad2d01f7814337794a12231d" dependencies = [ + "anstream", + "anstyle", + "env_filter", "humantime", - "is-terminal", "log", - "regex", - "termcolor", ] [[package]] @@ -2013,17 +2077,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -4761,6 +4814,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "valuable" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index d7faadf..67f4b8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ categories = ["finance"] tokio = { version = "1", features = ["full"] } tokio-util = { version = "0.7", features = ["full"] } anyhow = "1" -env_logger = "0.10" +env_logger = "0.11" log = "0.4" subxt = { version = "0.34", features = ["substrate-compat"] } axum = "0.7" From ca17c4913005e83a52c7ef8326d7cef0b0318b16 Mon Sep 17 00:00:00 2001 From: Nyoxis Date: Tue, 5 Mar 2024 04:57:32 +0200 Subject: [PATCH 2/5] CI: Added build and draft release job --- .github/workflows/rust-cargo-build.yml | 49 ++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/rust-cargo-build.yml diff --git a/.github/workflows/rust-cargo-build.yml b/.github/workflows/rust-cargo-build.yml new file mode 100644 index 0000000..c2bb3d5 --- /dev/null +++ b/.github/workflows/rust-cargo-build.yml @@ -0,0 +1,49 @@ +name: Rust cargo build + +on: + push: + branches: + - main + - stable + +jobs: + check: + name: Cargo build + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout sources + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 50 + submodules: 'recursive' + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + + - name: cargo build + run: cargo build --release + + - name: Get package version + run: > + echo "VERSION=$( + cargo metadata --no-deps | + jq -r '.packages[] | select(.name == "kalatori") | .version' + )" >> $GITHUB_ENV + + - name: Draft release binary + run: gh release create -d $VERSION ./target/release/kalatori --generate-notes \ No newline at end of file From 22ef5fe1d63a867d76932e43c1b7524ce86d40e8 Mon Sep 17 00:00:00 2001 From: Nyoxis Date: Wed, 6 Mar 2024 04:13:44 +0200 Subject: [PATCH 3/5] ci: Added build and draft release job Added package version bump check --- .github/workflows/rust-cargo-build.yml | 49 ---------- .github/workflows/rust-check-version.yml | 112 +++++++++++++++++++++++ vergt.sh | 34 +++++++ 3 files changed, 146 insertions(+), 49 deletions(-) delete mode 100644 .github/workflows/rust-cargo-build.yml create mode 100644 .github/workflows/rust-check-version.yml create mode 100755 vergt.sh diff --git a/.github/workflows/rust-cargo-build.yml b/.github/workflows/rust-cargo-build.yml deleted file mode 100644 index c2bb3d5..0000000 --- a/.github/workflows/rust-cargo-build.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Rust cargo build - -on: - push: - branches: - - main - - stable - -jobs: - check: - name: Cargo build - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: Checkout sources - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 50 - submodules: 'recursive' - - - name: Install Rust stable toolchain - uses: actions-rs/toolchain@v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.3 - - - name: cargo build - run: cargo build --release - - - name: Get package version - run: > - echo "VERSION=$( - cargo metadata --no-deps | - jq -r '.packages[] | select(.name == "kalatori") | .version' - )" >> $GITHUB_ENV - - - name: Draft release binary - run: gh release create -d $VERSION ./target/release/kalatori --generate-notes \ No newline at end of file diff --git a/.github/workflows/rust-check-version.yml b/.github/workflows/rust-check-version.yml new file mode 100644 index 0000000..046d795 --- /dev/null +++ b/.github/workflows/rust-check-version.yml @@ -0,0 +1,112 @@ +name: Rust check version and build + +on: + pull_request: + push: + branches: + - main + +jobs: + version: + name: Check version + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: Checkout base + uses: actions/checkout@v4.1.1 + if: github.event_name == 'pull_request' + with: + ref: ${{ github.event.pull_request.base.ref }} + fetch-depth: 50 + submodules: 'recursive' + + - name: Checkout before push + uses: actions/checkout@v4.1.1 + if: github.event_name != 'pull_request' + with: + ref: ${{ github.event.before }} + fetch-depth: 50 + submodules: 'recursive' + + - name: Get package version before or base + run: > + echo "BEFORE_VERSION=$( + cargo metadata --format-version=1 --no-deps | + jq -r '.packages[] | select(.name == "kalatori") | .version' + )" >> $GITHUB_ENV + + - name: Checkout sources + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 50 + submodules: 'recursive' + + - name: Get package version + run: > + echo "VERSION=$( + cargo metadata --format-version=1 --no-deps | + jq -r '.packages[] | select(.name == "kalatori") | .version' + )" >> $GITHUB_ENV + + - name: Check which version is greater + run: echo "GREATER_VER=$(./vergt.sh $VERSION $BEFORE_VERSION)" >> $GITHUB_ENV + + - name: Fail if current version is not greater + run: exit 1 + if: ${{ env.GREATER_VER != 1 }} + + cargo-build: + name: Cargo build + needs: version + if: github.event_name == 'push' + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout sources + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 50 + submodules: 'recursive' + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + + - name: cargo build + run: cargo build --release + + - name: Get package version + run: > + echo "VERSION=$( + cargo metadata --format-version=1 --no-deps | + jq -r '.packages[] | select(.name == "kalatori") | .version' + )" >> $GITHUB_ENV + - name: Draft release binary + run: gh release create -d $VERSION ./target/release/kalatori --generate-notes diff --git a/vergt.sh b/vergt.sh new file mode 100755 index 0000000..31ad55b --- /dev/null +++ b/vergt.sh @@ -0,0 +1,34 @@ +#!/bin/bash +IFS=. +ver1=($1) +ver2=($2) +# starting from minor of ver1 if ver1 shorter ver2 +# fill absent fields in ver1 with zeros +for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) +do + ver1[i]=0 +done +# starting from major of ver1 +for ((i=0; i<${#ver1[@]}; i++)) +do + if [[ -z ${ver2[i]} ]] + then + # if ver2 shorter ver1 then + # fill absent fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})) + then + # if ver1 greater than ver2 in most major differing field + echo 1 + exit + fi + if ((10#${ver1[i]} < 10#${ver2[i]})) + then + # if ver2 greater than ver1 in most major differing field + echo 2 + exit + fi +done +echo 0 +exit \ No newline at end of file From ec7734db0f00fb0dffbab3c886bf9b64d73c2f4c Mon Sep 17 00:00:00 2001 From: Nyoxis Date: Wed, 6 Mar 2024 21:37:40 +0200 Subject: [PATCH 4/5] ci: Added build and draft release job Added package version bump check --- .github/workflows/rust-check-version.yml | 6 +---- is_version_greater.sh | 31 +++++++++++++++++++++ vergt.sh | 34 ------------------------ 3 files changed, 32 insertions(+), 39 deletions(-) create mode 100755 is_version_greater.sh delete mode 100755 vergt.sh diff --git a/.github/workflows/rust-check-version.yml b/.github/workflows/rust-check-version.yml index 046d795..c1f6041 100644 --- a/.github/workflows/rust-check-version.yml +++ b/.github/workflows/rust-check-version.yml @@ -63,11 +63,7 @@ jobs: )" >> $GITHUB_ENV - name: Check which version is greater - run: echo "GREATER_VER=$(./vergt.sh $VERSION $BEFORE_VERSION)" >> $GITHUB_ENV - - - name: Fail if current version is not greater - run: exit 1 - if: ${{ env.GREATER_VER != 1 }} + run: ./is_version_greater.sh $VERSION $BEFORE_VERSION cargo-build: name: Cargo build diff --git a/is_version_greater.sh b/is_version_greater.sh new file mode 100755 index 0000000..c0f2f02 --- /dev/null +++ b/is_version_greater.sh @@ -0,0 +1,31 @@ +#!/bin/bash +IFS=. +version=($1) +before_version=($2) +# starting from minor of version if version shorter before_version +# fill absent fields in version with zeros +for ((i=${#version[@]}; i<${#before_version[@]}; i++)) +do + version[i]=0 +done +# starting from major of version +for ((i=0; i<${#version[@]}; i++)) +do + if [[ -z ${before_version[i]} ]] + then + # if before_version shorter version then + # fill absent fields in before_version with zeros + ver2[i]=0 + fi + if ((10#${version[i]} > 10#${before_version[i]})) + then + # if version greater than before_version in most major differing field + exit 0 + fi + if ((10#${version[i]} < 10#${before_version[i]})) + then + # if version is not greater in most major differing field + exit 1 + fi +done +exit 1 \ No newline at end of file diff --git a/vergt.sh b/vergt.sh deleted file mode 100755 index 31ad55b..0000000 --- a/vergt.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -IFS=. -ver1=($1) -ver2=($2) -# starting from minor of ver1 if ver1 shorter ver2 -# fill absent fields in ver1 with zeros -for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)) -do - ver1[i]=0 -done -# starting from major of ver1 -for ((i=0; i<${#ver1[@]}; i++)) -do - if [[ -z ${ver2[i]} ]] - then - # if ver2 shorter ver1 then - # fill absent fields in ver2 with zeros - ver2[i]=0 - fi - if ((10#${ver1[i]} > 10#${ver2[i]})) - then - # if ver1 greater than ver2 in most major differing field - echo 1 - exit - fi - if ((10#${ver1[i]} < 10#${ver2[i]})) - then - # if ver2 greater than ver1 in most major differing field - echo 2 - exit - fi -done -echo 0 -exit \ No newline at end of file From 3e4d558c9964df3398e022076a871135e6635698 Mon Sep 17 00:00:00 2001 From: Nyoxis Date: Wed, 6 Mar 2024 23:10:22 +0200 Subject: [PATCH 5/5] ci: version check and build for release workflows divided --- .github/workflows/rust-cargo-build.yml | 48 +++++++++++++++++++++++ .github/workflows/rust-check-version.yml | 49 +++--------------------- 2 files changed, 54 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/rust-cargo-build.yml diff --git a/.github/workflows/rust-cargo-build.yml b/.github/workflows/rust-cargo-build.yml new file mode 100644 index 0000000..0f5f5f6 --- /dev/null +++ b/.github/workflows/rust-cargo-build.yml @@ -0,0 +1,48 @@ +name: Rust cargo build and draft release + +on: + push: + branches: + - main + +jobs: + cargo-build: + name: Cargo build + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Checkout sources + uses: actions/checkout@v4.1.1 + with: + fetch-depth: 50 + submodules: 'recursive' + + - name: Install Rust stable toolchain + uses: actions-rs/toolchain@v1.0.7 + with: + profile: minimal + toolchain: stable + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v2.7.3 + + - name: cargo build + run: cargo build --release + + - name: Get package version + run: > + echo "VERSION=$( + cargo metadata --format-version=1 --no-deps | + jq -r '.packages[] | select(.name == "kalatori") | .version' + )" >> $GITHUB_ENV + + - name: Draft release binary + run: gh release create -d $VERSION ./target/release/kalatori --generate-notes \ No newline at end of file diff --git a/.github/workflows/rust-check-version.yml b/.github/workflows/rust-check-version.yml index c1f6041..aad5a7b 100644 --- a/.github/workflows/rust-check-version.yml +++ b/.github/workflows/rust-check-version.yml @@ -1,8 +1,11 @@ -name: Rust check version and build +name: Rust check version on: pull_request: - push: + types: + - opened + - edited + - synchronize branches: - main @@ -11,7 +14,7 @@ jobs: name: Check version runs-on: ubuntu-latest env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Cancel Previous Runs @@ -65,44 +68,4 @@ jobs: - name: Check which version is greater run: ./is_version_greater.sh $VERSION $BEFORE_VERSION - cargo-build: - name: Cargo build - needs: version - if: github.event_name == 'push' - runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: Checkout sources - uses: actions/checkout@v4.1.1 - with: - fetch-depth: 50 - submodules: 'recursive' - - name: Install Rust stable toolchain - uses: actions-rs/toolchain@v1.0.7 - with: - profile: minimal - toolchain: stable - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.3 - - - name: cargo build - run: cargo build --release - - - name: Get package version - run: > - echo "VERSION=$( - cargo metadata --format-version=1 --no-deps | - jq -r '.packages[] | select(.name == "kalatori") | .version' - )" >> $GITHUB_ENV - - name: Draft release binary - run: gh release create -d $VERSION ./target/release/kalatori --generate-notes