Skip to content

Commit

Permalink
Version bump to 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kobalicek committed Mar 28, 2024
1 parent 1e5f140 commit 7561c3a
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 9 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ $ ./configure.sh -DMINIO_CPP_TEST=ON
## Example:: file-uploader.cc

```c++
#include <client.h>
#include <miniocpp/client.h>

int main(int argc, char* argv[]) {
// Create S3 base URL.
Expand Down
70 changes: 70 additions & 0 deletions check-version.py
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 2 additions & 2 deletions include/miniocpp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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( \
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 7561c3a

Please sign in to comment.