Skip to content

Commit

Permalink
Version 1.2.3
Browse files Browse the repository at this point in the history
Version 1.2.3
  • Loading branch information
haorldbchi authored Nov 11, 2021
2 parents 19f9fbf + ba22628 commit 1c95800
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 15 deletions.
31 changes: 19 additions & 12 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build Release Assets
on:
push:
branches: [master]
branches: [master, develop]
workflow_dispatch:

jobs:
Expand All @@ -10,8 +10,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: master
# with:
# ref: master

- name: Get Version Number
id: version_number
Expand All @@ -30,7 +30,7 @@ jobs:
# TODO: Use specific GCC version
gcc --version
mkdir build && cd build
cmake ..
cmake --build . --target bladebit --config Release -j $(nproc --all)
Expand All @@ -54,8 +54,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: master
# with:
# ref: master

- name: Get Version Number
id: version_number
Expand Down Expand Up @@ -102,8 +102,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: master
# with:
# ref: master

- name: Get Version Number
id: version_number
Expand Down Expand Up @@ -145,8 +145,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: master
# with:
# ref: master

- name: Get Version Number
id: version_number
Expand Down Expand Up @@ -188,8 +188,8 @@ jobs:
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: master
# with:
# ref: master

- name: Get Version Number
shell: bash
Expand All @@ -205,8 +205,15 @@ jobs:
env:
BB_ARTIFACT_NAME: ${{ steps.version_number.outputs.BB_ARTIFACT_NAME }}
run: |
mkdir build && cd build
cmake ..
# We're having problems in windows with Version.h generation,
# so lets just call it manually
bash -e ../extract-version.sh
cat ../src/Version.h
cmake --build . --target bladebit --config Release
mkdir ../bin
Expand Down
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ message("Config: ${CMAKE_BUILD_TYPE}")

project(bladebit)

# On CI, update Version.h from our VERSION file
if(DEFINED ENV{CI})
message("Updating Version.h")
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
execute_process(COMMAND bash.exe extract-version.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
else()
execute_process(COMMAND bash extract-version.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
endif()



set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
Expand Down Expand Up @@ -133,7 +144,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
else()

# *Nix
set(c_opts --include=pch.h -march=native -Wall -Wno-comment -Wno-unknown-pragmas -g ${c_opts})
set(c_opts --include=pch.h -Wall -Wno-comment -Wno-unknown-pragmas -g ${c_opts})

set(release_c_opts
-O3 -flto
Expand Down
23 changes: 23 additions & 0 deletions extract-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /usr/bin/env bash
set -e
set -o pipefail
_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
cd $_dir

set IFS=

version_str=$(cat VERSION | xargs)
version_header='src/Version.h'

ver_maj=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/' | xargs)
ver_min=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/' | xargs)
ver_rev=$(printf $version_str | sed -E -r 's/([0-9]+)\.([0-9]+)\.([0-9]+)/\3/' | xargs)

git_commit=$(git rev-parse HEAD)
echo "Version: $ver_maj.$ver_min.$ver_rev-$git_commit"

sed -i -E -r "s/(#define BLADEBIT_VERSION_MAJ )([0-9]+)/\1$ver_maj/g" $version_header
sed -i -E -r "s/(#define BLADEBIT_VERSION_MIN )([0-9]+)/\1$ver_min/g" $version_header
sed -i -E -r "s/(#define BLADEBIT_VERSION_REV )([0-9]+)/\1$ver_rev/g" $version_header
sed -i -E -r "s/(#define BLADEBIT_GIT_COMMIT )(.+)/\1\"$git_commit\"/g" $version_header

2 changes: 2 additions & 0 deletions src/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#define BLADEBIT_VERSION_MIN 2
#define BLADEBIT_VERSION_REV 0

#define BLADEBIT_GIT_COMMIT "dev"

#define BLADEBIT_VERSION \
((uint64)BLADEBIT_VERSION_MAJ) << 32 \
((uint64)BLADEBIT_VERSION_MIN) << 16 \
Expand Down
6 changes: 4 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,10 @@ inline std::vector<uint8_t> BytesConcat( std::vector<uint8_t> a, std::vector<uin
//-----------------------------------------------------------
void PrintUsage()
{
fputs( USAGE, stderr );
fflush( stderr );
Log::Line( "bladebit v%s-%s\n", BLADEBIT_VERSION_STR, BLADEBIT_GIT_COMMIT );
Log::Line( "Usage:" );
fputs( USAGE, stdout );
fflush( stdout );
}

#if _DEBUG
Expand Down

0 comments on commit 1c95800

Please sign in to comment.