Skip to content

Commit

Permalink
gh actions CI test build for n++
Browse files Browse the repository at this point in the history
- cmake
- ubuntu linux
- clang-cl toolchain
- use ms analysis
  • Loading branch information
chcg committed Apr 30, 2023
1 parent 5f2e93e commit 9d31341
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
164 changes: 164 additions & 0 deletions .github/workflows/CI_build.yml
Original file line number Diff line number Diff line change
@@ -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 .
50 changes: 50 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions PowerEditor/src/cmake_toolchain-mingw-w64-ubuntu.cmake
Original file line number Diff line number Diff line change
@@ -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)

1 comment on commit 9d31341

@ozone10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.