Merge pull request #95 from SeongGino/Toki #245
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake - Windows & Linux | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, ubuntu-22.04-arm, windows-2019] | |
qt_version: [5.15.2, 6.7.3, 6.8.3] | |
build_type: [Debug, Release] | |
include: | |
- os: windows-2019 | |
c_compiler: cl | |
cpp_compiler: cl | |
file: build | |
qt_arch: windows | |
qt_version: 6.8.3 | |
qt6_modules: "qtserialport" | |
pretty: "Windows Artifact" | |
- os: ubuntu-22.04 | |
c_compiler: clang | |
cpp_compiler: clang++ | |
file: OpenFIRE_App-x86_64.AppImage | |
qt_arch: linux | |
qt_version: 5.15.2 | |
qt6_modules: "qtserialport qtwaylandcompositor" | |
sys_arch: x86_64 | |
install_prefix: -DCMAKE_INSTALL_PREFIX=/usr | |
pretty: "Linux x86 AppImage" | |
- os: ubuntu-22.04 | |
c_compiler: clang | |
cpp_compiler: clang++ | |
file: OpenFIRE_App-x86_64.AppImage | |
qt_arch: linux | |
qt_version: 6.8.3 | |
qt6_modules: "qtserialport qtwaylandcompositor" | |
sys_arch: x86_64 | |
install_prefix: -DCMAKE_INSTALL_PREFIX=/usr | |
pretty: "Linux x86 AppImage" | |
- os: ubuntu-22.04-arm | |
c_compiler: clang | |
cpp_compiler: clang++ | |
file: OpenFIRE_App-aarch64.AppImage | |
qt_arch: linux_arm64 | |
qt_version: 6.7.3 | |
qt6_modules: "qtserialport qtwaylandcompositor" | |
sys_arch: aarch64 | |
install_prefix: -DCMAKE_INSTALL_PREFIX=/usr | |
pretty: "Linux ARM AppImage" | |
exclude: | |
- os: windows-2019 | |
qt_version: 5.15.2 | |
- os: windows-2019 | |
qt_version: 6.7.3 | |
- os: ubuntu-22.04 | |
qt_version: 6.7.3 | |
- os: ubuntu-22.04-arm | |
qt_version: 5.15.2 | |
- os: ubuntu-22.04-arm | |
qt_version: 6.8.3 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'true' | |
- name: Get short SHA | |
id: get-short-sha | |
run: echo "id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
# TODO: using install-qt-action fork until https://github.com/jurplel/install-qt-action/issues/248 is resolved & merged | |
- name: Install Qt(5) | |
if: ${{ matrix.qt_version == '5.15.2' }} | |
uses: jdpurcell/install-qt-action@v5 | |
with: | |
version: '${{ matrix.qt_version }}' | |
archives: 'qtbase qtwayland qttranslations qttools qtsvg qtserialport icu' | |
- name: Install Qt(6) | |
if: ${{ matrix.qt_version != '5.15.2' }} | |
uses: jdpurcell/install-qt-action@v5 | |
with: | |
version: '${{ matrix.qt_version }}' | |
host: '${{ matrix.qt_arch }}' | |
modules: '${{ matrix.qt6_modules }}' | |
archives: 'qtbase qtwayland qttranslations qttools qtsvg icu' | |
- 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_CXX_COMPILER=${{ matrix.cpp_compiler }} | |
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }} | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DOFAPP_GITHASH=${{steps.get-short-sha.outputs.id}} | |
${{ matrix.install_prefix }} | |
-S ${{ github.workspace }} | |
- name: Build | |
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | |
run: cmake --build ${{ github.workspace }}/build --config ${{ matrix.build_type }} --parallel | |
- name: Install linuxdeploy | |
if: ${{ matrix.os != 'windows-2019' }} | |
uses: pcolby/install-linuxdeploy@v1 | |
with: | |
plugins: qt appimage | |
- name: Setup AppImage | |
if: ${{ matrix.os != 'windows-2019' }} | |
env: | |
EXTRA_PLATFORM_PLUGINS: libqwayland-generic.so | |
EXTRA_QT_MODULES: waylandcompositor | |
run: | | |
make install DESTDIR=AppDir | |
install -Dm755 "${{ github.workspace }}/img/ico/openfire.svg" "AppDir/usr/share/icons/hicolor/scalable/apps/org.TeamOpenFIRE.OpenFIREapp.svg" | |
"${{ runner.temp }}/linuxdeploy/linuxdeploy-${{ matrix.sys_arch }}.AppImage" --plugin=qt --output appimage --appdir AppDir --desktop-file "${{ github.workspace }}/org.TeamOpenFIRE.OpenFIREapp.desktop" | |
cp ${{ matrix.file }} ${{ github.workspace }} | |
working-directory: ${{ github.workspace }}/build | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
# Artifact name | |
name: OpenFIREapp-${{ matrix.pretty }}-Qt${{ matrix.qt_version }}-${{ matrix.build_type }} # optional, default is artifact | |
# A file, directory or wildcard pattern that describes what to upload | |
path: ${{ matrix.file }} | |
- name: Download a Build Artifact | |
uses: actions/download-artifact@v4 |