From c5477ee21c1defb47e7ee03d000d5faac077f330 Mon Sep 17 00:00:00 2001 From: Christian Grasser Date: Sun, 29 Oct 2023 08:04:22 +0100 Subject: [PATCH] Add Github CI build - add first version of GH CI build - fix merge issue for lexilla.mak - fix clang compiler issue: ..\lexers\LexObjC.cxx(50,20): warning : unused function 'IsADigit' [-Wunused-function] [D:\a\notepad-plus-plus\notepad-plus-plus\lexilla\src\Lexilla.vcxproj] - fix functionlist unittest run for github - make functionList unittest compatible with newer powershell 7 Fix #12177, close #14291 --- .github/dependabot.yml | 13 ++ .github/workflows/CI_build.yml | 203 ++++++++++++++++++ .../bash/unitTest.expected.result | 2 +- .../bash/unitTest.expected.result.correct | 1 - PowerEditor/Test/FunctionList/unitTest.ps1 | 14 +- .../Test/FunctionList/unitTestLauncher.ps1 | 12 +- lexilla/lexers/LexObjC.cxx | 4 - lexilla/src/lexilla.mak | 3 + 8 files changed, 233 insertions(+), 19 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/CI_build.yml delete mode 100644 PowerEditor/Test/FunctionList/bash/unitTest.expected.result.correct diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..2d01d71c9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/CI_build.yml b/.github/workflows/CI_build.yml new file mode 100644 index 000000000..84ff0eb5e --- /dev/null +++ b/.github/workflows/CI_build.yml @@ -0,0 +1,203 @@ +name: CI_build + +on: [push, pull_request] + +jobs: + build_windows: + + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_configuration: [Release, Debug] + build_platform: [x64, Win32, ARM64] + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: MSBuild of n++ exe + working-directory: PowerEditor\visual.net\ + run: msbuild notepadPlus.sln /m /p:configuration="${{ matrix.build_configuration }}" /p:platform="${{ matrix.build_platform }}" /p:PlatformToolset="v143" + + - name: Archive artifacts for x64 / Release + if: matrix.build_platform == 'x64' && matrix.build_configuration == 'Release' + uses: actions/upload-artifact@v3 + with: + name: Notepad++.MSVC.${{ matrix.build_platform}}.${{ matrix.build_configuration}} + path: PowerEditor\bin64\Notepad++.exe + + - name: Archive artifacts for Win32 / Release + if: matrix.build_platform == 'Win32' && matrix.build_configuration == 'Release' + uses: actions/upload-artifact@v3 + with: + name: Notepad++.MSVC.${{ matrix.build_platform}}.${{ matrix.build_configuration}} + path: PowerEditor\bin\Notepad++.exe + + - name: Archive artifacts for ARM64 / Release + if: matrix.build_platform == 'ARM64' && matrix.build_configuration == 'Release' + uses: actions/upload-artifact@v3 + with: + name: Notepad++.MSVC.${{ matrix.build_platform}}.${{ matrix.build_configuration}} + path: PowerEditor\binarm64\Notepad++.exe + + - name: Archive artifacts for ARM64|x64 / Debug + if: (matrix.build_platform == 'ARM64' || matrix.build_platform == 'x64') && matrix.build_configuration == 'Debug' + uses: actions/upload-artifact@v3 + with: + name: Notepad++.MSVC.${{ matrix.build_platform}}.${{ matrix.build_configuration}} + path: PowerEditor\visual.net\${{ matrix.build_platform}}\${{ matrix.build_configuration}}\Notepad++.exe + + - name: Archive artifacts for Win32 / Debug + if: matrix.build_platform == 'Win32' && matrix.build_configuration == 'Debug' + uses: actions/upload-artifact@v3 + with: + name: Notepad++.MSVC.${{ matrix.build_platform}}.${{ matrix.build_configuration}} + path: PowerEditor\visual.net\${{ matrix.build_configuration}}\Notepad++.exe + + - name: Run xml validation test for Win32 / Debug only + if: matrix.build_platform == 'Win32' && matrix.build_configuration == 'Debug' + working-directory: .\ + run: | + python -m pip install requests rfc3987 pywin32 lxml + python PowerEditor\Test\xmlValidator\validator_xml.py + + + - name: Run FunctionList and UrlDetection Tests for Win32 / Debug only + if: matrix.build_platform == 'Win32' && matrix.build_configuration == 'Debug' + working-directory: .\ + run: | + Copy-Item "PowerEditor\visual.net\Debug\Notepad++.exe" -Destination "PowerEditor\bin" + Copy-Item "PowerEditor\src\langs.model.xml" -Destination "PowerEditor\bin" + Copy-Item "PowerEditor\src\stylers.model.xml" -Destination "PowerEditor\bin" + Copy-Item "PowerEditor\src\shortcuts.xml" -Destination "PowerEditor\bin" + Copy-Item "PowerEditor\src\contextMenu.xml" -Destination "PowerEditor\bin" + Copy-Item "PowerEditor\installer\functionList" -Destination "PowerEditor\bin" -Recurse + + Copy-Item "PowerEditor\installer\filesForTesting\regexGlobalTest.xml" -Destination "PowerEditor\bin\functionList" + Copy-Item "PowerEditor\installer\filesForTesting\overrideMap.xml" -Destination "PowerEditor\bin\functionList" + + cd .\PowerEditor\Test\FunctionList\ + .\unitTestLauncher.ps1 + if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) } + + cd ..\UrlDetection + .\verifyUrlDetection.ps1 + + + # build_windows_clang: + + # runs-on: windows-latest + # strategy: + # matrix: + # build_configuration: [Release] + # build_platform: [x64] + + # steps: + # - name: Checkout repo + # uses: actions/checkout@v4 + + # - name: Add msbuild to PATH + # uses: microsoft/setup-msbuild@v1 + + # - name: MSBuild of n++ exe + # working-directory: PowerEditor\visual.net\ + # run: msbuild notepadPlus.sln /m /p:configuration="${{ matrix.build_configuration }}" /p:platform="${{ matrix.build_platform }}" /p:PlatformToolset="ClangCL" + + + build_windows_cmake: + + runs-on: windows-latest + strategy: + matrix: + include: + - build_configuration: Release + build_platform: x64 + arch: amd64 + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: Add nmake to PATH + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - name: build scintilla + working-directory: scintilla/win32/ + run: | + nmake -f scintilla.mak + + - name: build lexilla + working-directory: lexilla/src/ + run: | + nmake -f lexilla.mak + + - name: generate cmake + working-directory: PowerEditor/src + run: | + mkdir _build + cd _build + cmake -G "Visual Studio 17 2022" -A ${{ matrix.build_platform }} -T "v143" .. + + - name: build cmake + working-directory: PowerEditor/src + run: | + cd _build + cmake --build . --config ${{ matrix.build_configuration }} + + build_windows_msys2: + + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + build_configuration: [Release, Debug] + build_platform: [x86_64, i686] + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Make n++ exe + working-directory: .\ + run: | + Write-host "${{ matrix.build_platform }}" + Write-host "${{ matrix.build_configuration }}" + $Env:Path = 'C:\msys64\usr\bin' + [IO.Path]::PathSeparator + $Env:Path + if ( $${{ matrix.build_platform == 'i686'}} ) {$Env:MSYSTEM = 'MINGW32'} + if ( $${{ matrix.build_platform == 'i686'}} ) {$Env:Path = 'C:\msys64\mingw32\bin' + [IO.Path]::PathSeparator + $Env:Path} + if ( $${{ matrix.build_platform == 'x86_64'}} ) {$Env:MSYSTEM = 'MINGW64'} + if ( $${{ matrix.build_platform == 'x86_64'}} ) {$Env:Path = 'C:\msys64\mingw64\bin' + [IO.Path]::PathSeparator + $Env:Path} + if ( $${{ matrix.build_configuration == 'Debug'}} ) {$Env:DEBUG = '1'} + Write-Output "Tools version:" + Write-Output (((gcc --version) | select-object -first 1) + " " + (gcc -dumpmachine)) + Write-Output (make --version) | select-object -first 1 + Write-Output (sh --version) | select-object -first 1 + Write-Output "" + bash -lc "pacman --noconfirm -Syuu" + bash -lc "pacman --noconfirm -Syuu" + if ( $${{ matrix.build_platform == 'i686'}} ) {bash -lc "pacman --noconfirm -S mingw-w64-i686-gcc mingw-w64-i686-make"} + if ( $${{ matrix.build_platform == 'x86_64'}} ) {bash -lc "pacman --noconfirm -S mingw-w64-x86_64-gcc mingw-w64-x86_64-make"} + make -f PowerEditor\gcc\makefile + + - name: Archive artifacts for ${{ matrix.build_platform}} / Release + if: matrix.build_configuration == 'Release' + uses: actions/upload-artifact@v3 + with: + name: Notepad++.GCC.${{ matrix.build_platform}}.${{ matrix.build_configuration}} + path: bin.${{ matrix.build_platform}}\notepad++.exe + + - name: Archive artifacts for ${{ matrix.build_platform}} / Debug + if: matrix.build_configuration == 'Debug' + uses: actions/upload-artifact@v3 + with: + name: Notepad++.GCC.${{ matrix.build_platform}}.${{ matrix.build_configuration}} + path: bin.${{ matrix.build_platform}}-debug\notepad++.exe diff --git a/PowerEditor/Test/FunctionList/bash/unitTest.expected.result b/PowerEditor/Test/FunctionList/bash/unitTest.expected.result index c53b0b3f9..71444feff 100644 --- a/PowerEditor/Test/FunctionList/bash/unitTest.expected.result +++ b/PowerEditor/Test/FunctionList/bash/unitTest.expected.result @@ -1 +1 @@ -{"leaves":["action_needed","canonicalize_path","make_module","db2_name","versioned_copy"],"root":"unitTest"} \ No newline at end of file +{"leaves":["setenv","action_needed","canonicalize_path","make_module","db2_name","versioned_copy"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/bash/unitTest.expected.result.correct b/PowerEditor/Test/FunctionList/bash/unitTest.expected.result.correct deleted file mode 100644 index 71444feff..000000000 --- a/PowerEditor/Test/FunctionList/bash/unitTest.expected.result.correct +++ /dev/null @@ -1 +0,0 @@ -{"leaves":["setenv","action_needed","canonicalize_path","make_module","db2_name","versioned_copy"],"root":"unitTest"} \ No newline at end of file diff --git a/PowerEditor/Test/FunctionList/unitTest.ps1 b/PowerEditor/Test/FunctionList/unitTest.ps1 index 9ec26b9bc..8e28e36f9 100644 --- a/PowerEditor/Test/FunctionList/unitTest.ps1 +++ b/PowerEditor/Test/FunctionList/unitTest.ps1 @@ -22,7 +22,7 @@ Try { if ($langName.StartsWith("udl-")) { $langName = $langName.Replace("udl-", "") - ..\..\bin\notepad++.exe -export=functionList -udl="`"$langName"`" $testRoot$dirName\unitTest | Out-Null + ..\..\bin\notepad++.exe -export=functionList -udl="$langName" $testRoot$dirName\unitTest | Out-Null } else { @@ -31,16 +31,16 @@ Try { $expectedRes = Get-Content $testRoot$dirName\unitTest.expected.result $generatedRes = Get-Content $testRoot$dirName\unitTest.result.json - + # Some parser results contain CRLF or LF (\r\n or \n) dependent of file EOL format - # In order to make tests pass in any environment, all the CRLF turning into LF (if any) in both strings + # In order to make tests pass in any environment, all the CRLF turning into LF (if any) in both strings $expectedRes = $expectedRes.replace('\r\n','\n') $generatedRes = $generatedRes.replace('\r\n','\n') - + if ($generatedRes -eq $expectedRes) { - Remove-Item $testRoot$dirName\unitTest.result.json - return 0 + Remove-Item $testRoot$dirName\unitTest.result.json + return 0 } else { @@ -48,7 +48,7 @@ Try { "`nvs`n" $generatedRes return -1 - } + } } } Catch diff --git a/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 b/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 index 996f8af2c..f1c5f7ac8 100644 --- a/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 +++ b/PowerEditor/Test/FunctionList/unitTestLauncher.ps1 @@ -1,6 +1,6 @@ $testRoot = ".\" -Get-ChildItem -Path $testRoot -Attribute Directory | +Get-ChildItem -Path $testRoot -Attribute Directory -Name | Foreach-Object { $dirName = (Get-Item $testRoot$_).Name @@ -10,13 +10,13 @@ Foreach-Object { $sw.Stop() "Test: " + $sw.Elapsed.TotalMilliseconds + " ms" - + if ($result -eq 0) { "$dirName ... OK" } elseif ($result -eq 1) - { + { "$dirName ... unitTest file not found. Test skipped." } elseif ($result -eq -1) @@ -36,9 +36,9 @@ Foreach-Object { "It should not happen - check your script." exit -1 } - + # Check all Sub-directories for other unit-tests - Get-ChildItem -Path $testRoot\$dirName -Attribute Directory | + Get-ChildItem -Path $testRoot\$dirName -Attribute Directory -Name | Foreach-Object { $subDirName = (Get-Item $testRoot$dirName\$_).Name @@ -51,7 +51,7 @@ Foreach-Object { "$dirName-$subDirName ... OK" } elseif ($subResult -eq 1) - { + { "$dirName-$subDirName ... unitTest file not found. Test skipped." } else diff --git a/lexilla/lexers/LexObjC.cxx b/lexilla/lexers/LexObjC.cxx index 86fedd976..7b45869f7 100644 --- a/lexilla/lexers/LexObjC.cxx +++ b/lexilla/lexers/LexObjC.cxx @@ -47,10 +47,6 @@ inline bool IsASpace(unsigned int ch) { return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); } -static inline bool IsADigit(char ch) { - return isascii(ch) && isdigit(ch); -} - static inline bool IsADoxygenChar(const int ch) { return (islower(ch) || ch == '$' || ch == '@' || ch == '\\' || ch == '&' || ch == '<' || diff --git a/lexilla/src/lexilla.mak b/lexilla/src/lexilla.mak index aea8cd3ac..adbc3fc76 100644 --- a/lexilla/src/lexilla.mak +++ b/lexilla/src/lexilla.mak @@ -197,6 +197,9 @@ LEX_OBJS=\ $(DIR_O)\LexVisualProlog.obj \ $(DIR_O)\LexX12.obj \ $(DIR_O)\LexYAML.obj \ + $(DIR_O)\LexObjC.obj \ + $(DIR_O)\LexSearchResult.obj \ + $(DIR_O)\LexUser.obj #--Autogenerated -- end of automatically generated section