diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml new file mode 100644 index 0000000..19ad6c2 --- /dev/null +++ b/.github/workflows/check-version.yml @@ -0,0 +1,32 @@ +on: + pull_request: + branches: + - dev + - master + +name: Check Version + +jobs: + all: + runs-on: ubuntu-latest + + name: Check Version + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Check version format and availability + run: | + cpp_version=$(sed -n 's/^#define\s\+INDIVIDUAL_VERSION\s\+"\(.*\)"/\1/p' inst/include/individual_version.h) + r_version=$(sed -n 's/^Version: \(.*\)/\1/p' DESCRIPTION) + echo "Version found in individual_version.h: $cpp_version" + echo "Version found in DESCRIPTION: $r_version" + if [[ $cpp_version != $r_version ]]; then + echo "Versions do not match, exiting" + exit 1 + fi diff --git a/inst/include/individual_types.h b/inst/include/individual_types.h index 8d4a925..e8ecbbb 100644 --- a/inst/include/individual_types.h +++ b/inst/include/individual_types.h @@ -16,5 +16,6 @@ #include "RaggedDouble.h" #include "Event.h" #include "RenderVector.h" +#include "individual_version.h" #endif /* INDIVIDUAL_TYPES_H_ */ diff --git a/inst/include/individual_version.h b/inst/include/individual_version.h new file mode 100644 index 0000000..eaf7ea6 --- /dev/null +++ b/inst/include/individual_version.h @@ -0,0 +1,6 @@ +#ifndef INDIVIDUAL_VERSION_H_ +#define INDIVIDUAL_VERSION_H_ + +#define INDIVIDUAL_VERSION "0.1.17" + +#endif