From 624c3a00f92d2bfa8f1c0414468245c6ac03c20b Mon Sep 17 00:00:00 2001 From: Maschell Date: Sat, 22 Jul 2023 15:57:30 +0200 Subject: [PATCH] Log the module version on each application start --- .github/workflows/ci.yml | 7 +++++++ .github/workflows/pr.yml | 7 +++++++ src/main.cpp | 4 ++++ src/version.h | 2 ++ 4 files changed, 20 insertions(+) create mode 100644 src/version.h diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e65779f..a0a4e32 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v3 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "$GITHUB_SHA") + cat < ./src/version.h + #pragma once + #define MODULE_VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 1482bd9..f2bc86c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -15,6 +15,13 @@ jobs: needs: clang-format steps: - uses: actions/checkout@v3 + - name: create version.h + run: | + git_hash=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}") + cat < ./src/version.h + #pragma once + #define MODULE_VERSION_EXTRA " (nightly-$git_hash)" + EOF - name: build binary run: | docker build . -t builder diff --git a/src/main.cpp b/src/main.cpp index 20df9cc..58a0d13 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,12 +6,16 @@ extern "C" { } #endif #include "cacert_pem.h" +#include "version.h" #include #include WUMS_MODULE_EXPORT_NAME("homebrew_curlwrapper"); +#define MODULE_VERSION "v0.1" + WUMS_APPLICATION_STARTS() { + OSReport("Running CURLWrapperModule " MODULE_VERSION MODULE_VERSION_EXTRA "\n"); curl_global_init(CURL_GLOBAL_ALL); } diff --git a/src/version.h b/src/version.h new file mode 100644 index 0000000..78433de --- /dev/null +++ b/src/version.h @@ -0,0 +1,2 @@ +#pragma once +#define MODULE_VERSION_EXTRA "" \ No newline at end of file