From 9d3134186c297eabef44029d3d08090e28dd6983 Mon Sep 17 00:00:00 2001 From: Christian Grasser Date: Thu, 26 Sep 2019 21:59:03 +0200 Subject: [PATCH] gh actions CI test build for n++ - cmake - ubuntu linux - clang-cl toolchain - use ms analysis --- .github/dependabot.yml | 13 ++ .github/workflows/CI_build.yml | 164 ++++++++++++++++++ .github/workflows/codeql-analysis.yml | 50 ++++++ .../cmake_toolchain-mingw-w64-ubuntu.cmake | 25 +++ 4 files changed, 252 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/CI_build.yml create mode 100644 .github/workflows/codeql-analysis.yml create mode 100644 PowerEditor/src/cmake_toolchain-mingw-w64-ubuntu.cmake diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000000..2d01d71c9b3f --- /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 000000000000..2df73826a5c5 --- /dev/null +++ b/.github/workflows/CI_build.yml @@ -0,0 +1,164 @@ +name: CI_build + +on: [push, pull_request] + +jobs: + build_windows: + + runs-on: windows-2022 + strategy: + max-parallel: 4 + matrix: + build_configuration: [Release] + build_platform: [x64] + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - 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" /p:RunCodeAnalysis=true + + build_windows_clang: + + runs-on: windows-2022 + strategy: + max-parallel: 4 + matrix: + build_configuration: [Release] + build_platform: [x64] + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - 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" /p:RunCodeAnalysis=true + + + build_windows_cmake: + + runs-on: windows-2022 + strategy: + max-parallel: 4 + matrix: + include: + - build_configuration: Release + build_platform: x64 + arch: amd64 + - build_configuration: Release + build_platform: Win32 + arch: amd64_x86 + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - 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_linux: + + runs-on: ubuntu-22.04 + strategy: + max-parallel: 2 + matrix: + build_platform: ["x86_64"] + + steps: + - uses: actions/checkout@v3 + + - name: Install packages via apt + run: | + sudo apt-get -qq update + sudo apt-get -qq install -y mingw-w64 + (for alt in i686-w64-mingw32-g++ i686-w64-mingw32-gcc x86_64-w64-mingw32-g++ x86_64-w64-mingw32-gcc; do sudo update-alternatives --set $alt /usr/bin/$alt-posix; done); + + - name: build make mingw + working-directory: PowerEditor/gcc + run: | + export PATH=/usr/bin/${{ matrix.build_platform }}-w64-mingw32-gcc/bin:/usr/bin/${{ matrix.build_platform }}-w64-mingw32-g++/bin:$PATH + ${{ matrix.build_platform }}-w64-mingw32-g++ --version + export CXX=${{ matrix.build_platform }}-w64-mingw32-g++ + export WINDRES=${{ matrix.build_platform }}-w64-mingw32-windres + make CROSS_COMPILE=${{ matrix.build_platform }}-w64-mingw32- + + build_linux_cmake: + + runs-on: ubuntu-22.04 + strategy: + max-parallel: 2 + matrix: + build_configuration: [RELEASE, DEBUG] + build_platform: ["Unix Makefiles"] + + steps: + - uses: actions/checkout@v3 + + - name: Install packages via apt + run: | + sudo apt-get -qq update + sudo apt-get -qq install -y mingw-w64 + (for alt in i686-w64-mingw32-g++ i686-w64-mingw32-gcc x86_64-w64-mingw32-g++ x86_64-w64-mingw32-gcc; do sudo update-alternatives --set $alt /usr/bin/$alt-posix; done); + + - name: build scintilla + working-directory: scintilla/win32/ + run: | + export PATH=/usr/bin/x86_64-w64-mingw32-gcc/bin:/usr/bin/x86_64-w64-mingw32-g++/bin:$PATH + make -j CXX=x86_64-w64-mingw32-g++ WINDRES=x86_64-w64-mingw32-windres ${{ matrix.build_configuration }}=1 + + - name: build lexilla + working-directory: lexilla/src/ + run: | + export PATH=/usr/bin/x86_64-w64-mingw32-gcc/bin:/usr/bin/x86_64-w64-mingw32-g++/bin:$PATH + make -j CXX=x86_64-w64-mingw32-g++ WINDRES=x86_64-w64-mingw32-windres ${{ matrix.build_configuration }}=1 + + - name: generate cmake + working-directory: PowerEditor/src + run: | + mkdir _build + cd _build + cmake -DCMAKE_TOOLCHAIN_FILE=../cmake_toolchain-mingw-w64-ubuntu.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_configuration }} -G "${{ matrix.build_platform }}" .. + + - name: build cmake + working-directory: PowerEditor/src + run: | + cd _build + cmake --build . diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 000000000000..36c5afcef47f --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,50 @@ +name: "CodeQL" + +on: + push: + branches: [master, gh_actions_test] + pull_request: + # The branches below must be a subset of the branches above + branches: [master] + +jobs: + analyze: + name: Analyze + runs-on: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + # Override language selection by uncommenting this and choosing your languages + # with: + # languages: go, javascript, csharp, python, cpp, java + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + #- name: Autobuild + # uses: github/codeql-action/autobuild@v1 + + # ℹī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏ī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Add msbuild to PATH + uses: microsoft/setup-msbuild@v1 + + - name: MSBuild of n++ + working-directory: PowerEditor\visual.net\ + run: msbuild notepadPlus.sln /m /p:configuration="Debug" /p:platform="x64" + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/PowerEditor/src/cmake_toolchain-mingw-w64-ubuntu.cmake b/PowerEditor/src/cmake_toolchain-mingw-w64-ubuntu.cmake new file mode 100644 index 000000000000..6524995af0d0 --- /dev/null +++ b/PowerEditor/src/cmake_toolchain-mingw-w64-ubuntu.cmake @@ -0,0 +1,25 @@ +# Sample toolchain file for building for Windows from an Ubuntu Linux system. +# +# Typical usage: +# *) install cross compiler: `sudo apt-get install mingw-w64` +# *) cd build +# *) cmake -DCMAKE_TOOLCHAIN_FILE=/Path/to/Toolchain-mingw-w64-ubuntu.cmake .. + +set(CMAKE_SYSTEM_NAME Windows) +set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) +#use i686-w64-mingw32 for 32 bit + +# cross compilers to use for C, C++ and Fortran +set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) +set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) +set(CMAKE_Fortran_COMPILER ${TOOLCHAIN_PREFIX}-gfortran) +set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) + +# target environment on the build host system +set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) + +set (CMAKE_INSTALL_PREFIX ${CMAKE_FIND_ROOT_PATH} CACHE PATH "Cmake prefix" FORCE) + +# modify default behavior of FIND_XXX() commands +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) \ No newline at end of file