Skip to content

Commit

Permalink
- Update version
Browse files Browse the repository at this point in the history
- Update vcpkg
- Add version string to CMakeLists.txt
- Init workflow
  • Loading branch information
ParticleG committed Aug 4, 2024
1 parent 6098811 commit 818532e
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 20 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Studio26F Main CI

permissions: write-all

on:
push:
branches: [ ci-*, main ]
tags: [ pre*, v* ]
pull_request:
branches: [ main ]

jobs:
get-info:
runs-on: ubuntu-latest
outputs:
commitHash: ${{ steps.git-info.outputs.commitHash }}
steps:
- uses: actions/checkout@v4
- name: Get git info
id: git-info
shell: bash
run: |
COMMIT_HASH=$(git rev-parse --short ${{ GITHUB.SHA }})
echo "commitHash=$COMMIT_HASH" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: get-info
env:
OUTPUT_FOLDER: ./build
RELEASE_FOLDER: ./release
strategy:
matrix:
config: [ Debug, Release ]
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: CMake Configure and Build
run: |
cmake -S "${{ github.workspace }}" -B "${{ github.workspace }}/${{ env.OUTPUT_FOLDER }}"
cmake --build "${{ github.workspace }}/${{ env.OUTPUT_FOLDER }}" --target Studio26F --config ${{ matrix.config }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Studio26F_${{ needs.get-info.outputs.commitHash }}_${{ GITHUB.RUN_NUMBER }}_${{ matrix.config }}
path: "${{ env.OUTPUT_FOLDER }}/${{ matrix.config }}"
- name: Prepare for release
if: ${{ (startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v')) && matrix.config == 'release'}}
shell: bash
run: |
mkdir -p ${{ env.RELEASE_FOLDER }}
cp ${{ env.OUTPUT_FOLDER }}/${{ matrix.config }}/Studio26F ${{ env.RELEASE_FOLDER }}
- name: Upload release
if: ${{ (startsWith(github.ref, 'refs/tags/pre') || startsWith(github.ref, 'refs/tags/v')) && matrix.config == 'release'}}
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: |
${{ env.RELEASE_FOLDER }}/*
prerelease: ${{ startsWith(github.ref, 'refs/tags/pre') }}
7 changes: 0 additions & 7 deletions .run/Studio26F.run.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .run/Studio26F_test.run.xml

This file was deleted.

11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.26)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file")

message(STATUS "C++ standard set to ${CMAKE_CXX_STANDARD}")
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg.json VCPKG_JSON)
string(JSON VERSION_STRING GET ${VCPKG_JSON} version-string)
message(STATUS "Project version: ${VERSION_STRING}")

project(Studio26F CXX)

add_compile_definitions(CMAKE_PROJECT_NAME="${PROJECT_NAME}")

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
message(STATUS "Compiler is Clang")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
Expand All @@ -24,6 +24,9 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS NOMINMAX)
endif ()

add_compile_definitions(CMAKE_PROJECT_NAME="${PROJECT_NAME}")
add_compile_definitions(VERSION_STRING="${VERSION_STRING}")

add_executable(${PROJECT_NAME} main.cc types/Products.h)

find_package(cryptopp CONFIG REQUIRED)
Expand Down
1 change: 1 addition & 0 deletions main.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <drogon/drogon.h>

int main() {
LOG_INFO << std::format("{} v{} starting...", CMAKE_PROJECT_NAME, VERSION_STRING);
drogon::app().loadConfigFile("config.json");
drogon::app().run();
return 0;
Expand Down
2 changes: 1 addition & 1 deletion vcpkg
Submodule vcpkg updated 8977 files
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "studio26f",
"version-string": "0.1.0",
"version-string": "1.0.0",
"maintainers": [
"Particle_G <[email protected]>"
],
Expand Down

0 comments on commit 818532e

Please sign in to comment.