Skip to content

Commit

Permalink
release #36
Browse files Browse the repository at this point in the history
  • Loading branch information
yousefvand committed Nov 28, 2024
1 parent 551cccd commit 3e9fa0e
Showing 1 changed file with 33 additions and 26 deletions.
59 changes: 33 additions & 26 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,51 @@ jobs:
sudo apt-get install -y ninja-build \
qt6-base-dev qt6-tools-dev qt6-tools-dev-tools \
qt6-l10n-tools libgl1-mesa-dev libglu1-mesa-dev rsync
shell: bash

- name: Configure CMake (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cmake -B "${{ github.workspace }}/build" \
-DCMAKE_BUILD_TYPE=Release \
-G "Ninja" \
-S "${{ github.workspace }}"
cmake -B build -DCMAKE_BUILD_TYPE=Release -G "Ninja" -S .
shell: bash

- name: Build application (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: cmake --build "${{ github.workspace }}/build" --config Release
run: cmake --build build --config Release
shell: bash

- name: Package application (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
BUILD_DIR="${{ github.workspace }}/build"
TEMP_DIR="/tmp/build_copy"
rm -rf $TEMP_DIR
rsync -a "$BUILD_DIR/" "$TEMP_DIR/"
cd $TEMP_DIR
tar -czvf application.tar.gz ./*
cd build
tar -czvf application.tar.gz .
shell: bash

# macOS Section
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install ninja qt
shell: bash

- name: Configure CMake (macOS)
if: matrix.os == 'macos-latest'
run: |
cmake -B "${{ github.workspace }}/build" \
-DCMAKE_BUILD_TYPE=Release \
-G "Ninja" \
-S "${{ github.workspace }}"
cmake -B build -DCMAKE_BUILD_TYPE=Release -G "Ninja" -S .
shell: bash

- name: Build application (macOS)
if: matrix.os == 'macos-latest'
run: cmake --build "${{ github.workspace }}/build" --config Release
run: cmake --build build --config Release
shell: bash

- name: Package application (macOS)
if: matrix.os == 'macos-latest'
run: |
cd "${{ github.workspace }}/build"
cd build
hdiutil create -volname Application -srcfolder . -ov -format UDZO application.dmg
zip application.zip application.dmg
shell: bash

# Windows Section
- name: Install dependencies (Windows)
Expand All @@ -89,37 +93,42 @@ jobs:
choco install ninja -y
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
shell: cmd
- name: Verify Visual Studio Installation

- name: Verify Visual Studio Build Tools
if: matrix.os == 'windows-latest'
run: |
$vcvarsPath = "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
if (!(Test-Path $vcvarsPath)) {
Write-Output "Visual Studio Build Tools not found at $vcvarsPath. Attempting installation again."
Write-Output "Visual Studio Build Tools not found at $vcvarsPath. Installation failed or incorrect path."
Get-ChildItem -Path "C:\Program Files (x86)\Microsoft Visual Studio" -Recurse -Filter vcvars64.bat
exit 1
} else {
Write-Output "Found Visual Studio Build Tools at $vcvarsPath"
}
shell: pwsh

- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && ^
cmake -B D:\a\Notepad--\Notepad--\build ^
cmake -B build ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_PREFIX_PATH="C:\Qt\6.5.3\msvc2019_64\lib\cmake" ^
-G Ninja ^
-S D:\a\Notepad--\Notepad--
-S .
shell: cmd

- name: Build application (Windows)
if: matrix.os == 'windows-latest'
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" && ^
cmake --build D:\a\Notepad--\Notepad--\build --config Release
cmake --build build --config Release
shell: cmd

- name: Package application (Windows)
if: matrix.os == 'windows-latest'
run: |
cd D:\a\Notepad--\Notepad--\build
cd build
Compress-Archive -Path . -DestinationPath application.zip
shell: cmd

Expand All @@ -128,6 +137,4 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: application-${{ matrix.os }}
path: |
${{ github.workspace }}/build/application.${{ matrix.artifact_extension }}
/tmp/build_copy/application.tar.gz
path: build/application.${{ matrix.artifact_extension }}

0 comments on commit 3e9fa0e

Please sign in to comment.