From 7561c3a30f1287abf8a39ece24a0d232467e36de Mon Sep 17 00:00:00 2001 From: Petr Kobalicek Date: Thu, 28 Mar 2024 12:05:26 +0100 Subject: [PATCH] Version bump to 0.2.0 --- .github/workflows/ci.yml | 21 +++++++++--- CMakeLists.txt | 2 +- README.md | 2 +- check-version.py | 70 +++++++++++++++++++++++++++++++++++++++ include/miniocpp/config.h | 4 +-- vcpkg.json | 2 +- 6 files changed, 92 insertions(+), 9 deletions(-) create mode 100755 check-version.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 229fd1e..b84ebe7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,11 +17,19 @@ permissions: jobs: coding-style: - name: "Coding Style Check" + name: "Coding Style & Version Check" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout minio-cpp + uses: actions/checkout@v4 + with: + path: "minio-cpp" + + - name: "Python" + uses: actions/setup-python@v5 + with: + python-version: "3.x" - name: Install dependencies if Ubuntu run: | @@ -31,10 +39,15 @@ jobs: sudo apt-get -qy install clang-format-18 clang-format-18 --version + - name: Version Check + shell: bash + working-directory: minio-cpp + run: python check-version.py + - name: Coding Style Check shell: bash - run: | - CLANG_FORMAT=clang-format-18 ./check-style.sh + working-directory: minio-cpp + run: CLANG_FORMAT=clang-format-18 ./check-style.sh build: strategy: diff --git a/CMakeLists.txt b/CMakeLists.txt index 4de46ca..604b684 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ cmake_policy(SET CMP0091 NEW) # ----------------- set(MINIO_CPP_MAJOR_VERSION "0") -set(MINIO_CPP_MINOR_VERSION "1") +set(MINIO_CPP_MINOR_VERSION "2") set(MINIO_CPP_PATCH_VERSION "0") set(MINIO_CPP_VERSION_STRING "${MINIO_CPP_MAJOR_VERSION}.${MINIO_CPP_MINOR_VERSION}.${MINIO_CPP_PATCH_VERSION}") diff --git a/README.md b/README.md index 1e4b9d5..fe070a0 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ $ ./configure.sh -DMINIO_CPP_TEST=ON ## Example:: file-uploader.cc ```c++ -#include +#include int main(int argc, char* argv[]) { // Create S3 base URL. diff --git a/check-version.py b/check-version.py new file mode 100755 index 0000000..d987eec --- /dev/null +++ b/check-version.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 + +# MinIO C++ Library for Amazon S3 Compatible Cloud Storage +# Copyright 2022-2024 MinIO, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +import json +import os +import re +import sys + +ROOT_PATH = os.path.abspath(os.path.dirname(os.path.abspath(__file__))) + +def read_text_file(file_name): + with open(file_name, "r", encoding="utf-8") as f: + return f.read() + +def read_vcpkg_version(): + package = json.loads(read_text_file(os.path.join(ROOT_PATH, "vcpkg.json"))) + return package["version"] + +def read_cmake_version(): + content = read_text_file(os.path.join(ROOT_PATH, "CMakeLists.txt")) + + major = re.search("set\\(MINIO_CPP_MAJOR_VERSION \"(\\d+)\"\\)", content) + minor = re.search("set\\(MINIO_CPP_MINOR_VERSION \"(\\d+)\"\\)", content) + patch = re.search("set\\(MINIO_CPP_PATCH_VERSION \"(\\d+)\"\\)", content) + + return "{}.{}.{}".format(major[1], minor[1], patch[1]) + +def read_source_version(): + content = read_text_file(os.path.join(ROOT_PATH, "include", "miniocpp", "config.h")) + + major = re.search("#define MINIO_CPP_MAJOR_VERSION (\\d+)", content) + minor = re.search("#define MINIO_CPP_MINOR_VERSION (\\d+)", content) + patch = re.search("#define MINIO_CPP_PATCH_VERSION (\\d+)", content) + + return "{}.{}.{}".format(major[1], minor[1], patch[1]) + +def main(): + vcpkg_version = read_vcpkg_version() + cmake_version = read_cmake_version() + source_version = read_source_version() + + if source_version == vcpkg_version and source_version == cmake_version: + print("minio-cpp version {} is set correctly in all required files".format(source_version)) + else: + print("Versions don't match [source={} vcpkg={} cmake={}]\n".format(source_version, vcpkg_version, cmake_version)) + print("When increasing a version, please make sure that all of the above have the same value!\n") + print("Versions can be found in the following files:") + print(" * include/miniocpp/config.h") + print(" * CMakeLists.txt") + print(" * vcpkg.json") + sys.exit(1) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/include/miniocpp/config.h b/include/miniocpp/config.h index 6458f94..25bf10b 100644 --- a/include/miniocpp/config.h +++ b/include/miniocpp/config.h @@ -21,8 +21,8 @@ #define MINIO_CPP_STRINGIFY(x) #x #define MINIO_CPP_MAJOR_VERSION 0 -#define MINIO_CPP_MINOR_VERSION 1 -#define MINIO_CPP_PATCH_VERSION 1 +#define MINIO_CPP_MINOR_VERSION 2 +#define MINIO_CPP_PATCH_VERSION 0 #define MINIO_CPP_VERSION \ "" MINIO_CPP_STRINGIFY(MINIO_CPP_MAJOR_VERSION) "." MINIO_CPP_STRINGIFY( \ diff --git a/vcpkg.json b/vcpkg.json index 607cae4..2d79722 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "minio-cpp", - "version": "0.1.1", + "version": "0.2.0", "description": "The MinIO C++ Client SDK provides simple APIs to access any Amazon S3 compatible object storage", "homepage": "https://github.com/minio/minio-cpp", "license": "Apache-2.0",