From b68d3c95556405678a8da6faaa54605c5a0ffa32 Mon Sep 17 00:00:00 2001 From: Valentin Radu Date: Fri, 5 Nov 2021 04:46:14 +0200 Subject: [PATCH] Automatic build infrastructure --- .github/workflows/build.yml | 88 +++++++++- CHANGELOG.md | 1 + ExplorerPatcher.sln | 19 +- ExplorerPatcher/ExplorerPatcher.rc | 8 +- .../ep_generate_release_description.c | 70 ++++++++ .../ep_generate_release_description.vcxproj | 166 ++++++++++++++++++ ...nerate_release_description.vcxproj.filters | 41 +++++ .../ep_generate_release_name.c | 17 ++ .../ep_generate_release_name.vcxproj | 161 +++++++++++++++++ .../ep_generate_release_name.vcxproj.filters | 32 ++++ 10 files changed, 596 insertions(+), 7 deletions(-) create mode 100644 ep_generate_release_description/ep_generate_release_description.c create mode 100644 ep_generate_release_description/ep_generate_release_description.vcxproj create mode 100644 ep_generate_release_description/ep_generate_release_description.vcxproj.filters create mode 100644 ep_generate_release_name/ep_generate_release_name.c create mode 100644 ep_generate_release_name/ep_generate_release_name.vcxproj create mode 100644 ep_generate_release_name/ep_generate_release_name.vcxproj.filters diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 66fc78b..c60dcd8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,15 @@ +# references: +# https://trstringer.com/github-actions-multiline-strings/ +# https://trstringer.com/github-actions-create-release-upload-artifacts/ +# https://github.com/Speedy37/sws/blob/444c67157a98652c4e7ffd3b6d6bbfb664071926/.github/workflows/msbuild.yml +# https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action + name: Build -on: [push] +on: + push: + branches: + - master env: SOLUTION_FILE_PATH: . @@ -19,6 +28,13 @@ jobs: - name: Add MSBuild to PATH uses: microsoft/setup-msbuild@v1.0.2 + - name: Declare some variables + id: vars + shell: bash + run: | + echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + - name: Create funchook build directory shell: powershell working-directory: libs/funchook @@ -42,11 +58,79 @@ jobs: working-directory: libs/funchook/build run: | cmake --build . --config Release + - name: Build EP IA-32 working-directory: ${{env.GITHUB_WORKSPACE}} run: | msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=IA-32 ${{env.SOLUTION_FILE_PATH}} + - name: Build EP amd64 working-directory: ${{env.GITHUB_WORKSPACE}} run: | - msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}} \ No newline at end of file + msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}} + + - name: Generate dxgi.dll + shell: powershell + working-directory: build/Release + run: | + Copy-Item ExplorerPatcher.amd64.dll dxgi.dll + + - name: Generate release name + shell: bash + working-directory: build/Release + run: | + echo "::set-output name=data::$(./ep_generate_release_name.exe)" + id: release_name + + - name: Generate release notes + shell: bash + working-directory: build/Release + run: | + MY_STRING=$(./ep_generate_release_description.exe ${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.branch }}) + MY_STRING="${MY_STRING//'%'/'%25'}" + MY_STRING="${MY_STRING//$'\n'/'%0A'}" + MY_STRING="${MY_STRING//$'\r'/'%0D'}" + echo "::set-output name=data::$MY_STRING" + id: release_description + + - name: Create/update release + uses: actions/create-release@v1 + id: create_release + with: + draft: false + prerelease: false + release_name: ${{ steps.release_name.outputs.data }} + tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }} + body: ${{ steps.release_description.outputs.data }} + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + + - name: Upload dxgi.dll + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/Release/dxgi.dll + asset_name: dxgi.dll + asset_content_type: application/x-msdownload + + - name: Upload ExplorerPatcher.amd64.dll + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/Release/ExplorerPatcher.amd64.dll + asset_name: ExplorerPatcher.amd64.dll + asset_content_type: application/x-msdownload + + - name: Upload ExplorerPatcher.IA-32.dll + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build/Release/ExplorerPatcher.IA-32.dll + asset_name: ExplorerPatcher.IA-32.dll + asset_content_type: application/x-msdownload \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 566d50e..3387263 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Tested on build 22000.282. * `[Enter]` switches to selected window (same as `[Space]`) (#240) (.1) * Navigation using arrow keys (#240) (.1) * Ability to choose behavior for Cortana button: hidden, shown and opens Cortana, shown and opens Widgets (#255) (.3) +* Builds are now automatic, generated as soon as new content is pushed to the repository and compiled on GitHub's infrastructure (.6) #### Feature enhancements * Clock context menu options "Adjust date/time" and "Customize notification icons" open in Control Panel instead of Settings diff --git a/ExplorerPatcher.sln b/ExplorerPatcher.sln index 0d68aa7..a7903ed 100644 --- a/ExplorerPatcher.sln +++ b/ExplorerPatcher.sln @@ -5,6 +5,10 @@ VisualStudioVersion = 16.0.30002.166 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ExplorerPatcher", "ExplorerPatcher\ExplorerPatcher.vcxproj", "{DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_generate_release_description", "ep_generate_release_description\ep_generate_release_description.vcxproj", "{C362CFBE-7C6B-4457-8D01-839818D42ECB}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ep_generate_release_name", "ep_generate_release_name\ep_generate_release_name.vcxproj", "{78D0C3CF-25C0-41D4-9359-0E9AB72B9874}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|amd64 = Debug|amd64 @@ -15,11 +19,24 @@ Global GlobalSection(ProjectConfigurationPlatforms) = postSolution {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|amd64.ActiveCfg = Debug|x64 {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|amd64.Build.0 = Debug|x64 - {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|IA-32.ActiveCfg = Debug|x64 + {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|IA-32.ActiveCfg = Debug|Win32 + {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Debug|IA-32.Build.0 = Debug|Win32 {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|amd64.ActiveCfg = Release|x64 {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|amd64.Build.0 = Release|x64 {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|IA-32.ActiveCfg = Release|Win32 {DB3E4319-2969-42B6-B7E8-BB57AA8C9FA9}.Release|IA-32.Build.0 = Release|Win32 + {C362CFBE-7C6B-4457-8D01-839818D42ECB}.Debug|amd64.ActiveCfg = Debug|x64 + {C362CFBE-7C6B-4457-8D01-839818D42ECB}.Debug|amd64.Build.0 = Debug|x64 + {C362CFBE-7C6B-4457-8D01-839818D42ECB}.Debug|IA-32.ActiveCfg = Debug|Win32 + {C362CFBE-7C6B-4457-8D01-839818D42ECB}.Release|amd64.ActiveCfg = Release|x64 + {C362CFBE-7C6B-4457-8D01-839818D42ECB}.Release|amd64.Build.0 = Release|x64 + {C362CFBE-7C6B-4457-8D01-839818D42ECB}.Release|IA-32.ActiveCfg = Release|Win32 + {78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Debug|amd64.ActiveCfg = Debug|x64 + {78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Debug|amd64.Build.0 = Debug|x64 + {78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Debug|IA-32.ActiveCfg = Debug|Win32 + {78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Release|amd64.ActiveCfg = Release|x64 + {78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Release|amd64.Build.0 = Release|x64 + {78D0C3CF-25C0-41D4-9359-0E9AB72B9874}.Release|IA-32.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ExplorerPatcher/ExplorerPatcher.rc b/ExplorerPatcher/ExplorerPatcher.rc index 7ac0487..f7bdfa5 100644 --- a/ExplorerPatcher/ExplorerPatcher.rc +++ b/ExplorerPatcher/ExplorerPatcher.rc @@ -51,8 +51,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 22000,282,32,5 - PRODUCTVERSION 22000,282,32,5 + FILEVERSION 22000,282,32,6 + PRODUCTVERSION 22000,282,32,6 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,12 +69,12 @@ BEGIN BEGIN VALUE "CompanyName", "VALINET Solutions SRL" VALUE "FileDescription", "ExplorerPatcher" - VALUE "FileVersion", "22000.282.32.5" + VALUE "FileVersion", "22000.282.32.6" VALUE "InternalName", "ExplorerPatcher.dll" VALUE "LegalCopyright", "Copyright (C) 2006-2021 VALINET Solutions SRL. All rights reserved." VALUE "OriginalFilename", "ExplorerPatcher.dll" VALUE "ProductName", "ExplorerPatcher" - VALUE "ProductVersion", "22000.282.32.5" + VALUE "ProductVersion", "22000.282.32.6" END END BLOCK "VarFileInfo" diff --git a/ep_generate_release_description/ep_generate_release_description.c b/ep_generate_release_description/ep_generate_release_description.c new file mode 100644 index 0000000..db677d4 --- /dev/null +++ b/ep_generate_release_description/ep_generate_release_description.c @@ -0,0 +1,70 @@ +#include +#include +#include "../ExplorerPatcher/queryversion.h" +#define FILE_NAME "CHANGELOG.md" +#define MAX_LINE_LENGTH 200000 + +int main(int argc, char** argv) +{ + SetConsoleOutputCP(CP_UTF8); + + char szStartPattern[MAX_PATH]; + char szEndPattern[MAX_PATH]; + + DWORD dwLeftMost = 0; + DWORD dwSecondLeft = 0; + DWORD dwSecondRight = 0; + DWORD dwRightMost = 0; + + QueryVersionInfo(GetModuleHandle(NULL), VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost); + + sprintf_s(szStartPattern, MAX_PATH, "## %d.%d.%d\n", dwLeftMost, dwSecondLeft, dwSecondRight); + sprintf_s(szEndPattern, MAX_PATH, "## "); + + FILE* f = NULL; + fopen_s(&f, "..\\..\\" FILE_NAME, "r"); + if (!f) + { + fopen_s(&f, "..\\" FILE_NAME, "r"); + if (!f) + { + fopen_s(&f, "" FILE_NAME, "r"); + } + } + if (f) + { + int state = 0; + size_t bufsiz = MAX_LINE_LENGTH, numChRd = 0; + char* line = malloc(MAX_LINE_LENGTH * sizeof(char)); + while ((numChRd = getline(&line, &bufsiz, f)) != -1) + { + if (state == 0 && !strcmp(line, szStartPattern)) + { + state = 1; + numChRd = getline(&line, &bufsiz, f); + continue; + } + else if (state == 1 && !strncmp(line, szEndPattern, strlen(szEndPattern))) + { + state = 2; + } + if (state == 1) + { + printf("%s", line); + } + } + free(line); + printf( + "Please consult the [README](https://github.com/valinet/ExplorerPatcher/blob/master/README.md) for more details.\n" + "A detailed change log is available [here](https://github.com/valinet/ExplorerPatcher/blob/master/CHANGELOG.md).\n\n" + "*This release has been published automatically from %s %s in branch [%s](https://github.com/valinet/ExplorerPatcher/tree/%s/).*", + argc == 3 ? "commits up to and including" : "the latest commits", + argc == 3 ? argv[1] : "", + argc == 3 ? argv[2] : "master", + argc == 3 ? argv[2] : "master" + ); + fclose(f); + } + + return 0; +} \ No newline at end of file diff --git a/ep_generate_release_description/ep_generate_release_description.vcxproj b/ep_generate_release_description/ep_generate_release_description.vcxproj new file mode 100644 index 0000000..5ffa01d --- /dev/null +++ b/ep_generate_release_description/ep_generate_release_description.vcxproj @@ -0,0 +1,166 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {c362cfbe-7c6b-4457-8d01-839818d42ecb} + epgeneratereleasedescription + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)\build\$(Configuration) + + + false + $(SolutionDir)\build\$(Configuration) + + + true + $(SolutionDir)\build\$(Configuration) + + + false + $(SolutionDir)\build\$(Configuration) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDebug + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDebug + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ep_generate_release_description/ep_generate_release_description.vcxproj.filters b/ep_generate_release_description/ep_generate_release_description.vcxproj.filters new file mode 100644 index 0000000..43b78f3 --- /dev/null +++ b/ep_generate_release_description/ep_generate_release_description.vcxproj.filters @@ -0,0 +1,41 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + + + Resource Files + + + + + + \ No newline at end of file diff --git a/ep_generate_release_name/ep_generate_release_name.c b/ep_generate_release_name/ep_generate_release_name.c new file mode 100644 index 0000000..65a8b39 --- /dev/null +++ b/ep_generate_release_name/ep_generate_release_name.c @@ -0,0 +1,17 @@ +#include "../ExplorerPatcher/queryversion.h" + +int main(int argc, char** argv) +{ + SetConsoleOutputCP(CP_UTF8); + + DWORD dwLeftMost = 0; + DWORD dwSecondLeft = 0; + DWORD dwSecondRight = 0; + DWORD dwRightMost = 0; + + QueryVersionInfo(GetModuleHandle(NULL), VS_VERSION_INFO, &dwLeftMost, &dwSecondLeft, &dwSecondRight, &dwRightMost); + + printf("%d.%d.%d.%d", dwLeftMost, dwSecondLeft, dwSecondRight, dwRightMost); + + return 0; +} \ No newline at end of file diff --git a/ep_generate_release_name/ep_generate_release_name.vcxproj b/ep_generate_release_name/ep_generate_release_name.vcxproj new file mode 100644 index 0000000..58a70f6 --- /dev/null +++ b/ep_generate_release_name/ep_generate_release_name.vcxproj @@ -0,0 +1,161 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {78d0c3cf-25c0-41d4-9359-0e9ab72b9874} + epqueryversion + 10.0 + + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + Application + true + v142 + Unicode + + + Application + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)\build\$(Configuration) + + + false + $(SolutionDir)\build\$(Configuration) + + + true + $(SolutionDir)\build\$(Configuration) + + + false + $(SolutionDir)\build\$(Configuration) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDebug + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreadedDebug + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + MultiThreaded + + + Console + true + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ep_generate_release_name/ep_generate_release_name.vcxproj.filters b/ep_generate_release_name/ep_generate_release_name.vcxproj.filters new file mode 100644 index 0000000..5973f4e --- /dev/null +++ b/ep_generate_release_name/ep_generate_release_name.vcxproj.filters @@ -0,0 +1,32 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + + + Resource Files + + + \ No newline at end of file