diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f72b5f3..cf2120d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,33 +4,32 @@ on: push: release: types: [published] + workflow_dispatch: jobs: build: strategy: matrix: qt_version: [5.14.2] - platform: [ubuntu-16.04, macos-latest, windows-latest] + platform: [ubuntu-22.04, macos-15-intel, windows-2022] arch: [x86, x64] include: - - platform: windows-latest + - platform: windows-2022 arch: x86 qtarch: win32_msvc2017 - cmakearch: Win32 - - platform: windows-latest + - platform: windows-2022 arch: x64 qtarch: win64_msvc2017_64 - cmakearch: x64 exclude: - - platform: ubuntu-16.04 + - platform: ubuntu-22.04 arch: x86 - - platform: macos-latest + - platform: macos-15-intel arch: x86 fail-fast: false runs-on: ${{ matrix.platform }} steps: - name: Checking out sources - uses: actions/checkout@v2 + uses: actions/checkout@v5 with: submodules: "recursive" - name: Install MSVC compiler @@ -38,33 +37,27 @@ jobs: with: # 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo toolset: 14.2 - arch: ${{ matrix.arch }} - - name: Cache Qt - id: cache-qt - uses: actions/cache@v1 - with: - path: ../Qt - key: QtCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }} + arch: ${{ matrix.arch }} - name: Installing Qt - ${{ matrix.arch }} - uses: jurplel/install-qt-action@v2 + uses: jurplel/install-qt-action@v4 with: version: ${{ matrix.qt_version }} arch: ${{ matrix.qtarch }} - mirror: "http://mirrors.ocf.berkeley.edu/qt/" - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - name: Install Python 3.7 version - if: matrix.platform == 'windows-latest' - uses: actions/setup-python@v1 + extra: "-b http://mirrors.ocf.berkeley.edu/qt/" + cache: true + - name: Install Python 3.8 version + if: startsWith(matrix.platform, 'windows') + uses: actions/setup-python@v6 with: - python-version: "3.7" + python-version: "3.8" architecture: ${{ matrix.arch }} - name: Get the version id: get_version shell: bash - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT" # Linux------------------------------------------ - name: Linux - Install packages - if: matrix.platform == 'ubuntu-16.04' + if: startsWith(matrix.platform, 'ubuntu') shell: bash env: CC: /usr/bin/gcc-9 @@ -72,7 +65,7 @@ jobs: run: | sudo apt install libgl-dev libx11-dev libxkbcommon-x11-dev ninja-build - name: Linux - Build ecm - if: matrix.platform == 'ubuntu-16.04' + if: startsWith(matrix.platform, 'ubuntu') shell: bash env: CC: /usr/bin/gcc-9 @@ -85,7 +78,7 @@ jobs: cmake --build . --parallel $(nproc) sudo cmake --build . --target install - name: Linux - Build SyntaxHighlighting - if: matrix.platform == 'ubuntu-16.04' + if: startsWith(matrix.platform, 'ubuntu') shell: bash env: CC: /usr/bin/gcc-9 @@ -98,7 +91,7 @@ jobs: cmake --build . --parallel $(nproc) sudo cmake --build . --target install - name: Linux - ${{ matrix.qt_version }} - Generate Dependencies and Build - if: matrix.platform == 'ubuntu-16.04' + if: startsWith(matrix.platform, 'ubuntu') shell: bash env: CC: /usr/bin/gcc-9 @@ -110,38 +103,39 @@ jobs: cmake --build . --parallel $(nproc) cmake --install . - name: Linux - ${{ matrix.qt_version }} - Generating AppImage - if: matrix.platform == 'ubuntu-16.04' + if: startsWith(matrix.platform, 'ubuntu') shell: bash env: CC: /usr/bin/gcc-9 CXX: /usr/bin/g++-9 run: | cd build - wget https://github.com/probonopd/linuxdeployqt/releases/download/6/linuxdeployqt-6-x86_64.AppImage - chmod +x ./linuxdeployqt-6-x86_64.AppImage - ./linuxdeployqt-6-x86_64.AppImage --appimage-extract - cd AppDir - wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/AppRun-patched-x86_64 -O AppRun - chmod a+x AppRun - mkdir -p ./usr/{lib,optional}/ - wget -c https://github.com/darealshinji/AppImageKit-checkrt/releases/download/continuous/exec-x86_64.so -O ./usr/optional/exec.so - mkdir -p ./usr/optional/libstdc++/ - cp -fv /usr/lib/x86_64-linux-gnu/libstdc++.so.6 ./usr/optional/libstdc++/ - mkdir -p ./usr/optional/libgcc_s/ - cp -fv /lib/x86_64-linux-gnu/libgcc_s.so.1 ./usr/optional/libgcc_s/ - cp -fv /usr/lib/x86_64-linux-gnu/{libssl.so.1.1,libcrypto.so.1.1} ./usr/lib/ - cd .. - squashfs-root/AppRun AppDir/usr/share/applications/notepanda.desktop -appimage -no-strip -always-overwrite + # get linuxdeploy and linuxdeploy-plugin-checkrt and make them executable + wget -c "https://github.com/darealshinji/linuxdeploy-plugin-checkrt/releases/download/continuous/linuxdeploy-plugin-checkrt.sh" + wget -c "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" + wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" + chmod a+x linuxdeploy-x86_64.AppImage linuxdeploy-plugin-checkrt.sh linuxdeploy-plugin-qt-x86_64.AppImage + + # add GCC's libraries to the search path + # and call through linuxdeploy using the `--plugin checkrt` option + ./linuxdeploy-x86_64.AppImage \ + --appdir AppDir \ + --plugin checkrt \ + --plugin qt \ + --output appimage \ + --icon-file ../images/panda.ico \ + --desktop-file AppDir/usr/share/applications/notepanda.desktop + mv ./Notepanda*.AppImage ./Notepanda.AppImage - name: Linux - ${{ matrix.qt_version }} - Uploading artifact - if: matrix.platform == 'ubuntu-16.04' - uses: actions/upload-artifact@master + if: startsWith(matrix.platform, 'ubuntu') + uses: actions/upload-artifact@v5 with: name: Notepanda-${{ github.sha }}.Linux-${{ matrix.arch }}.qt${{ matrix.qt_version }}.AppImage path: build/Notepanda.AppImage - name: Linux - ${{ matrix.qt_version }} - Upload binaries to release - uses: svenstaro/upload-release-action@v1-release - if: github.event_name == 'release' && matrix.platform == 'ubuntu-16.04' && matrix.qt_version == '5.14.2' + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && startsWith(matrix.platform, 'ubuntu') && matrix.qt_version == '5.14.2' with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: build/Notepanda.AppImage @@ -150,17 +144,17 @@ jobs: overwrite: true # Windows---------------------------------------------------------------------- # - name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Build preparation - Download Dependencies -# if: matrix.platform == 'windows-latest' +# if: startsWith(matrix.platform, 'windows') # run: | # choco install -y ninja - name: Setup Ninja - if: matrix.platform == 'windows-latest' - uses: ashutoshvarma/setup-ninja@master + if: startsWith(matrix.platform, 'windows') + uses: ashutoshvarma/setup-ninja@66ad2db9ed7d211c065daeeb849e9c8c895773c9 with: # ninja version to download. Default: 1.10.0 version: 1.10.0 - name: Win - Build ecm - if: matrix.platform == 'windows-latest' + if: startsWith(matrix.platform, 'windows') env: CC: cl.exe CXX: cl.exe @@ -173,7 +167,7 @@ jobs: cmake --build . --parallel $(nproc) cmake --build . --target install - name: Win - Build syntax highlight - if: matrix.platform == 'windows-latest' + if: startsWith(matrix.platform, 'windows') env: CC: cl.exe CXX: cl.exe @@ -185,7 +179,7 @@ jobs: cmake --build . --parallel $(nproc) cmake --build . --target install - name: Windows - ${{ matrix.qt_version }} - Generate Dependencies and Build - if: matrix.platform == 'windows-latest' + if: startsWith(matrix.platform, 'windows') env: CC: cl.exe CXX: cl.exe @@ -198,20 +192,20 @@ jobs: cd Release windeployqt notepanda.exe --no-translations - name: Win - ${{ matrix.arch }} - ${{ matrix.qt_version }} - Create 7z Release - if: matrix.platform == 'windows-latest' + if: startsWith(matrix.platform, 'windows') uses: DuckSoft/create-7z-action@v1.0 with: pathSource: ./build/Release pathTarget: ./release.7z - name: Win - ${{ matrix.arch }} - ${{ matrix.qt_version }} - Uploading artifact - if: matrix.platform == 'windows-latest' - uses: actions/upload-artifact@master + if: startsWith(matrix.platform, 'windows') + uses: actions/upload-artifact@v5 with: name: Notepanda-${{ github.sha }}.Windows-${{ matrix.arch }}.qt${{ matrix.qt_version }}.7z path: release.7z - name: Win - ${{ matrix.arch }} - ${{ matrix.qt_version }} - Upload binaries to release - uses: svenstaro/upload-release-action@v1-release - if: github.event_name == 'release' && matrix.platform == 'windows-latest' && matrix.qt_version == '5.14.2' + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && startsWith(matrix.platform, 'windows') && matrix.qt_version == '5.14.2' with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: release.7z @@ -220,7 +214,7 @@ jobs: overwrite: true # MacOS --------------------------------------------------------- - name: MacOS - Build ecm - if: matrix.platform == 'macos-latest' + if: startsWith(matrix.platform, 'macos') shell: bash run: | brew install ninja @@ -231,7 +225,7 @@ jobs: cmake --build . cmake --build . --target install - name: MacOS - Build syntax highlight - if: matrix.platform == 'macos-latest' + if: startsWith(matrix.platform, 'macos') run: | cd src/3rdparty/syntax-highlighting mkdir build @@ -240,7 +234,7 @@ jobs: cmake --build . sudo cmake --build . --target install - name: macOS - ${{ matrix.qt_version }} - Generate Dependencies and Build - if: matrix.platform == 'macos-latest' + if: startsWith(matrix.platform, 'macos') run: | mkdir build cd build @@ -249,14 +243,14 @@ jobs: sudo cmake --install . macdeployqt notepanda.app -dmg - name: macOS - ${{ matrix.qt_version }} - Uploading Artifact - if: matrix.platform == 'macos-latest' - uses: actions/upload-artifact@master + if: startsWith(matrix.platform, 'macos') + uses: actions/upload-artifact@v5 with: name: Notepanda-${{ github.sha }}.macOS-${{ matrix.arch }}.qt${{ matrix.qt_version }}.dmg path: build/notepanda.dmg - name: macOS - ${{ matrix.qt_version }} - Upload binaries to release - uses: svenstaro/upload-release-action@v1-release - if: github.event_name == 'release' && matrix.platform == 'macos-latest' && matrix.qt_version == '5.14.2' + uses: svenstaro/upload-release-action@v2 + if: github.event_name == 'release' && startsWith(matrix.platform, 'macos') && matrix.qt_version == '5.14.2' with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: build/notepanda.dmg diff --git a/.github/workflows/check-format.yml b/.github/workflows/check-format.yml index 8b62d16..43b1482 100644 --- a/.github/workflows/check-format.yml +++ b/.github/workflows/check-format.yml @@ -1,24 +1,24 @@ name: "Check Clang Format" -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: format: name: "Check Clang Format" - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 - - name: "Install clang-format-9" + - uses: actions/checkout@v5 + - name: "Install clang-format" run: | sudo apt-get update - sudo apt-get install clang-format-9 + sudo apt-get install clang-format - name: "Format Codes" - run: clang-format-9 -i src/*.cpp src/*/*.cpp src/*/*.h + run: clang-format -i src/*.cpp src/*/*.cpp src/*/*.h - name: Check diff run: git diff --exit-code HEAD - name: Create Pull Request if: failure() - uses: peter-evans/create-pull-request@v2 + uses: peter-evans/create-pull-request@v7 with: commit-message: "style: format codes" title: "style: format codes for ${{ github.ref }}" diff --git a/.github/workflows/cpack-deb.yml b/.github/workflows/cpack-deb.yml index 35a3c3b..c5038e5 100644 --- a/.github/workflows/cpack-deb.yml +++ b/.github/workflows/cpack-deb.yml @@ -4,20 +4,29 @@ on: push: release: types: [published] + workflow_dispatch: jobs: check_commit_msg: outputs: commit_message: ${{ steps.get_message.outputs.message }} name: Check if the workflow has been disabled. - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v5 - name: Get commit message id: get_message run: | - echo "::set-output name=message::$(git log --format=%B -n 1 ${{ github.event.after }})" - echo "::set-env name=message::$(git log --format=%B -n 1 ${{ github.event.after }})" + { + echo 'message<> "$GITHUB_OUTPUT" + { + echo 'message<> "$GITHUB_ENV" linux: strategy: matrix: @@ -25,7 +34,7 @@ jobs: needs: check_commit_msg if: ${{ !contains( needs.check_commit_msg.outputs.commit_message, 'NO_DEB') }} name: Debian ${{ matrix.distro }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: debian:${{ matrix.distro }} steps: @@ -34,7 +43,7 @@ jobs: apt-get update apt-get install -y git - name: Checking out sources - uses: actions/checkout@v2 + uses: actions/checkout@v5 with: submodules: 'recursive' - name: Install build dependencies @@ -50,18 +59,18 @@ jobs: shell: bash id: get_package run: | - echo ::set-output name=NAME::$(basename build/Notepanda-*.deb) + echo "NAME=$(basename build/Notepanda-*.deb)" >> "$GITHUB_OUTPUT" - name: Get the version id: get_version shell: bash - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT" - name: Upload artifact - uses: actions/upload-artifact@v2-preview + uses: actions/upload-artifact@v5 with: name: ${{ steps.get_package.outputs.NAME }} path: build/${{ steps.get_package.outputs.NAME }} - name: Upload binaries to release - uses: svenstaro/upload-release-action@v1-release + uses: svenstaro/upload-release-action@v2 if: github.event_name == 'release' && matrix.distro == 'stable' with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/cpack-nsis.yml b/.github/workflows/cpack-nsis.yml index 3cae563..5498465 100644 --- a/.github/workflows/cpack-nsis.yml +++ b/.github/workflows/cpack-nsis.yml @@ -4,20 +4,21 @@ on: push: release: types: [published] + workflow_dispatch: jobs: build: strategy: matrix: qt_version: [5.14.2] - platform: [windows-latest] + platform: [windows-2022] arch: [x86, x64] include: - - platform: windows-latest + - platform: windows-2022 arch: x86 qtarch: win32_msvc2017 cmakearch: Win32 - - platform: windows-latest + - platform: windows-2022 arch: x64 qtarch: win64_msvc2017_64 cmakearch: x64 @@ -29,15 +30,15 @@ jobs: - name: Get the version id: get_version shell: bash - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT" - name: Checking out sources - uses: actions/checkout@v2 + uses: actions/checkout@v5 with: submodules: 'recursive' - - name: Install Python 3.7 version - uses: actions/setup-python@v1 + - name: Install Python 3.8 version + uses: actions/setup-python@v6 with: - python-version: '3.7' + python-version: '3.8' architecture: ${{ matrix.arch }} # ========================================================================================================= - name: Install MSVC compiler @@ -45,32 +46,23 @@ jobs: with: toolset: 14.2 arch: ${{ matrix.arch }} - - name: Cache Qt - id: cache-qt - uses: actions/cache@v1 - with: - path: ../Qt - key: QtCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }} - name: Installing Qt - ${{ matrix.arch }} - uses: jurplel/install-qt-action@v2.5.0 + uses: jurplel/install-qt-action@v4 with: version: ${{ matrix.qt_version }} arch: ${{ matrix.qtarch }} - mirror: 'http://mirrors.ocf.berkeley.edu/qt/' - cached: ${{ steps.cache-qt.outputs.cache-hit }} + extra: "-b http://mirrors.ocf.berkeley.edu/qt/" + cache: true # Windows---------------------------------------------------------------------- # - name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Build preparation - Download Dependencies -# if: matrix.platform == 'windows-latest' # run: | # choco install -y ninja - name: Setup Ninja - if: matrix.platform == 'windows-latest' - uses: ashutoshvarma/setup-ninja@master + uses: ashutoshvarma/setup-ninja@66ad2db9ed7d211c065daeeb849e9c8c895773c9 with: # ninja version to download. Default: 1.10.0 version: 1.10.0 - name: Win - Build ecm - if: matrix.platform == 'windows-latest' env: CC: cl.exe CXX: cl.exe @@ -83,7 +75,6 @@ jobs: cmake --build . cmake --build . --target install - name: Win - Build syntax highlight - if: matrix.platform == 'windows-latest' env: CC: cl.exe CXX: cl.exe @@ -95,7 +86,6 @@ jobs: cmake --build . cmake --build . --target install - name: Windows - ${{ matrix.qt_version }} - Generate Dependencies and Build - if: matrix.platform == 'windows-latest' env: CC: cl.exe CXX: cl.exe @@ -108,14 +98,14 @@ jobs: shell: bash id: get_package run: | - echo ::set-output name=NAME::$(basename build/Notepanda-*.exe) + echo "NAME=$(basename build/Notepanda-*.exe)" >> "$GITHUB_OUTPUT" - name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - uploading artifact - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v5 with: name: ${{ steps.get_package.outputs.NAME }} path: build/${{ steps.get_package.outputs.NAME }} - name: Win-${{ matrix.arch }} - ${{ matrix.qt_version }} - Upload binaries to release - uses: svenstaro/upload-release-action@v1-release + uses: svenstaro/upload-release-action@v2 if: github.event_name == 'release' with: repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 515838d..f873d4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.5.0) file(STRINGS "${CMAKE_SOURCE_DIR}/makespec/VERSION" VERSION) file(STRINGS "${CMAKE_SOURCE_DIR}/makespec/BUILDVERSION" BUILD_VERSION) diff --git a/src/core/texteditor.cpp b/src/core/texteditor.cpp index 33f08fb..257ed37 100644 --- a/src/core/texteditor.cpp +++ b/src/core/texteditor.cpp @@ -31,10 +31,10 @@ #include // KSyntaxHighlighting -#include -#include -#include -#include +#include +#include +#include +#include #include "../ui/linenumberarea.h" diff --git a/src/core/texteditor.h b/src/core/texteditor.h index c8a3a2e..28de5f8 100644 --- a/src/core/texteditor.h +++ b/src/core/texteditor.h @@ -12,8 +12,7 @@ #ifndef TEXTEDITOR_H #define TEXTEDITOR_H -#include - +#include #include #include "configmanager.h"