From 53296d2cbb6816f5d881a9656138cdd71b3b3e40 Mon Sep 17 00:00:00 2001 From: Pando85 Date: Mon, 11 May 2020 14:16:09 +0200 Subject: [PATCH] CI update all kanidm component version and tag Add make entry to have all cargo versions updated from VERSION file. Add `tag_version` github action to update all cargo.toml and tag it and push it. Remove cargo fmt check from CI because we have problems with different versions and fails continually. Instead, we use cargo-husky to ensure that all people run it automatically in its local, but this is not obligatory. Remove all versions between dependencies in internal packages. In future cargo will support managing all dependencies from main Cargo.toml. Ref: https://github.com/rust-lang/cargo/issues/3931 Resolve #225 --- .github/workflows/rust.yml | 18 ++-------------- .github/workflows/tag_version.yml | 36 +++++++++++++++++++++++++++++++ Cargo.lock | 7 ++++++ Makefile | 5 +++++ VERSION | 1 + kanidm_client/Cargo.toml | 4 ++-- kanidm_tools/Cargo.toml | 4 ++-- kanidm_unix_int/Cargo.toml | 6 +++--- kanidmd/Cargo.toml | 6 +++++- 9 files changed, 63 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/tag_version.yml create mode 100644 VERSION diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ce79946672..702e8ab9fc 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -4,22 +4,8 @@ name: Rust on: [push, pull_request] jobs: - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - override: true - components: rustfmt - - - name: Run cargo fmt - run: cargo fmt --all -- --check + # TODO clippy + build: runs-on: ubuntu-latest diff --git a/.github/workflows/tag_version.yml b/.github/workflows/tag_version.yml new file mode 100644 index 0000000000..ffdffb4252 --- /dev/null +++ b/.github/workflows/tag_version.yml @@ -0,0 +1,36 @@ +name: tag and version + +on: + push: + branches: + - master + +jobs: + update-version: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Commit files + id: commit + run: | + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + if git diff --exit-code $(git describe --tags --abbrev=0 HEAD)..HEAD -- VERSION; + then exit 0; + fi + make update-version + git add . + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + VERSION=$(cat VERSION) + git commit -m "v${VERSION}" + git tag "v${VERSION}" + echo ::set-output name=PUSH::true + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tags: true + if: ${{ steps.commit.outputs.PUSH }} diff --git a/Cargo.lock b/Cargo.lock index 643b8c90a0..d7ab62176f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -552,6 +552,11 @@ dependencies = [ "bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cargo-husky" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cast" version = "0.2.3" @@ -1371,6 +1376,7 @@ dependencies = [ "actix-session 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "actix-web 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo-husky 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "concread 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cookie 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3132,6 +3138,7 @@ dependencies = [ "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum bytes 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1" "checksum bytestring 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fc7c05fa5172da78a62d9949d662d2ac89d4cc7355d7b49adee5163f1fb3f363" +"checksum cargo-husky 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b02b629252fe8ef6460461409564e2c21d0c8e77e0944f3d189ff06c4e932ad" "checksum cast 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0" "checksum cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)" = "c3d87b23d6a92cd03af510a5ade527033f6aa6fa92161e2d5863a907d4c5e31d" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" diff --git a/Makefile b/Makefile index 10a0f0369d..458fbe07fc 100644 --- a/Makefile +++ b/Makefile @@ -49,3 +49,8 @@ install-tools: prep: cargo outdated -R cargo audit + +update-version: ## update version form VERSION file in all Cargo.toml manifests +update-version: */Cargo.toml + @VERSION=`cat VERSION`; sed -i "0,/^version\ \= .*$$/{s//version = \"$$VERSION\"/}" */Cargo.toml + @echo updated to version "`cat VERSION`" cargo files diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000..950f8ca20e --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0-rc10 diff --git a/kanidm_client/Cargo.toml b/kanidm_client/Cargo.toml index 4c56d68312..03bc622f27 100644 --- a/kanidm_client/Cargo.toml +++ b/kanidm_client/Cargo.toml @@ -13,7 +13,7 @@ repository = "https://github.com/kanidm/kanidm/" log = "0.4" env_logger = "0.7" reqwest = { version = "0.10", features=["blocking", "cookies", "json", "native-tls"] } -kanidm_proto = { path = "../kanidm_proto", version = "0.1" } +kanidm_proto = { path = "../kanidm_proto" } serde = "1.0" serde_json = "1.0" serde_derive = "1.0" @@ -23,5 +23,5 @@ uuid = { version = "0.8", features = ["serde", "v4"] } [dev-dependencies] tokio = "0.2" actix = "0.9" -kanidm = { path = "../kanidmd", version = "0.1" } +kanidm = { path = "../kanidmd" } futures = "0.3" diff --git a/kanidm_tools/Cargo.toml b/kanidm_tools/Cargo.toml index 345c706cd5..54822a752b 100644 --- a/kanidm_tools/Cargo.toml +++ b/kanidm_tools/Cargo.toml @@ -27,8 +27,8 @@ name = "kanidm_badlist_preprocess" path = "src/badlist_preprocess.rs" [dependencies] -kanidm_client = { path = "../kanidm_client", version = "0.1" } -kanidm_proto = { path = "../kanidm_proto", version = "0.1" } +kanidm_client = { path = "../kanidm_client" } +kanidm_proto = { path = "../kanidm_proto" } rpassword = "4.0" structopt = { version = "0.3", default-features = false } log = "0.4" diff --git a/kanidm_unix_int/Cargo.toml b/kanidm_unix_int/Cargo.toml index 8d7ce9e898..7d1d6603a6 100644 --- a/kanidm_unix_int/Cargo.toml +++ b/kanidm_unix_int/Cargo.toml @@ -40,8 +40,8 @@ name = "kanidm_test_auth" path = "src/test_auth.rs" [dependencies] -kanidm_client = { path = "../kanidm_client", version = "0.1" } -kanidm_proto = { path = "../kanidm_proto", version = "0.1" } +kanidm_client = { path = "../kanidm_client" } +kanidm_proto = { path = "../kanidm_proto" } kanidm = { path = "../kanidmd" } toml = "0.5" rpassword = "4.0" @@ -69,5 +69,5 @@ reqwest = { version = "0.10" } default = [ "libsqlite3-sys/bundled" ] [dev-dependencies] -kanidm = { path = "../kanidmd", version = "0.1" } +kanidm = { path = "../kanidmd" } actix = "0.9" diff --git a/kanidmd/Cargo.toml b/kanidmd/Cargo.toml index e0a41b0285..53e04e5f16 100644 --- a/kanidmd/Cargo.toml +++ b/kanidmd/Cargo.toml @@ -26,7 +26,7 @@ path = "src/server/main.rs" [dependencies] -kanidm_proto = { path = "../kanidm_proto", version = "0.1" } +kanidm_proto = { path = "../kanidm_proto" } actix = "0.9" actix-web = { version = "2.0", features = ["openssl"] } @@ -79,3 +79,7 @@ default = [ "libsqlite3-sys/bundled", "openssl/vendored" ] [dev-dependencies] criterion = "0.3" +[dev-dependencies.cargo-husky] +version = "1" +default-features = false # Disable features which are enabled by default +features = ["precommit-hook", "run-cargo-fmt"]