Skip to content

Commit

Permalink
Merge pull request #1091 from dsm/current
Browse files Browse the repository at this point in the history
CI improvements
  • Loading branch information
ra3xdh authored Nov 27, 2024
2 parents c9dd2ea + b100745 commit b826d12
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 101 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/cmake.yml

This file was deleted.

204 changes: 170 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -25,25 +24,83 @@ 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

- 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 }}
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
SHORT_HASH=""
else
MAJOR_MINOR=$(cut -d. -f1-2 VERSION)
VERSION="${MAJOR_MINOR}.99"
# Get the short hash of the current commit
COMMIT_HASH=$(echo ${{ github.sha }} | cut -c1-7)
SHORT_HASH="-$COMMIT_HASH"
fi
- name: Print version
run: echo "Qucs-S version is ${{ env.VERSION }}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
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
continue-on-error: true
needs: setup
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Set version environment variable
run: |
echo "VERSION=${{ needs.setup.outputs.version }}" >> $GITHUB_ENV
echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" >> $GITHUB_ENV
- 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: |
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
Expand All @@ -54,10 +111,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: |
Expand Down Expand Up @@ -109,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}}-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:
Expand All @@ -129,10 +190,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:
Expand Down Expand Up @@ -221,10 +286,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:
Expand Down Expand Up @@ -300,9 +369,69 @@ 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
echo "SHORT_HASH=${{ needs.setup.outputs.short_hash }}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- 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

- 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
continue-on-error: true
needs: setup
strategy:
fail-fast: false
Expand All @@ -320,10 +449,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
Expand Down Expand Up @@ -404,26 +536,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/[email protected].4
uses: Minionguyjpro/[email protected].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
Expand All @@ -434,10 +566,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
Expand Down
3 changes: 2 additions & 1 deletion qucs-activefilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion qucs-attenuator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion qucs-filter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading

0 comments on commit b826d12

Please sign in to comment.