From c4d24f568ccd0a47709e3ee0695ff741d0796704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Sat, 23 Nov 2024 23:51:22 +0300 Subject: [PATCH 01/10] Delete .github/workflows/cmake.yml --- .github/workflows/cmake.yml | 46 ------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/cmake.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml deleted file mode 100644 index 3ea112a2b..000000000 --- a/.github/workflows/cmake.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: CMake Linux Qt5 - -on: - push: - branches: [ "master", "current", "release/*" ] - paths: [ "**.cpp", "**.h", "**/CMakeLists.txt" ] - pull_request: - branches: [ "master", "current", "release/*" ] - paths: [ "**.cpp", "**.h", "**/CMakeLists.txt" ] - -env: - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) - BUILD_TYPE: Release - -jobs: - - - - build: - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. - # You can convert this to a matrix build if you need cross-platform coverage. - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: InstallQt5 - run: | - sudo apt-get update - sudo apt-get install -y qtbase5-dev qttools5-dev qtscript5-dev libqt5svg5-dev flex bison libqt5charts5-dev - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build -j`nproc` --config ${{env.BUILD_TYPE}} - - #- name: Test - # working-directory: ${{github.workspace}}/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 ${{env.BUILD_TYPE}} - From 1f91a7e4b4ce736b2dfb2a13fda760eaa660aaba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Sat, 23 Nov 2024 23:50:56 +0300 Subject: [PATCH 02/10] add linux-qt5 to deploy.yml --- .github/workflows/deploy.yml | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index acc0d6f46..d465e169d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,6 +44,49 @@ jobs: - name: Print version run: echo "Qucs-S version is ${{ env.VERSION }}" + + build-linux-qt5: + runs-on: ubuntu-22.04 + needs: setup + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Set version environment variable + run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + + - name: Print version + run: echo "Qucs-S version is ${{ env.VERSION }}" + + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt-get install -y libglx-dev libgl1-mesa-dev flex bison gperf dos2unix flex bison gperf dos2unix cups libcups2-dev + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 --slave /usr/bin/g++ g++ /usr/bin/g++-12 + + - name: 'Install Qt5' + uses: jurplel/install-qt-action@v4 + with: + version: 5.15.2 + host: 'linux' + target: 'desktop' + cache: true + arch: 'gcc_64' + install-deps: 'true' + modules: 'qtcharts' + + - name: 'Configure CMake' + run: | + cmake -B ${{github.workspace}}/build \ + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -DCI_VERSION="${{env.VERSION}}" + + - name: 'Build' + # Build your program with the given configuration + run: | + cmake --build ${{github.workspace}}/build -j`nproc` --config ${{env.BUILD_TYPE}} + build-linux-appimage-qt6: runs-on: ubuntu-22.04 From 5a97a35bd0ec6b79167c10a849d07f86e14ec71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Sun, 24 Nov 2024 00:42:04 +0300 Subject: [PATCH 03/10] adding msvc-build to deploy.yml --- .github/workflows/deploy.yml | 59 +++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d465e169d..061f716d2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -343,6 +343,63 @@ jobs: with: name: ${{ env.APP_NAME }}-${{env.VERSION}}-macOS path: ${{ env.APP_NAME }}-${{env.VERSION}}-macOS.dmg + + build-windows-msvc: + runs-on: windows-latest + needs: setup + strategy: + fail-fast: false + defaults: + run: + shell: pwsh + steps: + - name: Disable autocrlf in Git + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Set version environment variable + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Print version + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + + - name: Checkout repository + uses: actions/checkout@v4 + + - name: 'Install Qt6' + uses: jurplel/install-qt-action@v4 + with: + version: ${{env.QT_VERSION}} + host: 'windows' + target: 'desktop' + cache: true + arch: 'win64_msvc2022_64' + install-deps: 'true' + modules: 'qtcharts' + + - name: '⚙️ Install CMake' + uses: lukka/get-cmake@latest + with: + useLocalCache: true + + - name: '🛠 Setup MSVC Development Environment' + uses: TheMrMilchmann/setup-msvc-dev@v3 + with: + arch: x64 + + - name: 'Configure CMake' + run: | + cmake -B ${{github.workspace}}/build -DWITH_QT6=1 ` + -DCMAKE_CXX_COMPILER=cl -DCMAKE_C_COMPILER=cl ` + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ` + -DCI_VERSION="${{env.VERSION}}" + + - name: 'Build Qucs-s' + run: | + cmake --build ${{github.workspace}}/build -j 16 --config=${{env.BUILD_TYPE}} build-windows: runs-on: windows-2022 @@ -471,7 +528,7 @@ jobs: create-release: runs-on: ubuntu-latest if: github.event_name != 'pull_request' - needs: [setup, build-linux-appimage-qt6, build-mac-intel, build-mac-universal, build-windows] + needs: [setup, build-linux-qt5, build-linux-appimage-qt6, build-mac-intel, build-mac-universal, build-windows, build-windows-msvc] steps: - name: Checkout repository uses: actions/checkout@v4 From fb686be61fbe4fbb7949637121799b26bb7c27cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Sun, 24 Nov 2024 14:14:54 +0300 Subject: [PATCH 04/10] add some compiler opt. flag --- qucs-activefilter/CMakeLists.txt | 3 +- qucs-attenuator/CMakeLists.txt | 3 +- qucs-filter/CMakeLists.txt | 3 +- qucs-powercombining/CMakeLists.txt | 3 +- qucs-s-spar-viewer/CMakeLists.txt | 49 +++++++++++++++++++++--------- qucs-transcalc/CMakeLists.txt | 4 +-- qucs/CMakeLists.txt | 3 +- 7 files changed, 47 insertions(+), 21 deletions(-) diff --git a/qucs-activefilter/CMakeLists.txt b/qucs-activefilter/CMakeLists.txt index f506e5aa6..3629d0f94 100644 --- a/qucs-activefilter/CMakeLists.txt +++ b/qucs-activefilter/CMakeLists.txt @@ -80,8 +80,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-attenuator/CMakeLists.txt b/qucs-attenuator/CMakeLists.txt index bb1f9576e..f9086f144 100644 --- a/qucs-attenuator/CMakeLists.txt +++ b/qucs-attenuator/CMakeLists.txt @@ -69,8 +69,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-filter/CMakeLists.txt b/qucs-filter/CMakeLists.txt index d3346e025..72c5c9b23 100644 --- a/qucs-filter/CMakeLists.txt +++ b/qucs-filter/CMakeLists.txt @@ -71,8 +71,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-powercombining/CMakeLists.txt b/qucs-powercombining/CMakeLists.txt index f19d6b635..e8933b2d1 100644 --- a/qucs-powercombining/CMakeLists.txt +++ b/qucs-powercombining/CMakeLists.txt @@ -80,8 +80,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() diff --git a/qucs-s-spar-viewer/CMakeLists.txt b/qucs-s-spar-viewer/CMakeLists.txt index 7c421debf..c42ec072e 100644 --- a/qucs-s-spar-viewer/CMakeLists.txt +++ b/qucs-s-spar-viewer/CMakeLists.txt @@ -6,9 +6,14 @@ SET(QUCS_NAME "qucs-s") # use top VERSION file file (STRINGS ${PROJECT_SOURCE_DIR}/../VERSION QUCS_VERSION) -message(STATUS "Configuring ${PROJECT_NAME} (GUI): VERSION ${QUCS_VERSION}") -set(PROJECT_VERSION "${QUCS_VERSION}") +if(DEFINED CI_VERSION) + set(PROJECT_VERSION "${CI_VERSION}") +else() + set(PROJECT_VERSION "${QUCS_VERSION}") +endif() + +message(STATUS "Configuring ${PROJECT_NAME} (GUI): VERSION ${PROJECT_VERSION}") set(PROJECT_VENDOR "Qucs-S team. This program is licensed under the GNU GPL") set(PROJECT_COPYRIGHT_YEAR "2024") @@ -40,20 +45,36 @@ include_directories( ) -IF(QT_VERSION_MAJOR EQUAL 6) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -ELSE() -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -ENDIF() - -if (MSVC) - add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor) +if (${QT_VERSION} VERSION_LESS "6.7.0") + set(CMAKE_CXX_STANDARD 17) else() - # additional warnings - add_compile_options(-Wall -Wextra) + set(CMAKE_CXX_STANDARD 20) endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) + add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg) + add_compile_options(/wd4244 /wd4267 /wd4312) + else() + add_compile_options(-Wall -Wextra -O0 -g) + if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$") + add_compile_options(-Wno-ignored-attributes) + endif() + endif() +elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) + else() + add_compile_options(-w) + endif() +endif() + ADD_DEFINITIONS(${QT_DEFINITIONS}) #ADD_SUBDIRECTORY( bitmaps ) -> added as resources diff --git a/qucs-transcalc/CMakeLists.txt b/qucs-transcalc/CMakeLists.txt index 93cb4ab7e..ffbc092e9 100644 --- a/qucs-transcalc/CMakeLists.txt +++ b/qucs-transcalc/CMakeLists.txt @@ -70,13 +70,13 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() endif() - ADD_DEFINITIONS(${QT_DEFINITIONS}) SET(QUCSTRANS_SRCS diff --git a/qucs/CMakeLists.txt b/qucs/CMakeLists.txt index d78e779c3..8d8c571e7 100755 --- a/qucs/CMakeLists.txt +++ b/qucs/CMakeLists.txt @@ -115,8 +115,9 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS) - string(REGEX REPLACE "/W3" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg) + add_link_options(/OPT:REF /OPT:ICF) else() add_compile_options(-w) endif() From 3d1182142e674086c2d313fc1d30ee41c6740664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Sun, 24 Nov 2024 17:28:07 +0300 Subject: [PATCH 05/10] changed CI version handling. --- .github/workflows/deploy.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 061f716d2..636dac2f5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,6 @@ on: env: APP_NAME: "Qucs-S" - CI_VERSION: 24.4.99 EXECUTABLE_NAME: "qucs-s" PUBLISHER_NAME: "The Qucs-S Team" BUILD_TYPE: Release @@ -34,14 +33,14 @@ jobs: run: | if [ "${{github.ref_type}}" == "tag" ]; then VERSION=${{ github.ref_name }} - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "version=$VERSION" >> $GITHUB_OUTPUT else - VERSION=${{ env.CI_VERSION }} - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "version=$VERSION" >> $GITHUB_OUTPUT + MAJOR_MINOR=$(cut -d. -f1-2 VERSION) + VERSION="${MAJOR_MINOR}.99" fi + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Print version run: echo "Qucs-S version is ${{ env.VERSION }}" From c227c973d647fde6dd4be59002851c9e690138d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Sun, 24 Nov 2024 18:21:58 +0300 Subject: [PATCH 06/10] if MSVC or Qt5 build failed, continue and don't affect create-relase job. --- .github/workflows/deploy.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 636dac2f5..14a4b1a08 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -46,6 +46,7 @@ jobs: build-linux-qt5: runs-on: ubuntu-22.04 + continue-on-error: true needs: setup steps: - uses: actions/checkout@v4 @@ -402,6 +403,7 @@ jobs: build-windows: runs-on: windows-2022 + continue-on-error: true needs: setup strategy: fail-fast: false @@ -527,7 +529,7 @@ jobs: create-release: runs-on: ubuntu-latest if: github.event_name != 'pull_request' - needs: [setup, build-linux-qt5, build-linux-appimage-qt6, build-mac-intel, build-mac-universal, build-windows, build-windows-msvc] + needs: [setup, build-linux-appimage-qt6, build-mac-intel, build-mac-universal, build-windows] steps: - name: Checkout repository uses: actions/checkout@v4 From 683e4af9eb614d3799b48279267a564b18c22808 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Sun, 24 Nov 2024 18:37:21 +0300 Subject: [PATCH 07/10] adding git short hash to CI. --- .github/workflows/deploy.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 14a4b1a08..b6ead75d8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,6 +24,7 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.read_version.outputs.version }} + short_hash: ${{ steps.read_version.outputs.short_hash }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -41,8 +42,16 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV echo "version=$VERSION" >> $GITHUB_OUTPUT - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + # Get the short hash of the current commit + SHORT_HASH=$(git rev-parse --short=8 HEAD) + + echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_ENV + echo "short_hash=$SHORT_HASH" >> $GITHUB_OUTPUT + + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" build-linux-qt5: runs-on: ubuntu-22.04 From 6b7d368593043c3775f3c96709a98ceba074cca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Mon, 25 Nov 2024 19:11:57 +0300 Subject: [PATCH 08/10] adding short hash to artifact filename except macos. --- .github/workflows/deploy.yml | 91 +++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b6ead75d8..6fd23c859 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -32,19 +32,19 @@ jobs: - name: Read version from file id: read_version run: | - if [ "${{github.ref_type}}" == "tag" ]; then + if [ "${{ github.ref_type }}" == "tag" ]; then VERSION=${{ github.ref_name }} - else + SHORT_HASH="" + else MAJOR_MINOR=$(cut -d. -f1-2 VERSION) VERSION="${MAJOR_MINOR}.99" + # Get the short hash of the current commit + SHORT_HASH=$(echo ${{ github.sha }} | cut -c1-7) fi echo "VERSION=$VERSION" >> $GITHUB_ENV echo "version=$VERSION" >> $GITHUB_OUTPUT - # Get the short hash of the current commit - SHORT_HASH=$(git rev-parse --short=8 HEAD) - echo "SHORT_HASH=$SHORT_HASH" >> $GITHUB_ENV echo "short_hash=$SHORT_HASH" >> $GITHUB_OUTPUT @@ -63,10 +63,14 @@ jobs: submodules: recursive - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Install Dependencies run: | @@ -106,10 +110,14 @@ jobs: submodules: recursive - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Install Dependencies run: | @@ -161,13 +169,13 @@ jobs: --plugin=qt --output appimage rm linuxdeploy-x86_64.AppImage rm linuxdeploy-plugin-qt-x86_64.AppImage - mv *.AppImage ${{ env.APP_NAME }}-${{env.VERSION}}-linux-x86_64.AppImage + mv *.AppImage ${{ env.APP_NAME }}-${{env.VERSION}}-${{env.SHORT_HASH}}-linux-x86_64.AppImage - name: 'Upload artifact: AppImage' uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{env.VERSION}}-linux-x86_64 - path: ${{ env.APP_NAME }}-${{env.VERSION}}-linux-x86_64.AppImage + name: ${{ env.APP_NAME }}-${{env.VERSION}}-${{env.SHORT_HASH}}-linux-x86_64 + path: ${{ env.APP_NAME }}-${{env.VERSION}}-${{env.SHORT_HASH}}-linux-x86_64.AppImage build-mac-intel: @@ -181,10 +189,14 @@ jobs: xcode-version: latest-stable - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - uses: actions/checkout@v4 with: @@ -273,10 +285,14 @@ jobs: xcode-version: latest-stable - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - uses: actions/checkout@v4 with: @@ -370,10 +386,12 @@ jobs: - name: Set version environment variable run: | echo "VERSION=${{ needs.setup.outputs.version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Print version + - name: Print version and hash run: | echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Checkout repository uses: actions/checkout@v4 @@ -430,10 +448,13 @@ jobs: shell: pwsh run: | echo "VERSION=${{ needs.setup.outputs.version }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - name: Print version + - name: Print version and hash shell: pwsh - run: echo "Qucs-S version is ${{ env.VERSION }}" + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Checkout repository uses: actions/checkout@v4 @@ -514,26 +535,26 @@ jobs: mkdir -p build/qucs-suite/misc cp -rf contrib/InnoSetup/misc build/qucs-suite/ cd build/qucs-suite - zip -r ../../${{ env.APP_NAME }}-${{ env.VERSION }}-win64.zip ./bin ./share ./lib ./misc + zip -r ../../${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-win64.zip ./bin ./share ./lib ./misc cd ../.. - name: Compile .ISS to .EXE Installer - uses: Minionguyjpro/Inno-Setup-Action@v1.2.4 + uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 with: path: contrib/InnoSetup/qucs.iss - options: /Qp /O"${{github.workspace}}" /DAPPNAME=${{ env.APP_NAME }} /DRELEASE="${{ env.VERSION }}" + options: /Qp /O"${{github.workspace}}" /DAPPNAME=${{ env.APP_NAME }} /DRELEASE="${{ env.VERSION }}-${{ env.SHORT_HASH }}" - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{ env.VERSION }}-win64 - path: ${{ env.APP_NAME }}-${{ env.VERSION }}-win64.zip + name: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-win64 + path: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-win64.zip - name: Upload exe artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{ env.VERSION }}-setup - path: ${{ env.APP_NAME }}-${{ env.VERSION }}-setup.exe + name: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-setup + path: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-setup.exe create-release: runs-on: ubuntu-latest @@ -544,10 +565,14 @@ jobs: uses: actions/checkout@v4 - name: Set version environment variable - run: echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + run: | + echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV + echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV - - name: Print version - run: echo "Qucs-S version is ${{ env.VERSION }}" + - name: Print version and hash + run: | + echo "Qucs-S version is ${{ env.VERSION }}" + echo "Qucs-S short hash is ${{ env.SHORT_HASH }}" - name: Download build artifacts uses: actions/download-artifact@v4 From 7fa2a015962446343072f53014f44b79a914c802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:03:29 +0300 Subject: [PATCH 09/10] add dash to short_hash. --- .github/workflows/deploy.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6fd23c859..5bdf8c346 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,7 +39,8 @@ jobs: MAJOR_MINOR=$(cut -d. -f1-2 VERSION) VERSION="${MAJOR_MINOR}.99" # Get the short hash of the current commit - SHORT_HASH=$(echo ${{ github.sha }} | cut -c1-7) + COMMIT_HASH=$(echo ${{ github.sha }} | cut -c1-7) + SHORT_HASH="-$COMMIT_HASH" fi echo "VERSION=$VERSION" >> $GITHUB_ENV @@ -169,13 +170,13 @@ jobs: --plugin=qt --output appimage rm linuxdeploy-x86_64.AppImage rm linuxdeploy-plugin-qt-x86_64.AppImage - mv *.AppImage ${{ env.APP_NAME }}-${{env.VERSION}}-${{env.SHORT_HASH}}-linux-x86_64.AppImage + mv *.AppImage ${{ env.APP_NAME }}-${{env.VERSION}}${{env.SHORT_HASH}}-linux-x86_64.AppImage - name: 'Upload artifact: AppImage' uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{env.VERSION}}-${{env.SHORT_HASH}}-linux-x86_64 - path: ${{ env.APP_NAME }}-${{env.VERSION}}-${{env.SHORT_HASH}}-linux-x86_64.AppImage + name: ${{ env.APP_NAME }}-${{env.VERSION}}${{env.SHORT_HASH}}-linux-x86_64 + path: ${{ env.APP_NAME }}-${{env.VERSION}}${{env.SHORT_HASH}}-linux-x86_64.AppImage build-mac-intel: @@ -542,19 +543,19 @@ jobs: uses: Minionguyjpro/Inno-Setup-Action@v1.2.5 with: path: contrib/InnoSetup/qucs.iss - options: /Qp /O"${{github.workspace}}" /DAPPNAME=${{ env.APP_NAME }} /DRELEASE="${{ env.VERSION }}-${{ env.SHORT_HASH }}" + options: /Qp /O"${{github.workspace}}" /DAPPNAME=${{ env.APP_NAME }} /DRELEASE="${{ env.VERSION }}${{ env.SHORT_HASH }}" - name: Upload build artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-win64 - path: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-win64.zip + name: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-win64 + path: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-win64.zip - name: Upload exe artifacts uses: actions/upload-artifact@v4 with: - name: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-setup - path: ${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-setup.exe + name: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-setup + path: ${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-setup.exe create-release: runs-on: ubuntu-latest From b1007458752ee4e3c27c46b349fd95c19599d004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Muhammet=20=C5=9E=C3=BCkr=C3=BC=20Demir?= <41967334+dsm@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:41:18 +0300 Subject: [PATCH 10/10] fix win64 portable naming. --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5bdf8c346..e76b21487 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -536,7 +536,7 @@ jobs: mkdir -p build/qucs-suite/misc cp -rf contrib/InnoSetup/misc build/qucs-suite/ cd build/qucs-suite - zip -r ../../${{ env.APP_NAME }}-${{ env.VERSION }}-${{ env.SHORT_HASH }}-win64.zip ./bin ./share ./lib ./misc + zip -r ../../${{ env.APP_NAME }}-${{ env.VERSION }}${{ env.SHORT_HASH }}-win64.zip ./bin ./share ./lib ./misc cd ../.. - name: Compile .ISS to .EXE Installer