From 70b769f0ba93e17e9632ef43a4709932923cbca0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 10:44:16 +0100 Subject: [PATCH 01/22] feat: add workflows build-nix, addstream-val --- .github/workflows/appstream-util-validate.yml | 25 + .github/workflows/ci.yml | 1608 ++++++++--------- 2 files changed, 829 insertions(+), 804 deletions(-) create mode 100644 .github/workflows/appstream-util-validate.yml diff --git a/.github/workflows/appstream-util-validate.yml b/.github/workflows/appstream-util-validate.yml new file mode 100644 index 000000000..59411ba02 --- /dev/null +++ b/.github/workflows/appstream-util-validate.yml @@ -0,0 +1,25 @@ +name: Validate MetaInfo +"on": + pull_request: + branches: [main] + paths: + - '**.nix' + - .github/workflows/appstream-util-validate.yaml + - flake.lock + - packaging/com.jwillikers.CyrillicEncoder.metainfo.xml + push: + branches: [main] + paths: + - '**.nix' + - .github/workflows/appstream-util-validate.yaml + - flake.lock + - packaging/com.jwillikers.CyrillicEncoder.metainfo.xml +jobs: + appstream-util-validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Check the MetaInfo file + run: nix develop --command appstream-util validate packaging/co.jmuelbert.jmbde-QT.metainfo.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78581ceb5..af0bd382a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,804 +1,804 @@ ---- -name: "CI: Test, Build and create release" - -# yamllint disable -on: - # yamllint enable - push: - branches: - - main - - develop - tags: - - "[0-9]+.[0-9]+.[0-9]+" - paths: - - "**.cpp" - - "**.h" - - "**.hpp" - - "**.py" - - cmake/** - - src/** - - CMakeLists.txt - - conanfile.py - - ".github/workflows/ci.yml" - - "deploy/flatpak.yaml" - - "snap/snapcraft.yaml" - - pull_request: - # The branches below must be a subset of the branches above - types: [ opened, synchronize, reopened ] - paths: - - "**.cpp" - - "**.h" - - "**.hpp" - - "**.py" - - cmake/** - - src/** - - CMakeLists.txt - - conanfile.py - - ".github/workflows/ci.yml" - - "deploy/flatpak.yaml" - - "snap/snapcraft.yaml" - - workflow_dispatch: - - -env: - # Target - TARGET_NAME: jmbde - PROJECT_NAME: jmbde-QT - # Conan cache environment variables - CONAN_SYSREQUIRES_MODE: enabled - CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" - CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" - CLANG_TIDY_VERSION: "13.0.0" - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - QT_VERSION: "6.4.1" - QT_TARGET: "desktop" - -jobs: - # format - clang-format: - name: "πŸ’Ž CLang-Format" - runs-on: ubuntu-latest - steps: - - name: "🧰 Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "🟨 Use clang-format" - uses: DoozyX/clang-format-lint-action@v0.17 - with: - source: "." - exclude: "./third_party ./external" - extensions: "c,h,cpp,hpp" - clangFormatVersion: 14 - inplace: true - - - uses: EndBug/add-and-commit@v9 - with: - author_name: Clang Robot - author_email: robot@example.com - message: ":art: Committing clang-format changes" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - cmake-format: - name: "πŸ’Ž CMake-Format" - runs-on: ubuntu-latest - steps: - - name: "🧰 Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper - # list of changed files within `super-linter` - fetch-depth: 0 - - - name: "🟨 Setup Python" - uses: actions/setup-python@v5 - with: - # Read python version from a file .python-version - python-version-file: ".python-version" - # check-latest: true - cache: pip - - - name: "🟨 Install cmakelang" - uses: BSFishy/pip-action@v1 - with: - packages: cmakelang pyyaml jinja2 - - - name: "🟨 Use cmake-format" - run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \; - - - name: "πŸ“¨ Use Commit" - uses: EndBug/add-and-commit@v9 - with: - author_name: github_actions - message: ":art: Committing format changes" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # lint: - - # tests: - tests: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - - # Recommendations: - # * support at least 2 operating systems - # * support at least 2 compilers - # * make sure all supported configurations for your project are built - # - # Disable/enable builds in this list to meet the above recommendations - # and your own projects needs - matrix: - os: [ ubuntu-latest, ubuntu-22.04 ] - generator: - - "Ninja" - build_type: - - Debug - qt_version: [ 5.15.2, 6.4.0 ] - - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "🧰 Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "βš™οΈ Install Python" - id: python - uses: actions/setup-python@v5 - with: - # Read python version from a file .python-version - python-version-file: ".python-version" - # check-latest: true - cache: pip - - - name: "'βš™οΈ Install Python dependencies" - shell: bash - id: python-deps - run: | - python -m pip install --upgrade pip - pip3 install "conan<2" - - - name: "🐧 βš™οΈ Install Linux dependencies" - if: runner.os == 'Linux' - run: | - sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ - sudo apt-get --no-install-recommends --assume-yes install \ - libclang-dev \ - ninja-build \ - gcovr \ - ccache \ - cppcheck \ - googletest - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - echo "CXX=g++-10" >> $GITHUB_ENV - echo "CC=gcc-10" >> $GITHUB_ENV - - - name: Configure Conan - shell: bash - run: | - echo "Setup conan" - conan user - conan config init - conan profile show default - - - name: "πŸ”§ Setup Cache" - uses: ./.github/actions/setup_cache - with: - build_type: ${{ matrix.build_type }} - generator: ${{ matrix.generator }} - - - name: "βš™οΈ Install Qt Version ${{ matrix.qt_version }}" - uses: jurplel/install-qt-action@v4 - with: - version: "${{ matrix.qt_version }}" - dir: "${{ env.QT_DIR }}" - # host: ${{ runner.os }} - arch: "${{ env.QT_ARCH }}" - target: "${{ env.QT_TARGET }}" - tools: "${{ env.QT_TOOLS }}" - setup-python: "true" - cache: "true" - cache-key-prefix: "${{ runner.os }}-install-qt-action" - set-env: "true" - install-deps: "true" - - uses: hendrikmuhs/ccache-action@v1 - if: runner.os == 'Linux' - with: - key: ${{ matrix.os }}-${{ matrix.build_type }} - max-size: 50M - - - name: restore ccache - uses: pat-s/always-upload-cache@v3.0.11 - with: - path: ${{runner.workspace}}/ccache - key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} - restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} - - - name: check ccache stats prior to build - run: ccache --zero-stats --show-stats - - - name: "Cleanup Conan system packages (they are not properly cached)" - run: | - conan remove -f '*/system' - - - name: "Add GCC problem matcher" - uses: ammaraskar/gcc-problem-matcher@master - - - name: "Create Build Environment" - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory build - # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results - - name: "Configure CMake" - working-directory: build - shell: bash - run: | - mkdir -pv usr - cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="./usr" \ - -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \ - -DBUILD_TESTING:BOOL=${{ matrix.build_type == 'Debug' }} \ - -DENABLE_CACHE="ON" - - - name: "🚧 Build" - # Execute the build. You can specify a specific target with "--target " - run: | - cmake --build ./build --config ${{matrix.build_type}} - - - name: check ccache stats prior to build - run: ccache --zero-stats --show-stats - - - name: "🐧 πŸ§ͺ Test and coverage" - working-directory: build - # Execute tests defined by the CMake configuration. - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: | - ctest -C ${{matrix.build_type}} - gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml - - - name: "Publish to codecov" - uses: codecov/codecov-action@v3 - with: - flags: ${{ runner.os }} - name: ${{ runner.os }}-coverage - files: ./build/coverage.xml - - build: - # if: startsWith(github.event.ref, 'refs/tags/') - name: "Build for ${{ matrix.name }}" - - runs-on: ${{ matrix.os }} - needs: tests - - strategy: - fail-fast: false - matrix: - name: - [ - ubuntu-latest-clang++, - macos-latest-clang++, - windows-latest-cl.exe - ] - include: - - name: ubuntu-latest-clang++ - os: ubuntu-latest - build_type: Release - qt_arch: gcc_64 - compiler: clang++-14 - ccompiler: clang-14 - clang-tidy: "" - generators: Ninja - - name: windows-latest-cl.exe - os: windows-latest - build_type: Release - qt_arch: win64_msvc2019_64 - arch: x64 - pak_arch: win64 - compiler: cl.exe - ccompiler: cl.exe - clang-tidy: "" - generators: Ninja - - name: macos-latest-clang++ - os: macos-latest - build_type: Release - qt_arch: clang_64 - arch: clang_64 - compiler: clang++ - ccompiler: clang - generators: Ninja - - env: - CXX: ${{ matrix.compiler }} - CC: ${{ matrix.ccompiler }} - - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: "βš™οΈ Get the version" - id: get_version - shell: bash - run: | - echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" - - - name: "🧰 Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "βš™οΈ Install Python" - id: python - uses: actions/setup-python@v5 - with: - # Read python version from a file .python-version - python-version-file: ".python-version" - # check-latest: true - cache: pip - - - name: "βš™οΈ Install Python dependencies" - shell: bash - id: python-deps - run: | - python -m pip install --upgrade pip - pip3 install "conan<2" - - - name: "πŸ”§ Setup Cache" - uses: ./.github/actions/setup_cache - with: - build_type: ${{ matrix.build_type }} - generator: ${{ matrix.generator }} - - - name: "🐧 βš™οΈ Install Linux dependencies" - if: runner.os == 'Linux' - run: | - sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ - sudo apt-get --no-install-recommends --assume-yes install \ - libclang-dev \ - ninja-build \ - ccache - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - echo "CXX=clang++-12" >> $GITHUB_ENV - echo "CC=clang-12" >> $GITHUB_ENV - - - name: "βš™οΈ 🍎 Install macos dependencies" - if: runner.os == 'macOS' - env: - HOMEBREW_NO_ANALYTICS: "ON" - HOMEBREW_NO_AUTO_UPDATE: "ON" - HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" - HOMEBREW_NO_INSTALL_CLEANUP: "ON" - run: | - brew install ninja ccache pkg-config - echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV - # Use latest available XCode - sudo xcode-select -s "/Applications/Xcode_13.2.1.app" - echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> $GITHUB_ENV - - - name: "🧊 βš™οΈ Install Windows dependencies" - if: runner.os == 'Windows' - run: | - cinst ninja ccache - - - name: "🧊 βš™οΈ Configure MSVC" - if: runner.os == 'Windows' - uses: ilammy/msvc-dev-cmd@v1.13.0 - with: - # 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo - toolset: 14.2 - arch: ${{ matrix.confg.pak_arch }} - - - name: Configure Conan - shell: bash - run: | - echo "Setup conan" - conan user - conan config init - conan profile show default - - - name: (Linux/macOS) restore ccache - if: runner.os == 'Linux' || runner.os == 'macOS' - uses: pat-s/always-upload-cache@v3.0.11 - with: - path: ${{runner.workspace}}/ccache - key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} - restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} - - - name: (Linux/macOS) check ccache stats prior to build - if: runner.os == 'Linux' || runner.os == 'macOS' - run: ccache --zero-stats --show-stats - - - name: "Add GCC problem matcher" - if: runner.os == 'Linux' - uses: ammaraskar/gcc-problem-matcher@master - - - name: "βš™οΈ Install Qt Version ${{ env.QT_VERSION }}" - uses: jurplel/install-qt-action@v4 - with: - version: ${{ env.QT_VERSION }} - # host: ${{ runner.os }} - target: ${{ env.QT_TARGET }} - arch: ${{ matrix.config.qt_arch }} - dir: "${{ github.workspace }}/build/" - install-deps: "true" - # modules: 'qtcharts qtwebengine' - cached: "${{ steps.cache-qt.outputs.cache-hit }}" - setup-python: "true" - # tools: "tools_ifw" - set-env: "true" - - - name: "Cleanup Conan system packages (they are not properly cached)" - run: | - conan remove -f '*/system' - - - name: "Create Build Environment" - # Some projects don't allow in-source building, so create a separate build directory - # We'll use this as our working directory for all subsequent commands - run: cmake -E make_directory build - - # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results - - name: "βš™οΈ 🧊 Configure CMake" - if: runner.os == 'Windows' - working-directory: build - shell: pwsh - run: | - cmake ` - -S .. -B . ` - -G "${{matrix.generators}}" ` - -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} ` - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" ` - -DBUILD_SHARED_LIBS:BOOL="TRUE" - # -G "Visual Studio 16 2019" -A "x64" ` - # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage - # has meaningful results. - - - name: "βš™οΈ 🐧 Configure CMake" - if: runner.os == 'Linux' - working-directory: build - shell: bash - run: |+ - cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \ - -DBUILD_SHARED_LIBS:BOOL="TRUE" \ - -DENABLE_CACHE="ON" - - - name: "βš™οΈ 🍎 Configure CMake" - working-directory: build - shell: bash - if: runner.os == 'macOS' - run: |+ - cmake -S .. -B . -G "${{matrix.generator}}" \ - -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ - -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \ - -DBUILD_SHARED_LIBS:BOOL="TRUE" \ - -DENABLE_CACHE="ON" - - # TODO: Stored in install. Build DMG with CPack - - name: "πŸ“¦ 🍎 Build and package application (macdeployqt and zipfile)" - working-directory: build - if: runner.os == 'macOS' - run: | - cmake --build . --config ${{matrix.build_type}} - cpack -C "${{matrix.build_type}}" -G "DragNDrop;ZIP" - - # TODO: Stored in install. Build installer with CPack - - name: "βš™οΈ 🧊 Build" - if: runner.os == 'Windows' - working-directory: build - run: | - cmake --build . --config ${{matrix.build_type}} - cpack -C "${{matrix.build_type}}" -G "WIX;ZIP" - - - name: "βš™οΈ 🐧 Build" - if: runner.os == 'Linux' - working-directory: build - # Execute the build. You can specify a specific target with "--target " - run: | - sudo apt-get -y --no-install-recommends install tree - cmake --build . --config ${{matrix.build_type}} --target install - - - name: "βš™οΈ 🐧 Install go-appimage tool" - if: runner.os == 'Linux' - # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution, - # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340. - # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd. - run: | - wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool - chmod +x appimagetool - env: - APPIMAGETOOL_ARCH: x86_64 - - # TODO: Stored in build directory - - name: "🐧 πŸ“¦ Create AppImage" - if: runner.os == 'Linux' - shell: bash - run: | - APPIMAGE_DST_PATH="${{github.workspace}}/AppDir" - cd $GITHUB_WORKSPACE - cp $GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png $APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png - $GITHUB_WORKSPACE/appimagetool -s deploy ${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop - mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts - if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then - rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0 - fi - chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.* - $GITHUB_WORKSPACE/appimagetool ${APPIMAGE_DST_PATH} - - - name: "🐧 πŸ“€ Upload Linux artifacts" - if: runner.os == 'Linux' - uses: actions/upload-artifact@v4 - with: - name: AppImage - path: "./*.AppImage*" - - - name: "🍎 πŸ“€ Upload macOS artifacts" - if: runner.os == 'macOS' - uses: actions/upload-artifact@v4 - with: - name: macos-artifacts - path: | - build/*.dmg - build/*.zip - - - name: "🧊 πŸ“€ Upload artifact: Windows Installer" - if: runner.os == 'Windows' - uses: actions/upload-artifact@v4 - with: - name: windows-artifacts - path: | - build/*.msi - build/*.zip - - flatpak-build: - name: "🐧 Build flatpak on ubuntu-latest" - runs-on: ubuntu-latest - needs: tests - - permissions: - actions: read - contents: read - security-events: write - - steps: - - name: "βš™οΈ Get the version" - id: get_version - shell: bash - run: echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" - - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "🧰 Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "Setup Flatpak" - run: | - sudo apt-get -y -qq update - sudo apt-get install -y flatpak flatpak-builder - - - name: "Setup Flatpak" - run: | - sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \ - apt-get --no-install-recommends --assume-yes install \ - flatpak flatpak-builder elfutils - - - name: "Setup Flathub" - run: | - flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - - - name: "πŸ“¦ Create flatpak" - run: | - mkdir -pv $GITHUB_WORKSPACE/install - BUNDLE="io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak" - MANIFEST_PATH=$GITHUB_WORKSPACE/deploy/flatpak.yaml - RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo" - APP_ID="io.github.jmuelbert.${{env.TARGET_NAME}}" - - flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub - flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} - mv $GITHUB_WORKSPACE/$BUNDLE $GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak - ls -al - - - name: "πŸ“€ Upload artifact: FlatPak" - uses: actions/upload-artifact@v4 - with: - name: flatpak-artifact - path: | - ./install/*.flatpak - - snap-build: - name: "🐧 Build snap on ubuntu-20.04" - runs-on: ubuntu-20.04 - needs: tests - - steps: - - name: "βš™οΈ Get the version" - id: get_version - shell: bash - run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) - - - name: "Cancel Previous Runs" - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - - name: "🧰 Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "πŸ“¦ Create snap" - uses: snapcore/action-build@v1 - id: snapcraft - with: - snapcraft-args: --enable-experimental-extensions - - - name: "Rename snap name" - shell: bash - run: | - mv ${{ steps.snapcraft.outputs.snap }} $GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap - ls - - - name: "🐧 πŸ“€ Upload artifact: SnapPack" - uses: actions/upload-artifact@v4 - with: - name: snapcraft-artifact - path: | - $GITHUB_WORKSPACE/${{ env.TARGET_NAME}}_*_amd64.snap - - diagram: - name: "Build diagram" - needs: tests - runs-on: ubuntu-latest - - steps: - - name: "🧰 Checkout" - uses: actions/checkout@master - - - name: "Update diagram" - uses: githubocto/repo-visualizer@0.9.1 - with: - output_file: "images/diagram.svg" - excluded_paths: "dist,node_modules" - - releaseNotes: - # if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - needs: upload - steps: - - name: "🧰 Checkout" - uses: actions/checkout@v4 - with: - # Full git history is needed to get a proper list of changed files within `super-linter` - fetch-depth: 0 - - - name: "Build Releasenotes" - id: github_releasenotes - uses: release-drafter/release-drafter@v5.25.0 - with: - publish: "${{ steps.check-version.outputs.tag != '' }}" - tag: "${{ steps.check-version.outputs.tag }}" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - - changeLog: - # if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - needs: upload - steps: - - name: Build Changelog - id: github_release - uses: mikepenz/release-changelog-builder-action@v4 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - uses: mikepenz/action-gh-release@v0.2.0-a03 #softprops/action-gh-release - with: - body: ${{steps.github_release.outputs.changelog}} - - # Upload continous build - upload: - name: "πŸ—‚ Create release and upload artifacts" - needs: - - build - - flatpak-build - - snap-build - - runs-on: ubuntu-latest - steps: - - name: "πŸ“₯ Download artifacts" - uses: actions/download-artifact@v4 - - name: "πŸ—‚ Inspect directory after downloading artifacts" - run: ls -alFR - - - name: "πŸ“€ Upload Release: AppImage" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.appimage - asset_name: ${{env.TARGET_NAME}}.appimage - tag: ${{ github.ref }} - overwrite: true - - - name: "πŸ“€ Upload Release: FlatPak" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.flatpak - asset_name: ${{env.TARGET_NAME}}.flatpak - tag: ${{ github.ref }} - overwrite: true - - - name: "πŸ“€ Upload Release: snap" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.amd64.snap - asset_name: ${{env.TARGET_NAME}}.amd64.snap - tag: ${{ github.ref }} - overwrite: true - - - name: "πŸ“€ Upload Release: macOS" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{runner.workspace}}/${{env.TARGET_NAME}}.dmg - asset_name: ${{env.TARGET_NAME}}.dmg - tag: ${{ github.ref }} - overwrite: true - - - name: "πŸ“€ Upload Release: windows" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./${{ env.TARGET_NAME }}.exe - asset_name: ${{ env.TARGET_NAME}}-win.exe - tag: ${{ github.ref }} - overwrite: true - - - name: "πŸ“€ Upload Release: zip for windows" - if: startsWith(github.event.ref, 'refs/tags/') - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ./${{ env.archiveName }}-win.zip - asset_name: ${{ env.TARGET_NAME}}-win-${{ steps.get_version.outputs.VERSION }}.zip - tag: ${{ github.ref }} - overwrite: true +--- +name: "CI: Test, Build and create release" + +# yamllint disable +on: + # yamllint enable + push: + branches: + - main + - develop + tags: + - "[0-9]+.[0-9]+.[0-9]+" + paths: + - "**.cpp" + - "**.h" + - "**.hpp" + - "**.py" + - cmake/** + - src/** + - CMakeLists.txt + - conanfile.py + - ".github/workflows/ci.yml" + - "deploy/flatpak.yaml" + - "snap/snapcraft.yaml" + + pull_request: + # The branches below must be a subset of the branches above + types: [ opened, synchronize, reopened ] + paths: + - "**.cpp" + - "**.h" + - "**.hpp" + - "**.py" + - cmake/** + - src/** + - CMakeLists.txt + - conanfile.py + - ".github/workflows/ci.yml" + - "deploy/flatpak.yaml" + - "snap/snapcraft.yaml" + + workflow_dispatch: + + +env: + # Target + TARGET_NAME: jmbde + PROJECT_NAME: jmbde-QT + # Conan cache environment variables + CONAN_SYSREQUIRES_MODE: enabled + CONAN_USER_HOME: "${{ github.workspace }}/conan-cache" + CONAN_USER_HOME_SHORT: "${{ github.workspace }}/conan-cache/short" + CLANG_TIDY_VERSION: "13.0.0" + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + QT_VERSION: "6.4.1" + QT_TARGET: "desktop" + +jobs: + # format + clang-format: + name: "πŸ’Ž CLang-Format" + runs-on: ubuntu-latest + steps: + - name: "🧰 Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "🟨 Use clang-format" + uses: DoozyX/clang-format-lint-action@v0.17 + with: + source: "." + exclude: "./third_party ./external" + extensions: "c,h,cpp,hpp" + clangFormatVersion: 14 + inplace: true + + - uses: EndBug/add-and-commit@v9 + with: + author_name: Clang Robot + author_email: robot@example.com + message: ":art: Committing clang-format changes" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + cmake-format: + name: "πŸ’Ž CMake-Format" + runs-on: ubuntu-latest + steps: + - name: "🧰 Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper + # list of changed files within `super-linter` + fetch-depth: 0 + + - name: "🟨 Setup Python" + uses: actions/setup-python@v5 + with: + # Read python version from a file .python-version + python-version-file: ".python-version" + # check-latest: true + cache: pip + + - name: "🟨 Install cmakelang" + uses: BSFishy/pip-action@v1 + with: + packages: cmakelang pyyaml jinja2 + + - name: "🟨 Use cmake-format" + run: find . \( -name '*.cmake' -o -name 'CMakeLists.txt' \) -exec cmake-format -i {} \; + + - name: "πŸ“¨ Use Commit" + uses: EndBug/add-and-commit@v9 + with: + author_name: github_actions + message: ":art: Committing format changes" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # lint: + + # tests: + tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + + # Recommendations: + # * support at least 2 operating systems + # * support at least 2 compilers + # * make sure all supported configurations for your project are built + # + # Disable/enable builds in this list to meet the above recommendations + # and your own projects needs + matrix: + os: [ ubuntu-latest, ubuntu-22.04 ] + generator: + - "Ninja" + build_type: + - Debug + qt_version: [ 5.15.2, 6.4.0 ] + + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: "Cancel Previous Runs" + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: "🧰 Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "βš™οΈ Install Python" + id: python + uses: actions/setup-python@v5 + with: + # Read python version from a file .python-version + python-version-file: ".python-version" + # check-latest: true + cache: pip + + - name: "'βš™οΈ Install Python dependencies" + shell: bash + id: python-deps + run: | + python -m pip install --upgrade pip + pip3 install "conan<2" + + - name: "🐧 βš™οΈ Install Linux dependencies" + if: runner.os == 'Linux' + run: | + sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ + sudo apt-get --no-install-recommends --assume-yes install \ + libclang-dev \ + ninja-build \ + gcovr \ + ccache \ + cppcheck \ + googletest + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + echo "CXX=g++-10" >> $GITHUB_ENV + echo "CC=gcc-10" >> $GITHUB_ENV + + - name: Configure Conan + shell: bash + run: | + echo "Setup conan" + conan user + conan config init + conan profile show default + + - name: "πŸ”§ Setup Cache" + uses: ./.github/actions/setup_cache + with: + build_type: ${{ matrix.build_type }} + generator: ${{ matrix.generator }} + + - name: "βš™οΈ Install Qt Version ${{ matrix.qt_version }}" + uses: jurplel/install-qt-action@v4 + with: + version: "${{ matrix.qt_version }}" + dir: "${{ env.QT_DIR }}" + # host: ${{ runner.os }} + arch: "${{ env.QT_ARCH }}" + target: "${{ env.QT_TARGET }}" + tools: "${{ env.QT_TOOLS }}" + setup-python: "true" + cache: "true" + cache-key-prefix: "${{ runner.os }}-install-qt-action" + set-env: "true" + install-deps: "true" + - uses: hendrikmuhs/ccache-action@v1 + if: runner.os == 'Linux' + with: + key: ${{ matrix.os }}-${{ matrix.build_type }} + max-size: 50M + + - name: restore ccache + uses: pat-s/always-upload-cache@v3.0.11 + with: + path: ${{runner.workspace}}/ccache + key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} + restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} + + - name: check ccache stats prior to build + run: ccache --zero-stats --show-stats + + - name: "Cleanup Conan system packages (they are not properly cached)" + run: | + conan remove -f '*/system' + + - name: "Add GCC problem matcher" + uses: ammaraskar/gcc-problem-matcher@master + + - name: "Create Build Environment" + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory build + # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage + # has meaningful results + - name: "Configure CMake" + working-directory: build + shell: bash + run: | + mkdir -pv usr + cmake -S .. -B . -G "${{matrix.generator}}" \ + -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ + -DCMAKE_INSTALL_PREFIX:PATH="./usr" \ + -DOPT_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} \ + -DBUILD_TESTING:BOOL=${{ matrix.build_type == 'Debug' }} \ + -DENABLE_CACHE="ON" + + - name: "🚧 Build" + # Execute the build. You can specify a specific target with "--target " + run: | + cmake --build ./build --config ${{matrix.build_type}} + + - name: check ccache stats prior to build + run: ccache --zero-stats --show-stats + + - name: "🐧 πŸ§ͺ Test and coverage" + working-directory: build + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: | + ctest -C ${{matrix.build_type}} + gcovr -j ${{env.nproc}} --delete --root ../ --print-summary --xml-pretty --xml coverage.xml + + - name: "Publish to codecov" + uses: codecov/codecov-action@v3 + with: + flags: ${{ runner.os }} + name: ${{ runner.os }}-coverage + files: ./build/coverage.xml + + build: + # if: startsWith(github.event.ref, 'refs/tags/') + name: "Build for ${{ matrix.name }}" + + runs-on: ${{ matrix.os }} + needs: tests + + strategy: + fail-fast: false + matrix: + name: + [ + ubuntu-latest-clang++, + macos-latest-clang++, + windows-latest-cl.exe + ] + include: + - name: ubuntu-latest-clang++ + os: ubuntu-latest + build_type: Release + qt_arch: gcc_64 + compiler: clang++-14 + ccompiler: clang-14 + clang-tidy: "" + generators: Ninja + - name: windows-latest-cl.exe + os: windows-latest + build_type: Release + qt_arch: win64_msvc2019_64 + arch: x64 + pak_arch: win64 + compiler: cl.exe + ccompiler: cl.exe + clang-tidy: "" + generators: Ninja + - name: macos-latest-clang++ + os: macos-latest + build_type: Release + qt_arch: clang_64 + arch: clang_64 + compiler: clang++ + ccompiler: clang + generators: Ninja + + env: + CXX: ${{ matrix.compiler }} + CC: ${{ matrix.ccompiler }} + + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: "βš™οΈ Get the version" + id: get_version + shell: bash + run: | + echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" + + - name: "🧰 Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "βš™οΈ Install Python" + id: python + uses: actions/setup-python@v5 + with: + # Read python version from a file .python-version + python-version-file: ".python-version" + # check-latest: true + cache: pip + + - name: "βš™οΈ Install Python dependencies" + shell: bash + id: python-deps + run: | + python -m pip install --upgrade pip + pip3 install "conan<2" + + - name: "πŸ”§ Setup Cache" + uses: ./.github/actions/setup_cache + with: + build_type: ${{ matrix.build_type }} + generator: ${{ matrix.generator }} + + - name: "🐧 βš™οΈ Install Linux dependencies" + if: runner.os == 'Linux' + run: | + sudo apt-get update && DEBIAN_FRONTEND=--noninteractive \ + sudo apt-get --no-install-recommends --assume-yes install \ + libclang-dev \ + ninja-build \ + ccache + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + echo "CXX=clang++-12" >> $GITHUB_ENV + echo "CC=clang-12" >> $GITHUB_ENV + + - name: "βš™οΈ 🍎 Install macos dependencies" + if: runner.os == 'macOS' + env: + HOMEBREW_NO_ANALYTICS: "ON" + HOMEBREW_NO_AUTO_UPDATE: "ON" + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" + HOMEBREW_NO_INSTALL_CLEANUP: "ON" + run: | + brew install ninja ccache pkg-config + echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH + echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV + # Use latest available XCode + sudo xcode-select -s "/Applications/Xcode_13.2.1.app" + echo "DEVELOPER_DIR=/Applications/Xcode_13.2.1.app/Contents/Developer" >> $GITHUB_ENV + + - name: "🧊 βš™οΈ Install Windows dependencies" + if: runner.os == 'Windows' + run: | + cinst ninja ccache + + - name: "🧊 βš™οΈ Configure MSVC" + if: runner.os == 'Windows' + uses: ilammy/msvc-dev-cmd@v1.13.0 + with: + # 14.1 is for vs2017, 14.2 is vs2019, following the upstream vcpkg build from Qv2ray-deps repo + toolset: 14.2 + arch: ${{ matrix.confg.pak_arch }} + + - name: Configure Conan + shell: bash + run: | + echo "Setup conan" + conan user + conan config init + conan profile show default + + - name: (Linux/macOS) restore ccache + if: runner.os == 'Linux' || runner.os == 'macOS' + uses: pat-s/always-upload-cache@v3.0.11 + with: + path: ${{runner.workspace}}/ccache + key: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}}-${{ github.sha }} + restore-keys: ccache-${{matrix.os}}-${{matrix.compiler}}-${{matrix.qt}} + + - name: (Linux/macOS) check ccache stats prior to build + if: runner.os == 'Linux' || runner.os == 'macOS' + run: ccache --zero-stats --show-stats + + - name: "Add GCC problem matcher" + if: runner.os == 'Linux' + uses: ammaraskar/gcc-problem-matcher@master + + - name: "βš™οΈ Install Qt Version ${{ env.QT_VERSION }}" + uses: jurplel/install-qt-action@v4 + with: + version: ${{ env.QT_VERSION }} + # host: ${{ runner.os }} + target: ${{ env.QT_TARGET }} + arch: ${{ matrix.config.qt_arch }} + dir: "${{ github.workspace }}/build/" + install-deps: "true" + # modules: 'qtcharts qtwebengine' + cached: "${{ steps.cache-qt.outputs.cache-hit }}" + setup-python: "true" + # tools: "tools_ifw" + set-env: "true" + + - name: "Cleanup Conan system packages (they are not properly cached)" + run: | + conan remove -f '*/system' + + - name: "Create Build Environment" + # Some projects don't allow in-source building, so create a separate build directory + # We'll use this as our working directory for all subsequent commands + run: cmake -E make_directory build + + # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage + # has meaningful results + - name: "βš™οΈ 🧊 Configure CMake" + if: runner.os == 'Windows' + working-directory: build + shell: pwsh + run: | + cmake ` + -S .. -B . ` + -G "${{matrix.generators}}" ` + -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} ` + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" ` + -DBUILD_SHARED_LIBS:BOOL="TRUE" + # -G "Visual Studio 16 2019" -A "x64" ` + # make sure coverage is only enabled for Debug builds, since it sets -O0 to make sure coverage + # has meaningful results. + + - name: "βš™οΈ 🐧 Configure CMake" + if: runner.os == 'Linux' + working-directory: build + shell: bash + run: |+ + cmake -S .. -B . -G "${{matrix.generator}}" \ + -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/AppDir/usr" \ + -DBUILD_SHARED_LIBS:BOOL="TRUE" \ + -DENABLE_CACHE="ON" + + - name: "βš™οΈ 🍎 Configure CMake" + working-directory: build + shell: bash + if: runner.os == 'macOS' + run: |+ + cmake -S .. -B . -G "${{matrix.generator}}" \ + -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \ + -DCMAKE_INSTALL_PREFIX:PATH="${{github.workspace}}/install" \ + -DBUILD_SHARED_LIBS:BOOL="TRUE" \ + -DENABLE_CACHE="ON" + + # TODO: Stored in install. Build DMG with CPack + - name: "πŸ“¦ 🍎 Build and package application (macdeployqt and zipfile)" + working-directory: build + if: runner.os == 'macOS' + run: | + cmake --build . --config ${{matrix.build_type}} + cpack -C "${{matrix.build_type}}" -G "DragNDrop;ZIP" + + # TODO: Stored in install. Build installer with CPack + - name: "βš™οΈ 🧊 Build" + if: runner.os == 'Windows' + working-directory: build + run: | + cmake --build . --config ${{matrix.build_type}} + cpack -C "${{matrix.build_type}}" -G "WIX;ZIP" + + - name: "βš™οΈ 🐧 Build" + if: runner.os == 'Linux' + working-directory: build + # Execute the build. You can specify a specific target with "--target " + run: | + sudo apt-get -y --no-install-recommends install tree + cmake --build . --config ${{matrix.build_type}} --target install + + - name: "βš™οΈ 🐧 Install go-appimage tool" + if: runner.os == 'Linux' + # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution, + # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340. + # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd. + run: | + wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool + chmod +x appimagetool + env: + APPIMAGETOOL_ARCH: x86_64 + + # TODO: Stored in build directory + - name: "🐧 πŸ“¦ Create AppImage" + if: runner.os == 'Linux' + shell: bash + run: | + APPIMAGE_DST_PATH="${{github.workspace}}/AppDir" + cd $GITHUB_WORKSPACE + cp $GITHUB_WORKSPACE/assets/icons/icons8-app-symbol-80.png $APPIMAGE_DST_PATH/io.github.jmuelbert.${TARGET_NAME}.png + $GITHUB_WORKSPACE/appimagetool -s deploy ${APPIMAGE_DST_PATH}/usr/share/applications/io.github.jmuelbert.${TARGET_NAME}.desktop + mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts + if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then + rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0 + fi + chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.* + $GITHUB_WORKSPACE/appimagetool ${APPIMAGE_DST_PATH} + + - name: "🐧 πŸ“€ Upload Linux artifacts" + if: runner.os == 'Linux' + uses: actions/upload-artifact@v4 + with: + name: AppImage + path: "./*.AppImage*" + + - name: "🍎 πŸ“€ Upload macOS artifacts" + if: runner.os == 'macOS' + uses: actions/upload-artifact@v4 + with: + name: macos-artifacts + path: | + build/*.dmg + build/*.zip + + - name: "🧊 πŸ“€ Upload artifact: Windows Installer" + if: runner.os == 'Windows' + uses: actions/upload-artifact@v4 + with: + name: windows-artifacts + path: | + build/*.msi + build/*.zip + + flatpak-build: + name: "🐧 Build flatpak on ubuntu-latest" + runs-on: ubuntu-latest + needs: tests + + permissions: + actions: read + contents: read + security-events: write + + steps: + - name: "βš™οΈ Get the version" + id: get_version + shell: bash + run: echo ::set-output name=VERSION::"$(echo $GITHUB_REF | cut -d / -f 3)" + + - name: "Cancel Previous Runs" + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: "🧰 Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "Setup Flatpak" + run: | + sudo apt-get -y -qq update + sudo apt-get install -y flatpak flatpak-builder + + - name: "Setup Flatpak" + run: | + sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive \ + apt-get --no-install-recommends --assume-yes install \ + flatpak flatpak-builder elfutils + + - name: "Setup Flathub" + run: | + flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + + - name: "πŸ“¦ Create flatpak" + run: | + mkdir -pv $GITHUB_WORKSPACE/install + BUNDLE="io.github.jmuelbert.${{env.TARGET_NAME}}.flatpak" + MANIFEST_PATH=$GITHUB_WORKSPACE/deploy/flatpak.yaml + RUNTIME_REPO="https://flathub.org/repo/flathub.flatpakrepo" + APP_ID="io.github.jmuelbert.${{env.TARGET_NAME}}" + + flatpak-builder --user --disable-rofiles-fuse --repo=repo --force-clean flatpak_app ${MANIFEST_PATH} --install-deps-from=flathub + flatpak build-bundle repo ${BUNDLE} --runtime-repo=${RUNTIME_REPO} ${APP_ID} + mv $GITHUB_WORKSPACE/$BUNDLE $GITHUB_WORKSPACE/io.github.jmuelbert.${{env.TARGET_NAME}}_${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak + ls -al + + - name: "πŸ“€ Upload artifact: FlatPak" + uses: actions/upload-artifact@v4 + with: + name: flatpak-artifact + path: | + ./install/*.flatpak + + snap-build: + name: "🐧 Build snap on ubuntu-20.04" + runs-on: ubuntu-20.04 + needs: tests + + steps: + - name: "βš™οΈ Get the version" + id: get_version + shell: bash + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + + - name: "Cancel Previous Runs" + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: "🧰 Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "πŸ“¦ Create snap" + uses: snapcore/action-build@v1 + id: snapcraft + with: + snapcraft-args: --enable-experimental-extensions + + - name: "Rename snap name" + shell: bash + run: | + mv ${{ steps.snapcraft.outputs.snap }} $GITHUB_WORKSPACE/${TARGET_NAME}_${{ steps.get_version.outputs.VERSION }}_amd64.snap + ls + + - name: "🐧 πŸ“€ Upload artifact: SnapPack" + uses: actions/upload-artifact@v4 + with: + name: snapcraft-artifact + path: | + $GITHUB_WORKSPACE/${{ env.TARGET_NAME}}_*_amd64.snap + + diagram: + name: "Build diagram" + needs: tests + runs-on: ubuntu-latest + + steps: + - name: "🧰 Checkout" + uses: actions/checkout@master + + - name: "Update diagram" + uses: githubocto/repo-visualizer@0.9.1 + with: + output_file: "images/diagram.svg" + excluded_paths: "dist,node_modules" + + releaseNotes: + # if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: upload + steps: + - name: "🧰 Checkout" + uses: actions/checkout@v4 + with: + # Full git history is needed to get a proper list of changed files within `super-linter` + fetch-depth: 0 + + - name: "Build Releasenotes" + id: github_releasenotes + uses: release-drafter/release-drafter@v5.25.0 + with: + publish: "${{ steps.check-version.outputs.tag != '' }}" + tag: "${{ steps.check-version.outputs.tag }}" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + changeLog: + # if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + needs: upload + steps: + - name: Build Changelog + id: github_release + uses: mikepenz/release-changelog-builder-action@v4 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Release + uses: mikepenz/action-gh-release@v0.2.0-a03 #softprops/action-gh-release + with: + body: ${{steps.github_release.outputs.changelog}} + + # Upload continous build + upload: + name: "πŸ—‚ Create release and upload artifacts" + needs: + - build + - flatpak-build + - snap-build + + runs-on: ubuntu-latest + steps: + - name: "πŸ“₯ Download artifacts" + uses: actions/download-artifact@v4 + - name: "πŸ—‚ Inspect directory after downloading artifacts" + run: ls -alFR + + - name: "πŸ“€ Upload Release: AppImage" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.appimage + asset_name: ${{env.TARGET_NAME}}.appimage + tag: ${{ github.ref }} + overwrite: true + + - name: "πŸ“€ Upload Release: FlatPak" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.flatpak + asset_name: ${{env.TARGET_NAME}}.flatpak + tag: ${{ github.ref }} + overwrite: true + + - name: "πŸ“€ Upload Release: snap" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.amd64.snap + asset_name: ${{env.TARGET_NAME}}.amd64.snap + tag: ${{ github.ref }} + overwrite: true + + - name: "πŸ“€ Upload Release: macOS" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{runner.workspace}}/${{env.TARGET_NAME}}.dmg + asset_name: ${{env.TARGET_NAME}}.dmg + tag: ${{ github.ref }} + overwrite: true + + - name: "πŸ“€ Upload Release: windows" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./${{ env.TARGET_NAME }}.exe + asset_name: ${{ env.TARGET_NAME}}-win.exe + tag: ${{ github.ref }} + overwrite: true + + - name: "πŸ“€ Upload Release: zip for windows" + if: startsWith(github.event.ref, 'refs/tags/') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./${{ env.archiveName }}-win.zip + asset_name: ${{ env.TARGET_NAME}}-win-${{ steps.get_version.outputs.VERSION }}.zip + tag: ${{ github.ref }} + overwrite: true From a80ee1d340e418b7177c192e6ec4cc4fe2a22467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 10:52:52 +0100 Subject: [PATCH 02/22] feat: complete the build-nix wf a little bit --- .github/workflows/appstream-util-validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/appstream-util-validate.yml b/.github/workflows/appstream-util-validate.yml index 59411ba02..659dd695a 100644 --- a/.github/workflows/appstream-util-validate.yml +++ b/.github/workflows/appstream-util-validate.yml @@ -1,14 +1,14 @@ name: Validate MetaInfo "on": pull_request: - branches: [main] + branches: [main, add_nix_support] paths: - '**.nix' - .github/workflows/appstream-util-validate.yaml - flake.lock - packaging/com.jwillikers.CyrillicEncoder.metainfo.xml push: - branches: [main] + branches: [main, add_nix_support] paths: - '**.nix' - .github/workflows/appstream-util-validate.yaml From 9e6f188d6a947b387f4dbe671064ca4cef11d62a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 10:58:51 +0100 Subject: [PATCH 03/22] fix; rename build-nix to ci-nix --- .github/workflows/ci-nix.yml | 86 ++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 .github/workflows/ci-nix.yml diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml new file mode 100644 index 000000000..fd42665d2 --- /dev/null +++ b/.github/workflows/ci-nix.yml @@ -0,0 +1,86 @@ +--- +name:Build + +on: + pull_request: + branches: [main, add_nix_support] + paths: + - '**.cmake' + - '**.cpp' + - '*+.hpp' + - '**.hpp.in' + - '**.h' + - '**.h.in' + - '**/CMakeLists.txt' + - .clang.tidy + - .github/workflow/ci-nix.yml + - CMakePresets.json + - flake.lock + - iwyu.imp + - packaging/com.jmuelbert.jmbde-QT.desktop + - packaging/com.jmuelbert.jmbde-QT.metainfo.yml + - packaging/com.jmuelbert.jmbde-QT.svg + - packaging/com.jmuelbert.jmbde-QT.yaml + + + push: + branches: [main, add_nix_support] + paths: + - '**.cmake' + - '**.cpp' + - '*+.hpp' + - '**.hpp.in' + - '**.h' + - '**.h.in' + - '**/CMakeLists.txt' + - .clang.tidy + - .github/workflow/ci-nix.yml + - CMakePresets.json + - flake.lock + - iwyu.imp + - packaging/com.jmuelbert.jmbde-QT.desktop + - packaging/com.jmuelbert.jmbde-QT.metainfo.yml + - packaging/com.jmuelbert.jmbde-QT.svg + - packaging/com.jmuelbert.jmbde-QT.yaml + + workflow_dispatch: + +jobs: + build: + strategy: + fail-fast: true + matrix: + compiler: [clang, gcc] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Restore ccache cache + id: cache-ccache-restore + uses: actions/cache/restore@v4 + with: + key: coverage-${{ matrix.compiler }}-ccache- + path: .ccache + - name: Build + run: nix develop --command just workflow ci-${{ matrix.compiler }} + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::echo timestamp=${current_date}") + - name: Save ccache cache + uses: actions/cache/save@v4 + if: always() && steps.cache-ccache-restore.outputs.cache-hit != 'true' + with: + key: coverage-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + path: .ccache + package-nix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Build the Nix package + run: nix build From 2579eeee0c0110bfcb169503662464f26d4479c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 11:00:51 +0100 Subject: [PATCH 04/22] fix; syntax issue in ci-nix --- .github/workflows/ci-nix.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index fd42665d2..842542d79 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -1,13 +1,11 @@ ---- -name:Build - +name: Build on: pull_request: branches: [main, add_nix_support] paths: - '**.cmake' - '**.cpp' - - '*+.hpp' + - '**.hpp' - '**.hpp.in' - '**.h' - '**.h.in' @@ -21,14 +19,12 @@ on: - packaging/com.jmuelbert.jmbde-QT.metainfo.yml - packaging/com.jmuelbert.jmbde-QT.svg - packaging/com.jmuelbert.jmbde-QT.yaml - - push: branches: [main, add_nix_support] paths: - '**.cmake' - '**.cpp' - - '*+.hpp' + - '**.hpp' - '**.hpp.in' - '**.h' - '**.h.in' @@ -42,9 +38,7 @@ on: - packaging/com.jmuelbert.jmbde-QT.metainfo.yml - packaging/com.jmuelbert.jmbde-QT.svg - packaging/com.jmuelbert.jmbde-QT.yaml - workflow_dispatch: - jobs: build: strategy: @@ -83,4 +77,4 @@ jobs: - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Build the Nix package - run: nix build + 'run': nix build From f8b57dcb1b5e54d7c49e13fc756854b8c35e1658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 11:05:01 +0100 Subject: [PATCH 05/22] fix; syntax issue in ci-nix --- .github/workflows/ci-nix.yml | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 842542d79..65d4a93b3 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -78,3 +78,52 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Build the Nix package 'run': nix build + coverage: + permissions: + pull-requests: write + strategy: + matrix: + compiler: [clang] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Restore ccache cache + id: cache-ccache-restore + uses: actions/cache/restore@v4 + with: + key: coverage-${{ matrix.compiler }}-ccache- + path: .ccache + - name: Generate Coverage + run: nix develop --command just workflow coverage-${{ matrix.compiler }} + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::echo timestamp=${current_date}") + - name: Save ccache cache + uses: actions/cache/save@v4 + if: always() && steps.cache-ccache-restore.outputs.cache-hit != 'true' + with: + key: coverage-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + path: .ccache + - name: Code Coverage Report + uses: clearlyip/code-coverage-report-action@v5 + id: code_coverage_report_action + with: + artifact_download_workflow_names: "build,schedule" + badge: true + fail_on_negative_difference: true + file_coverage_error_min: 40 + file_coverage_warning_max: 60 + filename: build-coverage-${{ matrix.compiler }}/cobertura.xml + overall_coverage_fail_threshold: 60 + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }} + recreate: true + path: code-coverage-results.md From 3d9309c2751ec46537c0c49c4e46274ecc3cc569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 11:13:23 +0100 Subject: [PATCH 06/22] Fix:issue on ci-nix.yml --- .github/workflows/ci-nix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 65d4a93b3..9e6c66d5a 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -113,7 +113,7 @@ jobs: uses: clearlyip/code-coverage-report-action@v5 id: code_coverage_report_action with: - artifact_download_workflow_names: "build,schedule" + artifact_download_workflow_names: build,schedule badge: true fail_on_negative_difference: true file_coverage_error_min: 40 From 7a1d1f6159ad47d6763d43f9d04bc2521f398580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 11:18:18 +0100 Subject: [PATCH 07/22] feat: add nix.yml --- .github/workflows/ci-nix.yml | 129 ----------------------------------- 1 file changed, 129 deletions(-) delete mode 100644 .github/workflows/ci-nix.yml diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml deleted file mode 100644 index 9e6c66d5a..000000000 --- a/.github/workflows/ci-nix.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: Build -on: - pull_request: - branches: [main, add_nix_support] - paths: - - '**.cmake' - - '**.cpp' - - '**.hpp' - - '**.hpp.in' - - '**.h' - - '**.h.in' - - '**/CMakeLists.txt' - - .clang.tidy - - .github/workflow/ci-nix.yml - - CMakePresets.json - - flake.lock - - iwyu.imp - - packaging/com.jmuelbert.jmbde-QT.desktop - - packaging/com.jmuelbert.jmbde-QT.metainfo.yml - - packaging/com.jmuelbert.jmbde-QT.svg - - packaging/com.jmuelbert.jmbde-QT.yaml - push: - branches: [main, add_nix_support] - paths: - - '**.cmake' - - '**.cpp' - - '**.hpp' - - '**.hpp.in' - - '**.h' - - '**.h.in' - - '**/CMakeLists.txt' - - .clang.tidy - - .github/workflow/ci-nix.yml - - CMakePresets.json - - flake.lock - - iwyu.imp - - packaging/com.jmuelbert.jmbde-QT.desktop - - packaging/com.jmuelbert.jmbde-QT.metainfo.yml - - packaging/com.jmuelbert.jmbde-QT.svg - - packaging/com.jmuelbert.jmbde-QT.yaml - workflow_dispatch: -jobs: - build: - strategy: - fail-fast: true - matrix: - compiler: [clang, gcc] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v14 - - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Restore ccache cache - id: cache-ccache-restore - uses: actions/cache/restore@v4 - with: - key: coverage-${{ matrix.compiler }}-ccache- - path: .ccache - - name: Build - run: nix develop --command just workflow ci-${{ matrix.compiler }} - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - message("::echo timestamp=${current_date}") - - name: Save ccache cache - uses: actions/cache/save@v4 - if: always() && steps.cache-ccache-restore.outputs.cache-hit != 'true' - with: - key: coverage-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - path: .ccache - package-nix: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v14 - - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Build the Nix package - 'run': nix build - coverage: - permissions: - pull-requests: write - strategy: - matrix: - compiler: [clang] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v14 - - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Restore ccache cache - id: cache-ccache-restore - uses: actions/cache/restore@v4 - with: - key: coverage-${{ matrix.compiler }}-ccache- - path: .ccache - - name: Generate Coverage - run: nix develop --command just workflow coverage-${{ matrix.compiler }} - - name: Prepare ccache timestamp - id: ccache_cache_timestamp - shell: cmake -P {0} - run: | - string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) - message("::echo timestamp=${current_date}") - - name: Save ccache cache - uses: actions/cache/save@v4 - if: always() && steps.cache-ccache-restore.outputs.cache-hit != 'true' - with: - key: coverage-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} - path: .ccache - - name: Code Coverage Report - uses: clearlyip/code-coverage-report-action@v5 - id: code_coverage_report_action - with: - artifact_download_workflow_names: build,schedule - badge: true - fail_on_negative_difference: true - file_coverage_error_min: 40 - file_coverage_warning_max: 60 - filename: build-coverage-${{ matrix.compiler }}/cobertura.xml - overall_coverage_fail_threshold: 60 - - name: Add Coverage PR Comment - uses: marocchino/sticky-pull-request-comment@v2 - if: github.event_name == 'pull_request' - with: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }} - recreate: true - path: code-coverage-results.md From 80f8086b100ee77b061eb675598b122c500f3e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Tue, 5 Nov 2024 11:29:02 +0100 Subject: [PATCH 08/22] feat: add ci-nix.yml --- .github/workflows/ci-nix.yml | 129 +++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 .github/workflows/ci-nix.yml diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml new file mode 100644 index 000000000..9e6c66d5a --- /dev/null +++ b/.github/workflows/ci-nix.yml @@ -0,0 +1,129 @@ +name: Build +on: + pull_request: + branches: [main, add_nix_support] + paths: + - '**.cmake' + - '**.cpp' + - '**.hpp' + - '**.hpp.in' + - '**.h' + - '**.h.in' + - '**/CMakeLists.txt' + - .clang.tidy + - .github/workflow/ci-nix.yml + - CMakePresets.json + - flake.lock + - iwyu.imp + - packaging/com.jmuelbert.jmbde-QT.desktop + - packaging/com.jmuelbert.jmbde-QT.metainfo.yml + - packaging/com.jmuelbert.jmbde-QT.svg + - packaging/com.jmuelbert.jmbde-QT.yaml + push: + branches: [main, add_nix_support] + paths: + - '**.cmake' + - '**.cpp' + - '**.hpp' + - '**.hpp.in' + - '**.h' + - '**.h.in' + - '**/CMakeLists.txt' + - .clang.tidy + - .github/workflow/ci-nix.yml + - CMakePresets.json + - flake.lock + - iwyu.imp + - packaging/com.jmuelbert.jmbde-QT.desktop + - packaging/com.jmuelbert.jmbde-QT.metainfo.yml + - packaging/com.jmuelbert.jmbde-QT.svg + - packaging/com.jmuelbert.jmbde-QT.yaml + workflow_dispatch: +jobs: + build: + strategy: + fail-fast: true + matrix: + compiler: [clang, gcc] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Restore ccache cache + id: cache-ccache-restore + uses: actions/cache/restore@v4 + with: + key: coverage-${{ matrix.compiler }}-ccache- + path: .ccache + - name: Build + run: nix develop --command just workflow ci-${{ matrix.compiler }} + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::echo timestamp=${current_date}") + - name: Save ccache cache + uses: actions/cache/save@v4 + if: always() && steps.cache-ccache-restore.outputs.cache-hit != 'true' + with: + key: coverage-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + path: .ccache + package-nix: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Build the Nix package + 'run': nix build + coverage: + permissions: + pull-requests: write + strategy: + matrix: + compiler: [clang] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Restore ccache cache + id: cache-ccache-restore + uses: actions/cache/restore@v4 + with: + key: coverage-${{ matrix.compiler }}-ccache- + path: .ccache + - name: Generate Coverage + run: nix develop --command just workflow coverage-${{ matrix.compiler }} + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::echo timestamp=${current_date}") + - name: Save ccache cache + uses: actions/cache/save@v4 + if: always() && steps.cache-ccache-restore.outputs.cache-hit != 'true' + with: + key: coverage-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + path: .ccache + - name: Code Coverage Report + uses: clearlyip/code-coverage-report-action@v5 + id: code_coverage_report_action + with: + artifact_download_workflow_names: build,schedule + badge: true + fail_on_negative_difference: true + file_coverage_error_min: 40 + file_coverage_warning_max: 60 + filename: build-coverage-${{ matrix.compiler }}/cobertura.xml + overall_coverage_fail_threshold: 60 + - name: Add Coverage PR Comment + uses: marocchino/sticky-pull-request-comment@v2 + if: github.event_name == 'pull_request' + with: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }} + recreate: true + path: code-coverage-results.md From 4e526deaef5537942ac08aa6bec70932b5e3b158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Thu, 7 Nov 2024 10:01:46 +0100 Subject: [PATCH 09/22] chores : update packaging --- packaging/conanfile.py | 73 ------------------- packaging/flatpak/org.jmuelbert.jmbde-QT.yml | 32 -------- packaging/linux/BUILDVERSION | 1 - packaging/linux/CMakeLists.txt | 62 ++++++++++++++++ packaging/linux/VERSION | 1 - packaging/linux/com.jmuelbert.jmbde.desktop | 10 +++ ...o.xml => com.jmuelbert.jmbde.metainfo.xml} | 35 ++++++--- ...{VERSIONSUFFIX => com.jmuelbert.jmbde.svg} | 0 packaging/linux/com.jmuelbert.jmbde.ymal | 45 ++++++++++++ packaging/linux/cpackGeneratorOverrides.cmake | 3 + packaging/linux/jmbde | 6 -- packaging/linux/qt.conf | 4 - screenshots/.gitkeep | 0 13 files changed, 143 insertions(+), 129 deletions(-) delete mode 100644 packaging/conanfile.py delete mode 100644 packaging/flatpak/org.jmuelbert.jmbde-QT.yml delete mode 100644 packaging/linux/BUILDVERSION create mode 100644 packaging/linux/CMakeLists.txt delete mode 100644 packaging/linux/VERSION create mode 100644 packaging/linux/com.jmuelbert.jmbde.desktop rename packaging/linux/{org.jmuelbert.jmbde.metainfo.xml => com.jmuelbert.jmbde.metainfo.xml} (50%) rename packaging/linux/{VERSIONSUFFIX => com.jmuelbert.jmbde.svg} (100%) create mode 100644 packaging/linux/com.jmuelbert.jmbde.ymal create mode 100644 packaging/linux/cpackGeneratorOverrides.cmake delete mode 100755 packaging/linux/jmbde delete mode 100644 packaging/linux/qt.conf create mode 100644 screenshots/.gitkeep diff --git a/packaging/conanfile.py b/packaging/conanfile.py deleted file mode 100644 index c59e0cbf2..000000000 --- a/packaging/conanfile.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- -# -# SPDX-FileCopyrightText: 2013-2021 JΓΌrgen MΓΌlbert -# -# SPDX-License-Identifier: GPL-3.0-or-later -# - -from conans import CMake, ConanFile - - -class jmbdeConan(ConanFile): - name = "jmbde" - version = "0.6.0" - settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package" - build_policy = "missing" - url = "https://github.com/jmuelbert/jmbde-QT" - license = "GPL V3+" - author = "JΓΌrgen MΓΌlbert" - description = "A BDE Tool" - topics = ("bde", "collect-data", "database", "qt", "qt6", "conan", "cmake", "c++") - generators = "cmake" - - options = {"testing": [True, False]} - default_options = {"testing": False} - build_policy = "missing" - - def build_requirements(self): - self.build_requires("extra-cmake-modules/5.84.0") - self.build_requires("catch2/2.13.8") - self.build_requires("fmt/6.2.1") - self.build_requires("spdlog/1.5.0") - self.build_requires("qt/6.2.1") - - def requirements(self): - if self.options.testing: - self.requires("gtest/cci.20210126") - self.requires("benchmark/1.6.0") - - def export_sources(self): - self.copy("*") - - def _configure_cmake(self): - cmake = CMake(self) - # cmake.definitions["SOME_DEFINITION"] = "VALUE" - cmake.configure() - return cmake - - def build(self): - cmake = self._configure_cmake() - cmake.build() - - def package(self): - cmake = self._configure_cmake() - cmake.install() - - def package_info(self): - # self.cpp_info.includedirs = ['include'] # Ordered list of include paths - # self.cpp_info.libs = ['dena_library'] # The libs to link against - # self.cpp_info.system_libs = [] # System libs to link against - # self.cpp_info.libdirs = ['lib'] # Directories where libraries can be found - # self.cpp_info.resdirs = ['res'] # Directories where resources, data, etc. can be found - # Directories where executables and shared libs can be found - self.cpp_info.bindirs = ["bin"] - # self.cpp_info.srcdirs = [] # Directories where sources can be found (debugging, reusing sources) - # self.cpp_info.build_modules = {} # Build system utility module files - # self.cpp_info.defines = [] # preprocessor definitions - # self.cpp_info.cflags = [] # pure C flags - # self.cpp_info.cxxflags = [] # C++ compilation flags - # self.cpp_info.sharedlinkflags = [] # linker flags - # self.cpp_info.exelinkflags = [] # linker flags - # self.cpp_info.components # Dictionary with the different components a package may have - # self.cpp_info.requires = None # List of components from requirements diff --git a/packaging/flatpak/org.jmuelbert.jmbde-QT.yml b/packaging/flatpak/org.jmuelbert.jmbde-QT.yml deleted file mode 100644 index 376bc0945..000000000 --- a/packaging/flatpak/org.jmuelbert.jmbde-QT.yml +++ /dev/null @@ -1,32 +0,0 @@ ---- -app-id: org.jmuelbert.jmbde_QT -runtime: org.kde.Platform -runtime-version: '5.15' -sdk: org.kde.Sdk -command: jmbde -finish-args: - # X11 + XShm access - - --share=ipc - - --socket=x11 - # Wayland access - - --socket=wayland - - --device=dri - # Connectivity - - --share=network - # QtSingleApplication, allow other instances to see log files - - --env=TMPDIR=/var/tmp - # Allow loading/saving files from anywhere - - --filesystem=host - # Notification access - - --talk-name=org.freedesktop.Notifications - # System Tray Icon - -modules: - - name: jmbde - buildsystem: cmake-ninja - config-opts: - - -DCMAKE_BUILD_TYPE=Release - - -DLGTM=ON - sources: - - type: dir - path: ../.. diff --git a/packaging/linux/BUILDVERSION b/packaging/linux/BUILDVERSION deleted file mode 100644 index d00491fd7..000000000 --- a/packaging/linux/BUILDVERSION +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/packaging/linux/CMakeLists.txt b/packaging/linux/CMakeLists.txt new file mode 100644 index 000000000..a0c7777e3 --- /dev/null +++ b/packaging/linux/CMakeLists.txt @@ -0,0 +1,62 @@ +install( + FILES com.jmuelbert.jmbde.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/applications/ + COMPONENT jmbde_Flatpak +) +install( + FILES com.jmuelbert.jmbde.metainfo.xml + DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo + COMPONENT jmbde_Flatpak +) +install( + FILES com.jmuelbert.jmbde.svg + DESTINATION $(CMAKE_INSTALL_DATADIR)/icons/hicolor/scalable/apps/ + COMPONENT jmbde_Flatpak +) + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(CPACK_GENERATOR "ZIP") +else() + set(CPACK_GENERATOR "TZST") +endif() + +set(CPACK_COMPONENTS_ALL jmbde_Runtime jmbde_Development) +set(CPACK_ARCHIV_COMPONENT_INSTALL yes) +set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) + +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) + +set(CPACK_PACKAGE_NAME jmbde) +set(CPACK_PACKAGE_VENDOR "JΓΌrgen MΓΌlbert") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The jmbde (QT) application") +set(CPACK_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) +set(CPACK_FILE_NAME + jmbde-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}-${CPACK_PACKAGE_VERSION_PATCH}) +set(CPACK_PROJECT_CONFIG_FILE ${CMAKE__CURRENT_LIST_DIR}/cpackGeneratorOverride.cmake) +set(CPACK_STRIP_FILES yes) +set(CPACK_THREADS 0) +set(CPACK_VERBATIM_VARIABLES yes) + +set(CPACK_SOURCE_IGNORE_FILES /\\.git/ \\.swp \\.orig /CMakeLists\\.txt\\.user /build/) + +include(CPack) + +cpack_add_component( + jmbde_Runtime + DISPLAY_NAME Runtime + DESCRIPTION "Shared libraries and executables" + REQUIRED + INSTALL_TYPES Full Developer Minimal) +) +cpack_add_component( + jmbde_Development + DISPLAY_NAME "Developer pre-requisites" + DESCRIPTION "Headers/static libs needed for building" + INSTALL_TYPES Full Developer +) + +cpack_add_install_type(Full) +cpack_add_install_type(Minimal) +cpack_add_install_type(Developer) diff --git a/packaging/linux/VERSION b/packaging/linux/VERSION deleted file mode 100644 index 7d8568351..000000000 --- a/packaging/linux/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.5.4 diff --git a/packaging/linux/com.jmuelbert.jmbde.desktop b/packaging/linux/com.jmuelbert.jmbde.desktop new file mode 100644 index 000000000..147827c04 --- /dev/null +++ b/packaging/linux/com.jmuelbert.jmbde.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=jmbde +Exec=/app/bin/jmbde +Comment=Add Persons and devices to a company database +Icon=com.jmuelbert.jmbde +StartupWMClass=jmbde +Terminal=false +Categories=Business;Qt +Keywords=jmbde;business diff --git a/packaging/linux/org.jmuelbert.jmbde.metainfo.xml b/packaging/linux/com.jmuelbert.jmbde.metainfo.xml similarity index 50% rename from packaging/linux/org.jmuelbert.jmbde.metainfo.xml rename to packaging/linux/com.jmuelbert.jmbde.metainfo.xml index 2c507f662..f0c09f94b 100644 --- a/packaging/linux/org.jmuelbert.jmbde.metainfo.xml +++ b/packaging/linux/com.jmuelbert.jmbde.metainfo.xml @@ -4,27 +4,38 @@ SPDX-FileCopyrightText: none SPDX-License-Identifier: CC0-1.0 --> - org.jmuelbert.jmbde + com.jmuelbert.jmbde CC0-1.0 GPL-3.0-or-later + jmbde - - - - - Simply BDE + + JΓΌrgen MΓΌlbert + + juergen.muelbert@outlook.de

Collect data of a company. Computers, Printer and Phones

- - jmbde + com.jmuelbert.jmbde.desktop + https://github.com/jmuelbert/jmbde-QT/Γ­ssues + https://github.com/jmuelbert/jmbde-QT + https://github.com/jmuelbert/jmbde-QT - https://github.com/jmuelbert/jmbde-QT - https://github.com/jmuelbert/jmbde-QT/issues/new - org.jmuelbert.jmbde.desktop + + + +

Initial Release

+
+ + +
+ jmbde
diff --git a/packaging/linux/VERSIONSUFFIX b/packaging/linux/com.jmuelbert.jmbde.svg similarity index 100% rename from packaging/linux/VERSIONSUFFIX rename to packaging/linux/com.jmuelbert.jmbde.svg diff --git a/packaging/linux/com.jmuelbert.jmbde.ymal b/packaging/linux/com.jmuelbert.jmbde.ymal new file mode 100644 index 000000000..04e86d6a8 --- /dev/null +++ b/packaging/linux/com.jmuelbert.jmbde.ymal @@ -0,0 +1,45 @@ +id: com.jmuelbert.jmbde +runtime: org.kde.Platform +runtime-version: '6.7' +sdk: org.kde.Sdk +command: jmbde +finish-args: + - --socket=wayland +modules: + - name: microsoft-gsl + buildsystem: cmake-ninja + config-opts: + - -DGSL_TEST=no + cleanup: + - '*' + sources: + - type: git + url: https://github.com/microsoft/GSL.git + commit: a3534567187d2edc428efd3f13466ff75fe5805c + tag: v4.0.0 + x-checker-data: + type: git + tag-pattern: "^v([\\d.]+)$" + - name: jmbde + buildsystem: simple + buildcommands: + - cmake --workflow --preset flatpak + - cmake --install build --component jmbde_Runtime --prefix="${FLATPAK_DEST}" + - cmake --instsll build --component jmbde_Flatpak --prefix="${FLATPAK_DEST}" + sources: + - type: dir + path: .. + skip: + - .cache + - .direnv + - .github + - .vscode + - build + - build-clang + - build-gcc + - build-coverage-clang + - build-dir + - repo + + + diff --git a/packaging/linux/cpackGeneratorOverrides.cmake b/packaging/linux/cpackGeneratorOverrides.cmake new file mode 100644 index 000000000..454dbeac9 --- /dev/null +++ b/packaging/linux/cpackGeneratorOverrides.cmake @@ -0,0 +1,3 @@ +if(CPACK_GENERATOR MATCHES "^(7Z|TBZ2|TGZ|TXZ|TZ|TZST|ZIP)$") + set(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY YES) +endif() diff --git a/packaging/linux/jmbde b/packaging/linux/jmbde deleted file mode 100755 index d1ad69a1c..000000000 --- a/packaging/linux/jmbde +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -export LD_LIBRARY_PATH=/usr/lib/jmbde:$LD_LIBRARY_PATH -export QT_PLUGIN_PATH=/usr/share/jmbde/plugins/:$QT_PLUGIN_PATH -export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/share/jmbde/plugins/platforms:$QT_QPA_PLATFORM_PLUGIN_PATH - -"/usr/share/jmbde/bin/jmbde" "$@" diff --git a/packaging/linux/qt.conf b/packaging/linux/qt.conf deleted file mode 100644 index f502cfd16..000000000 --- a/packaging/linux/qt.conf +++ /dev/null @@ -1,4 +0,0 @@ -[Paths] -Libraries = lib -Plugins = plugins -Translations = translations diff --git a/screenshots/.gitkeep b/screenshots/.gitkeep new file mode 100644 index 000000000..e69de29bb From e338b685edb3531da58b849bf560e6b4e8e0eef8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Thu, 7 Nov 2024 10:09:22 +0100 Subject: [PATCH 10/22] fix: appstream-util workflow --- .github/workflows/appstream-util-validate.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/appstream-util-validate.yml b/.github/workflows/appstream-util-validate.yml index 659dd695a..7791742ba 100644 --- a/.github/workflows/appstream-util-validate.yml +++ b/.github/workflows/appstream-util-validate.yml @@ -6,14 +6,14 @@ name: Validate MetaInfo - '**.nix' - .github/workflows/appstream-util-validate.yaml - flake.lock - - packaging/com.jwillikers.CyrillicEncoder.metainfo.xml + - packaging/linux/com.jmuelbert,jmbde.metainfo.xml push: branches: [main, add_nix_support] paths: - '**.nix' - .github/workflows/appstream-util-validate.yaml - flake.lock - - packaging/com.jwillikers.CyrillicEncoder.metainfo.xml + - packaging/linux/com.jmuelbert,jmbde.metainfo.xml jobs: appstream-util-validate: runs-on: ubuntu-latest @@ -22,4 +22,4 @@ jobs: - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Check the MetaInfo file - run: nix develop --command appstream-util validate packaging/co.jmuelbert.jmbde-QT.metainfo.xml + run: nix develop --command appstream-util validate packaging/com.jmuelbert.jmbde.metainfo.xml From 1dbadbc392c82e019adb8920bef9ab1c7606e3fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Fri, 8 Nov 2024 12:32:31 +0100 Subject: [PATCH 11/22] chore: Add packaging files and yamllint workflow. --- .github/workflows/ci-nix.yml | 8 +- .github/workflows/desktop-file-validate.yml | 0 .github/workflows/external-data-checker.yml | 0 .github/workflows/flake-checker.yml | 0 .github/workflows/link-checker.yml | 0 ".github/workflows/link-checker.ym\303\266" | 0 .github/workflows/lock-updater.yml | 0 .github/workflows/schedule.yaml | 0 .github/workflows/treefamt.yaml | 0 .github/workflows/update-nix-direnv.yaml | 0 .github/workflows/yamllint.yaml | 27 ++++++ flake.nix | 96 +++++++++++++++++++++ package.nix | 36 ++++++++ pre-commit-hooks.nix | 42 +++++++++ treefmt.nix | 30 +++++++ 15 files changed, 235 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/desktop-file-validate.yml create mode 100644 .github/workflows/external-data-checker.yml create mode 100644 .github/workflows/flake-checker.yml create mode 100644 .github/workflows/link-checker.yml create mode 100644 ".github/workflows/link-checker.ym\303\266" create mode 100644 .github/workflows/lock-updater.yml create mode 100644 .github/workflows/schedule.yaml create mode 100644 .github/workflows/treefamt.yaml create mode 100644 .github/workflows/update-nix-direnv.yaml create mode 100644 .github/workflows/yamllint.yaml create mode 100644 flake.nix create mode 100644 package.nix create mode 100644 pre-commit-hooks.nix create mode 100644 treefmt.nix diff --git a/.github/workflows/ci-nix.yml b/.github/workflows/ci-nix.yml index 9e6c66d5a..75b187a63 100644 --- a/.github/workflows/ci-nix.yml +++ b/.github/workflows/ci-nix.yml @@ -34,10 +34,10 @@ on: - CMakePresets.json - flake.lock - iwyu.imp - - packaging/com.jmuelbert.jmbde-QT.desktop - - packaging/com.jmuelbert.jmbde-QT.metainfo.yml - - packaging/com.jmuelbert.jmbde-QT.svg - - packaging/com.jmuelbert.jmbde-QT.yaml + - packaging/com.jmuelbert.jmbde.desktop + - packaging/com.jmuelbert.jmbde.metainfo.yml + - packaging/com.jmuelbert.jmbde.svg + - packaging/com.jmuelbert.jmbde.yaml workflow_dispatch: jobs: build: diff --git a/.github/workflows/desktop-file-validate.yml b/.github/workflows/desktop-file-validate.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/external-data-checker.yml b/.github/workflows/external-data-checker.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/flake-checker.yml b/.github/workflows/flake-checker.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml new file mode 100644 index 000000000..e69de29bb diff --git "a/.github/workflows/link-checker.ym\303\266" "b/.github/workflows/link-checker.ym\303\266" new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/lock-updater.yml b/.github/workflows/lock-updater.yml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/treefamt.yaml b/.github/workflows/treefamt.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/update-nix-direnv.yaml b/.github/workflows/update-nix-direnv.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml new file mode 100644 index 000000000..26e4c977f --- /dev/null +++ b/.github/workflows/yamllint.yaml @@ -0,0 +1,27 @@ +name: yamllint +"on": + pull_request: + branches: ["main"] + paths: + - '**.nix' + - '**.yaml' + - '**.yml' + - .github/workflows/yamllint.yaml + - flake.lock + push: + branches: ["main"] + paths: + - '**.nix' + - '**.yaml' + - '**.yml' + - .github/workflows/yamllint.yaml + - flake.lock +jobs: +yamllint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Check YAML files + run: nix develop --command yamllint --format github . diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..2d90d63a7 --- /dev/null +++ b/flake.nix @@ -0,0 +1,96 @@ +{ + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nix-update-scripts = { + url = "github:jwillikers/nix-update-scripts"; + inputs = { + flake-utils.follows = "flake-utils"; + nixpkgs.follows = "nixpkgs"; + nixpkgs-unstable.follows = "nixpkgs"; + pre-commit-hooks.follows = "pre-commit-hooks"; + treefmt-nix.follows = " treefmt-nix"; + }; + }; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + nixpkgs-stable.follows = "nixpkgs"; + }; + }; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + outputs = + { + # deadnix: skip + self + , nix-update-scripts + , nixpkgs + , flake-utils + , pre-commit-hooks + , treefmt-nix + , + }; + flake-utils.lib.eachDefaultSystem ( + system: + let + overlays = [ ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + pre-commit = pre-commit-hooks.lib.${system}.run ( + import ./pre-commit-hooks.nix { inherit pkgs treefmtEval; } + ); + treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt-nix; + in + with pkgs; + { + apps = { + inherit (pre-commit) shellHook; + buildInputs = with pkgs; [ + microsoft-gsl + qt6.qtbase + qt6.wayland + ut + ]; + nativeBuildInputs = + [ + appstream + appstream-glib + asciidoctor + ccache + clang + clang-tools + cmake + desktop-file-utils + fish + flatpak-builder + gdb + include-what-you-use + just + lonv + librsvg + lldb + llvm + lychee + mold-wrapped + nil + ninja + nushell + python311Packages.lcov-cobertura + qt6.wrapQtAppsHook + treefmtEcal.config.build.wrapper + (builtins.attrValues treefmtEval.config.build.programs) + ] + ++ pre-commit.enabledPackages; + }; + formatter = treefmtEval.config.build.wrapper; + packages.default = qt6Packages.callPackage ./package.nix { }; + } + + ); +} diff --git a/package.nix b/package.nix new file mode 100644 index 000000000..a38fc1619 --- /dev/null +++ b/package.nix @@ -0,0 +1,36 @@ +{ cmake +, microsoft-gsl +, modl-wrapped +, ninja +, qtbase +, qtwayland +, stdenv +, ut +, wrapQtAppsHook +, +}; +stdenv.mkDerivation = { +pname = "jmbde"; +version = "0.7.0"; + +src ) ./. + +buildInputs =[ +microsoft-gsl +qtbase +qtwayland +ut +]; + +nativeBuildInputs = [ +cmake +mold-wrapped +ninja +wrapQtAppsHook +]; + +cmakeFlags = [ +"--preset=minimal" +"-DCMAKE_LINKER_TYPE=MOLD" +]; +} diff --git a/pre-commit-hooks.nix b/pre-commit-hooks.nix new file mode 100644 index 000000000..23e0ad344 --- /dev/null +++ b/pre-commit-hooks.nix @@ -0,0 +1,42 @@ +{ pkgs, treefmtEval, ... }: +{ + src = ./.; + hooks = { + check-added-large-files.enable = true; + check-builtin-literals.enable = true; + check-case-conflicts.enable = true; + check-executables-have-shebangs.enable = true; + + # todo Not integrated with Nix? + check-format = { + enable = true; + entry = "${treefmtEval.config.build.wrapper}/bin/treefmt --fail-on-change"; + }; + + check-json.enable = true; + check-shebang-scripts-are-executable.enable = true; + check-toml.enable = true; + check-xml.enable = true; + check-yml.enable = true; + deadnix.enable = true; + detect-private-keys.enable = true; + editorconfig-checker.enable = true; + end-of-file-fixer.enable = true; + fix-byte-order-marker.enable = true; + flake-checker.enable = true; + forbid-new-submodules.enable = true; + mixed-line-endings.enable = true; + nil.enable = true; + + strip-location-metadata = { + name = "Strip location metadata"; + description = "Strip gelocation metadata from image files"; + enable = true; + entry = "${pkgs.exiftool}/bin/exiftool --duplicates --overwrite_original '-gps*='"; + package = pkgs.exiftool; + types = [ "image" ]; + }; + trim-trailing-whitespace.enable = true; + yamllint.enable = true; + }; +} diff --git a/treefmt.nix b/treefmt.nix new file mode 100644 index 000000000..d78221cc0 --- /dev/null +++ b/treefmt.nix @@ -0,0 +1,30 @@ +_: { + config = { + programs = { + actionlint.enable = true; + clang-format.enable = true; + cmake-format.enable = true; + jsonfmt.enable = true; + nixfmt.enable = true; + statix.enable = true; + taplo.enable = true; + typos.enable = true; + yamlfmt.enable = true; + }; + projectRootFile = "flake.nix"; + settings.formatter = { + typos.excludes = [ + "*.avif" + "*.bmp" + "*.gif" + "*.jpeg" + "*jpg" + "*.png" + "*.svg" + "*.tiff" + "*.webp" + ".vscode/settings.json" + ]; + }; + }; +} From 61f034b94f7d3982987f557e5782c8e42e6ad904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Fri, 8 Nov 2024 12:41:09 +0100 Subject: [PATCH 12/22] chore: Add update nix direnv workflow --- .github/workflows/update-nix-direnv.yaml | 25 +++++ .github/workflows/yamllint.yaml | 38 ++++---- flake.nix | 112 +++++++++++------------ 3 files changed, 100 insertions(+), 75 deletions(-) diff --git a/.github/workflows/update-nix-direnv.yaml b/.github/workflows/update-nix-direnv.yaml index e69de29bb..de205a388 100644 --- a/.github/workflows/update-nix-direnv.yaml +++ b/.github/workflows/update-nix-direnv.yaml @@ -0,0 +1,25 @@ +name: Update nix-direnv +"on": + schedule: + - cron: 0 0 16 * * + workflow_dispatch: +permissions: + contents: write + pull-requests: write +jobs: + update-nix-direnv: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Update nix-direnv to the latest version + run: nix run '.#update-nix-direnv' + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + assignees: ${{ github.repository_owner }} + branch: update/nix-direnv + commit-message: "chore(deps): Update nix-direnv" + title: "chore(deps): Update nix-direnv" + token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} diff --git a/.github/workflows/yamllint.yaml b/.github/workflows/yamllint.yaml index 26e4c977f..ca53528fe 100644 --- a/.github/workflows/yamllint.yaml +++ b/.github/workflows/yamllint.yaml @@ -1,27 +1,27 @@ name: yamllint "on": pull_request: - branches: ["main"] + branches: [main] paths: - - '**.nix' - - '**.yaml' - - '**.yml' - - .github/workflows/yamllint.yaml - - flake.lock + - '**.nix' + - '**.yaml' + - '**.yml' + - .github/workflows/yamllint.yaml + - flake.lock push: - branches: ["main"] + branches: [main] paths: - - '**.nix' - - '**.yaml' - - '**.yml' - - .github/workflows/yamllint.yaml - - flake.lock + - '**.nix' + - '**.yaml' + - '**.yml' + - .github/workflows/yamllint.yaml + - flake.lock jobs: -yamllint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v14 - - uses: DeterminateSystems/magic-nix-cache-action@v8 - - name: Check YAML files + yamllint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Check YAML files run: nix develop --command yamllint --format github . diff --git a/flake.nix b/flake.nix index 2d90d63a7..010fbe76d 100644 --- a/flake.nix +++ b/flake.nix @@ -34,63 +34,63 @@ , pre-commit-hooks , treefmt-nix , - }; + }: flake-utils.lib.eachDefaultSystem ( - system: - let - overlays = [ ]; - pkgs = import nixpkgs { - inherit system overlays; - }; - pre-commit = pre-commit-hooks.lib.${system}.run ( - import ./pre-commit-hooks.nix { inherit pkgs treefmtEval; } - ); - treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt-nix; - in - with pkgs; - { - apps = { - inherit (pre-commit) shellHook; - buildInputs = with pkgs; [ - microsoft-gsl - qt6.qtbase - qt6.wayland - ut - ]; - nativeBuildInputs = - [ - appstream - appstream-glib - asciidoctor - ccache - clang - clang-tools - cmake - desktop-file-utils - fish - flatpak-builder - gdb - include-what-you-use - just - lonv - librsvg - lldb - llvm - lychee - mold-wrapped - nil - ninja - nushell - python311Packages.lcov-cobertura - qt6.wrapQtAppsHook - treefmtEcal.config.build.wrapper - (builtins.attrValues treefmtEval.config.build.programs) - ] - ++ pre-commit.enabledPackages; - }; - formatter = treefmtEval.config.build.wrapper; - packages.default = qt6Packages.callPackage ./package.nix { }; - } + system: + let + overlays = [ ]; + pkgs = import nixpkgs { + inherit system overlays; + }; + pre-commit = pre-commit-hooks.lib.${system}.run ( + import ./pre-commit-hooks.nix { inherit pkgs treefmtEval; } + ); + treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt-nix; + in + with pkgs; + { + apps = { + inherit (pre-commit) shellHook; + buildInputs = with pkgs; [ + microsoft-gsl + qt6.qtbase + qt6.wayland + ut + ]; + nativeBuildInputs = + [ + appstream + appstream-glib + asciidoctor + ccache + clang + clang-tools + cmake + desktop-file-utils + fish + flatpak-builder + gdb + include-what-you-use + just + lonv + librsvg + lldb + llvm + lychee + mold-wrapped + nil + ninja + nushell + python311Packages.lcov-cobertura + qt6.wrapQtAppsHook + treefmtEcal.config.build.wrapper + (builtins.attrValues treefmtEval.config.build.programs) + ] + ++ pre-commit.enabledPackages; + }; + formatter = treefmtEval.config.build.wrapper; + packages.default = qt6Packages.callPackage ./package.nix { }; + } ); } From 0030dab0f7a01c89259809bacc0c4f054095d4b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Fri, 8 Nov 2024 13:05:59 +0100 Subject: [PATCH 13/22] fix: issue on flake.nix --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 010fbe76d..2b868bed6 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,7 @@ nixpkgs.follows = "nixpkgs"; nixpkgs-unstable.follows = "nixpkgs"; pre-commit-hooks.follows = "pre-commit-hooks"; - treefmt-nix.follows = " treefmt-nix"; + treefmt-nix.follows = "treefmt-nix"; }; }; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; From 82fd2a7259e896acddfc0a0f391116d741877f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Fri, 8 Nov 2024 13:14:58 +0100 Subject: [PATCH 14/22] fix: issue on packegenix --- package.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/package.nix b/package.nix index a38fc1619..3e9e0faff 100644 --- a/package.nix +++ b/package.nix @@ -7,13 +7,12 @@ , stdenv , ut , wrapQtAppsHook -, -}; +}: stdenv.mkDerivation = { pname = "jmbde"; version = "0.7.0"; -src ) ./. +src = ./.; buildInputs =[ microsoft-gsl From 467d83b4117ceae0cfea1d7b7384a30ef27c74f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Fri, 8 Nov 2024 13:17:20 +0100 Subject: [PATCH 15/22] fix: issue on packegei.nix --- package.nix | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/package.nix b/package.nix index 3e9e0faff..8d206f55d 100644 --- a/package.nix +++ b/package.nix @@ -8,28 +8,28 @@ , ut , wrapQtAppsHook }: -stdenv.mkDerivation = { -pname = "jmbde"; -version = "0.7.0"; +stdenv.mkDerivation { + pname = "jmbde"; + version = "0.7.0"; -src = ./.; + src = ./.; -buildInputs =[ -microsoft-gsl -qtbase -qtwayland -ut -]; + buildInputs = [ + microsoft-gsl + qtbase + qtwayland + ut + ]; -nativeBuildInputs = [ -cmake -mold-wrapped -ninja -wrapQtAppsHook -]; + nativeBuildInputs = [ + cmake + mold-wrapped + ninja + wrapQtAppsHook + ]; -cmakeFlags = [ -"--preset=minimal" -"-DCMAKE_LINKER_TYPE=MOLD" -]; + cmakeFlags = [ + "--preset=minimal" + "-DCMAKE_LINKER_TYPE=MOLD" + ]; } From 65e22cbe5675ae26f025868b7571bc544e080525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Fri, 8 Nov 2024 14:43:23 +0100 Subject: [PATCH 16/22] fix: issue on package.nix --- package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.nix b/package.nix index 8d206f55d..6fead9421 100644 --- a/package.nix +++ b/package.nix @@ -1,6 +1,6 @@ { cmake , microsoft-gsl -, modl-wrapped +, mold-wrapped , ninja , qtbase , qtwayland From 776e2e1ce520bee17dffe1a0d42d729ec3c73694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Fri, 8 Nov 2024 15:31:28 +0100 Subject: [PATCH 17/22] Fix: wrong path for checking desktop file --- .github/workflows/appstream-util-validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/appstream-util-validate.yml b/.github/workflows/appstream-util-validate.yml index 7791742ba..89300e504 100644 --- a/.github/workflows/appstream-util-validate.yml +++ b/.github/workflows/appstream-util-validate.yml @@ -22,4 +22,4 @@ jobs: - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Check the MetaInfo file - run: nix develop --command appstream-util validate packaging/com.jmuelbert.jmbde.metainfo.xml + run: nix develop --command appstream-util validate packaging/linux/com.jmuelbert.jmbde.metainfo.xml From ee702b12544303447b1a57a342b760584e3f7837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Sat, 9 Nov 2024 12:30:18 +0100 Subject: [PATCH 18/22] chore: Add all missing nix workflows --- .github/workflows/external-data-checker.yml | 25 +++ .github/workflows/flake-checker.yml | 21 +++ ".github/workflows/link-checker.ym\303\266" | 0 .github/workflows/lock-updater.yml | 24 +++ .github/workflows/schedule.yaml | 40 +++++ .github/workflows/treefamt.yaml | 54 ++++++ flake.lock | 178 ++++++++++++++++++++ flake.nix | 11 +- lychee.toml | 14 ++ 9 files changed, 363 insertions(+), 4 deletions(-) delete mode 100644 ".github/workflows/link-checker.ym\303\266" create mode 100644 flake.lock create mode 100644 lychee.toml diff --git a/.github/workflows/external-data-checker.yml b/.github/workflows/external-data-checker.yml index e69de29bb..def71cfc5 100644 --- a/.github/workflows/external-data-checker.yml +++ b/.github/workflows/external-data-checker.yml @@ -0,0 +1,25 @@ +name: Check for updates +on: + schedule: + - cron: 0 0 13 * * # run on the 13th every month + workflow_dispatch: +jobs: + flatpak-external-data-checker: + runs-on: ubuntu-latest + strategy: + matrix: + branch: [main] + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ matrix.branch }} + - uses: docker://ghrc.io/flathub/flatpak-exernal-data-checker:latest + env: + GIT_AUTHOR_NAME: Flatpak External Data Checker + GIT_COMMITTER_NAME: Flatpak External Data Checker + # email sets "github-actions[bot]" as commit author. see https://github.community/t/github-actions-bot-email-address/17204/6 + GIT_AUTHOR_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com + GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com + GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_UPDATES }} + with: + args: --update --never-fork packaging/linux/com.jmuelbert.jmbde.yaml diff --git a/.github/workflows/flake-checker.yml b/.github/workflows/flake-checker.yml index e69de29bb..3b55be357 100644 --- a/.github/workflows/flake-checker.yml +++ b/.github/workflows/flake-checker.yml @@ -0,0 +1,21 @@ +name: Check Nix Flake +on: + pull_request: + branches: [main] + paths: + - '**.nix' + - .github/workflows/flake-checker.yml + - flake.lock + push: + branches: + - main + paths: + - '**.nix' + - .github/workflows/flakechecker.yml + - flake.lock +jobs: + flake-checker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/flake-checker-action@v9 diff --git "a/.github/workflows/link-checker.ym\303\266" "b/.github/workflows/link-checker.ym\303\266" deleted file mode 100644 index e69de29bb..000000000 diff --git a/.github/workflows/lock-updater.yml b/.github/workflows/lock-updater.yml index e69de29bb..1103ea2b0 100644 --- a/.github/workflows/lock-updater.yml +++ b/.github/workflows/lock-updater.yml @@ -0,0 +1,24 @@ +name: Flake ❄️ Lock πŸ”’οΈ Updater ✨ +on: + schedule: + # Run on the third of the month + - cron: 0 0 3 * * + workflow_dispatch: +jobs: + lock-updater: + name: Flake Lock Updater + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - uses: DeterminateSystems/update-flake-lock@v24 + with: + pr_assignees: ${{ github.repository_owner }} + pr_labels: | + automated + dependencies + pr_title: "chore: update flake.lock" + token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} diff --git a/.github/workflows/schedule.yaml b/.github/workflows/schedule.yaml index e69de29bb..9b1b1ce0b 100644 --- a/.github/workflows/schedule.yaml +++ b/.github/workflows/schedule.yaml @@ -0,0 +1,40 @@ +name: schedule +on: + workflow_dispatch: + schedule: + # Run on the third of every month + - cron: 0 0 3 * * +jobs: + coverage-main-branch: + strategy: + fail-fast: true + matrix: + compiler: [clang] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Restore ccache cache + id: cache-ccache-restore + uses: action/cache/restore@v4 + with: + key: coverage-${{ matrix.compiler }}-cache- + path: .ccache + - name: Generate Coverage + run: nix develop --command just workflow coverage-${{ matrix.compiler }} + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::echo timestamp=${current_date}") + - name: Save ccache cache + uses: actions/cache/save@v4 + if: always() && steps.cache-ccache-restore.outputs.cache-hit != 'true' + with: + key: coverage-${{ matrix.compiler }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + path: .ccache + - uses: clearlyip/code-coverage-report-action@v5 + with: + filename: build-coverage-${{ matrix.compiler }}/cobertura.xml diff --git a/.github/workflows/treefamt.yaml b/.github/workflows/treefamt.yaml index e69de29bb..039e48757 100644 --- a/.github/workflows/treefamt.yaml +++ b/.github/workflows/treefamt.yaml @@ -0,0 +1,54 @@ +name: Check files with treefmt +"on": + pull_request: + branches: [main] + paths: + - '**.cmake' + - '**.cpp' + - '**.hpp' + - '**.h' + - '**.json' + - '**.just' + - '**.nix' + - '**.toml' + - '**.yaml' + - '**.yml' + - '**/.justfile' + - '**/CMakeLists.txt' + - '**/justfile' + - .clang-format + - .github/workflows/treefmt.yaml + - flake.lock + push: + branches: [main] + paths: + - '**.cmake' + - '**.cpp' + - '**.hpp' + - '**.h' + - '**.json' + - '**.just' + - '**.nix' + - '**.toml' + - '**.yaml' + - '**.yml' + - '**/.justfile' + - '**/CMakeLists.txt' + - '**/justfile' + - .clang-format + - .github/workflows/treefmt.yaml + - flake.lock +jobs: + treefmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Run treefmt + run: nix develop --command treefmt --ci + - uses: reviewdog/action-suggester@v1 + with: + fail_on_error: true + github_token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} + tool_name: treefmt diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..4623750f6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,178 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nix-update-scripts": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-unstable": [ + "nixpkgs" + ], + "pre-commit-hooks": [ + "pre-commit-hooks" + ], + "treefmt-nix": [ + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1730742759, + "narHash": "sha256-QOhHyeVqUVl1R72O5S81l1MziNJsntqhIDolF/MoBhk=", + "owner": "jwillikers", + "repo": "nix-update-scripts", + "rev": "c11269c8aede98ee8d5a4fbb65c578506616749b", + "type": "github" + }, + "original": { + "owner": "jwillikers", + "repo": "nix-update-scripts", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1730785428, + "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730814269, + "narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "d70155fdc00df4628446352fc58adc640cd705c2", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nix-update-scripts": "nix-update-scripts", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", + "treefmt-nix": "treefmt-nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1730321837, + "narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "746901bb8dba96d154b66492a29f5db0693dbfcc", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 2b868bed6..0a6dd5769 100644 --- a/flake.nix +++ b/flake.nix @@ -45,16 +45,19 @@ pre-commit = pre-commit-hooks.lib.${system}.run ( import ./pre-commit-hooks.nix { inherit pkgs treefmtEval; } ); - treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt-nix; + treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix; in with pkgs; { apps = { + inherit (nix-update-scripts.apps.${system}) update-nix-direnv; + }; + devShells.default = mkShell { inherit (pre-commit) shellHook; buildInputs = with pkgs; [ microsoft-gsl qt6.qtbase - qt6.wayland + qt6.qtwayland ut ]; nativeBuildInputs = @@ -72,7 +75,7 @@ gdb include-what-you-use just - lonv + lcov librsvg lldb llvm @@ -83,7 +86,7 @@ nushell python311Packages.lcov-cobertura qt6.wrapQtAppsHook - treefmtEcal.config.build.wrapper + treefmtEval.config.build.wrapper (builtins.attrValues treefmtEval.config.build.programs) ] ++ pre-commit.enabledPackages; diff --git a/lychee.toml b/lychee.toml new file mode 100644 index 000000000..ca8f2e3d6 --- /dev/null +++ b/lychee.toml @@ -0,0 +1,14 @@ +# Due to rate limiting from gnu.org +accept = [429] + +cache = true +exclude = ['^https://flatpak\.org'] +exclude_path = [ + ".cache/", + ".direnv/", + ".flatpak/", + ".flatpak-builder/", + "build.*/", + "repo/", +] +max_cache_age = "2w" From a38ebd13e22c4eef247bddf04f5b479a8734f244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Sat, 9 Nov 2024 12:36:03 +0100 Subject: [PATCH 19/22] chore: add the missing decsktop check --- .github/workflows/desktop-file-validate.yml | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/desktop-file-validate.yml b/.github/workflows/desktop-file-validate.yml index e69de29bb..6d24caf17 100644 --- a/.github/workflows/desktop-file-validate.yml +++ b/.github/workflows/desktop-file-validate.yml @@ -0,0 +1,25 @@ +name: Check desktop file +"on": + pull_request: + branches: [main] + paths: + - '**.nix' + - .github/workflows/desktop-file-validate.yaml + - flake.lock + - packaging/com.jwillikers.CyrillicEncoder.desktop + push: + branches: [main] + paths: + - '**.nix' + - .github/workflows/desktop-file-validate.yaml + - flake.lock + - packaging/com.jwillikers.CyrillicEncoder.desktop +jobs: + desktop-file-validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Check the desktop file + run: nix develop --command desktop-file-validate packaging/com.jwillikers.CyrillicEncoder.desktop From f261d062ab075ece649da5cf019a4904165275d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Sat, 9 Nov 2024 12:43:22 +0100 Subject: [PATCH 20/22] fix: issue on pre-commit-hooks.nix --- pre-commit-hooks.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pre-commit-hooks.nix b/pre-commit-hooks.nix index 23e0ad344..2ca38b9bd 100644 --- a/pre-commit-hooks.nix +++ b/pre-commit-hooks.nix @@ -17,7 +17,7 @@ check-shebang-scripts-are-executable.enable = true; check-toml.enable = true; check-xml.enable = true; - check-yml.enable = true; + check-yaml.enable = true; deadnix.enable = true; detect-private-keys.enable = true; editorconfig-checker.enable = true; From 732a5528d726213d0d22e370171a58221c2a1b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Sat, 9 Nov 2024 13:12:13 +0100 Subject: [PATCH 21/22] fix: issues in workflwos --- .github/workflows/external-data-checker.yml | 3 +- .github/workflows/link-checker.yml | 44 +++++++++++++ .github/workflows/lock-updater.yml | 2 +- .justfile | 68 +++++++++++++++++++++ 4 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 .justfile diff --git a/.github/workflows/external-data-checker.yml b/.github/workflows/external-data-checker.yml index def71cfc5..df8df270f 100644 --- a/.github/workflows/external-data-checker.yml +++ b/.github/workflows/external-data-checker.yml @@ -1,7 +1,8 @@ name: Check for updates on: schedule: - - cron: 0 0 13 * * # run on the 13th every month + # Run on the 13th every month + - cron: 0 0 13 * * workflow_dispatch: jobs: flatpak-external-data-checker: diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml index e69de29bb..8dee9c7cb 100644 --- a/.github/workflows/link-checker.yml +++ b/.github/workflows/link-checker.yml @@ -0,0 +1,44 @@ +name: Check URL's with Lychee +on: + pull_request: + branches: [main] + paths: + - '**.adoc' + - '**.md' + - '**.nix' + - .github/workflows/link-checker.yml + - flake.lock + - lychee.toml + push: + branches: + - main + paths: + - '**.adoc' + - '**.md' + - '**.nix' + - .github/workflows/link-checker.yml + - flake.lock + - lychee.toml + schedule: + # Run once a month on the 14th + - cron: 0 0 14 * * + workflow_dispatch: +jobs: + link-checker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-actions@v14 + - uses: DeterminateSystems/magic-nix-cache-action@v8 + - name: Restore lychee cache + id: cache-lychee-restore + uses: actions/cache/restore@v4 + with: + key: lychee-cache + path: .lycheecache + - name: Convert the Asciidoc files to html + run: nix develop --command asciidoctor ./*.adoc + - name: Run lychee on the generated site + env: + GITHUB_TOKEN: $${{ secrets.GITHUB_TOKEN}} + run: nix develop --command lychee --cache --no-progress --verbose ./*.html diff --git a/.github/workflows/lock-updater.yml b/.github/workflows/lock-updater.yml index 1103ea2b0..b5903475f 100644 --- a/.github/workflows/lock-updater.yml +++ b/.github/workflows/lock-updater.yml @@ -1,4 +1,4 @@ -name: Flake ❄️ Lock πŸ”’οΈ Updater ✨ +name: Flake ❄️ Lock πŸ”’οΈ Updater ✨ lychee. on: schedule: # Run on the third of the month diff --git a/.justfile b/.justfile new file mode 100644 index 000000000..3877fe30a --- /dev/null +++ b/.justfile @@ -0,0 +1,68 @@ +default: build + +alias b := build + +build preset="dev" target="all": + cmake --build --preset {{ preset }} --target {{ target }} + +alias ch := check + +check: && format + yamllint . + asciidoctor *.adoc + lychee --cache *.html + +alias c := configure + +configure preset="dev": + cmake --preset {{ preset }} + +alias d := debug + +# todo Parse build directory from preset. +debug preset="dev" debugger="gdb": (build preset) + {{ debugger }} build/src/cyrillic-encoder + +flatpak: + flatpak-builder \ + --force-clean \ + --install \ + --install-deps-from=flathub \ + --repo=repo \ + --user \ + build-dir \ + packaging/com.jwillikers.CyrillicEncoder.yaml + +alias f := format +alias fmt := format + +format: + treefmt + +alias r := run + +# todo Parse build directory from preset. +run preset="dev": (build preset) + build/src/cyrillic-encoder + +alias p := package +alias pack := package + +package: + nix build + +alias t := test + +test preset="dev": build + ctest --preset {{ preset }} + +alias u := update +alias up := update + +update: + nix flake update + +alias w := workflow + +workflow preset="dev" *flags="": + cmake --workflow --preset {{ preset }} {{ flags }} From 89dd9dbcf9a20961479a8e6241f7cc2d7da82219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20M=C3=BClbert?= Date: Sat, 9 Nov 2024 13:28:56 +0100 Subject: [PATCH 22/22] fix: issues in two workflows --- .github/workflows/desktop-file-validate.yml | 6 +++--- .github/workflows/link-checker.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/desktop-file-validate.yml b/.github/workflows/desktop-file-validate.yml index 6d24caf17..689030df3 100644 --- a/.github/workflows/desktop-file-validate.yml +++ b/.github/workflows/desktop-file-validate.yml @@ -6,14 +6,14 @@ name: Check desktop file - '**.nix' - .github/workflows/desktop-file-validate.yaml - flake.lock - - packaging/com.jwillikers.CyrillicEncoder.desktop + - packaging/linux/com.jmuelbert.jmbde.desktop push: branches: [main] paths: - '**.nix' - .github/workflows/desktop-file-validate.yaml - flake.lock - - packaging/com.jwillikers.CyrillicEncoder.desktop + - packaging/linux/com.jmuelbert.jmbde.desktop jobs: desktop-file-validate: runs-on: ubuntu-latest @@ -22,4 +22,4 @@ jobs: - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Check the desktop file - run: nix develop --command desktop-file-validate packaging/com.jwillikers.CyrillicEncoder.desktop + run: nix develop --command desktop-file-validate packaging/linux/com.jmuelbert.jmbde.desktop diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml index 8dee9c7cb..ffe1cde6a 100644 --- a/.github/workflows/link-checker.yml +++ b/.github/workflows/link-checker.yml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-actions@v14 + - uses: DeterminateSystems/nix-installer-action@v14 - uses: DeterminateSystems/magic-nix-cache-action@v8 - name: Restore lychee cache id: cache-lychee-restore