Create cmake-multi-platform.yml #15
Workflow file for this run
This file contains 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
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. | |
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml | |
name: CMake on multiple platforms | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
workflow_call: | |
inputs: | |
build_type: | |
description: Type of build (Debug, Release, RelWithDebInfo, MinSizeRel) | |
type: string | |
default: Debug | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
qt_host: linux | |
qt_version: '6.6.0' | |
qt_modules: 'qt6-multimedia-dev' | |
- os: windows-2022 | |
name: "Windows" | |
msystem: mingw64 | |
qt_ver: 6 | |
runs-on: ${{ matrix.os }} | |
env: | |
INSTALL_DIR: "install" | |
INSTALL_APPIMAGE_DIR: "install-appdir" | |
BUILD_DIR: "build" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set reusable strings | |
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. | |
id: strings | |
shell: bash | |
run: | | |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" | |
- name: 'Setup MSYS2' | |
if: runner.os == 'Windows' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.msystem }} | |
update: true | |
install: >- | |
git | |
pacboy: >- | |
toolchain:p | |
cmake:p | |
extra-cmake-modules:p | |
ninja:p | |
qt${{ matrix.qt_ver }}-base:p | |
qt${{ matrix.qt_ver }}-multimedia:p | |
protobuf | |
- name: 'Install Qt 6.6.0' | |
if: runner.os == 'Linux' | |
uses: jurplel/[email protected] | |
with: | |
version: 6.6.0 | |
modules: qtmultimedia | |
- name: 'Checkout wpilib' | |
uses: actions/checkout@v4 | |
with: | |
repository: 'wpilibsuite/allwpilib' | |
ref: 'v2024.1.1-beta-3' # MAY want 2023 | |
path: 'allwpilib' | |
- name: 'Install Python Dependencies (Windows)' | |
if: runner.os == 'Windows' | |
shell: msys2 {0} | |
run: | | |
python3 -m ensurepip | |
python3 -m pip install jinja2 | |
- name: 'Install Python Dependencies (Linux)' | |
if: runner.os == 'Linux' | |
run: | | |
pip install jinja2 | |
- name: 'Build ntcore (Linux)' | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get install libprotobuf-dev libstdc++-10-dev gcc-10 | |
cmake -B wpilib_build -S "allwpilib" \ | |
-DCMAKE_INSTALL_PREFIX='/usr' \ | |
-DUSE_SYSTEM_EIGEN=OFF \ | |
-DUSE_SYSTEM_FMTLIB=OFF \ | |
-DWITH_JAVA=OFF \ | |
-DWITH_CSCORE=OFF \ | |
-DWITH_NTCORE=ON \ | |
-DWITH_WPIMATH=OFF \ | |
-DWITH_WPILIB=OFF \ | |
-DWITH_TESTS=OFF \ | |
-DWITH_GUI=OFF \ | |
-DWITH_SIMULATION_MODULES=OFF \ | |
-Wno-dev | |
cmake --build wpilib_build | |
sudo cmake --install wpilib_build | |
- name: 'Build ntcore (Windows)' | |
if: runner.os == 'Windows' | |
shell: msys2 {0} | |
run: | | |
cmake -B wpilib_build_win -S "allwpilib" \ | |
-DCMAKE_INSTALL_PREFIX='/usr' \ | |
-DUSE_SYSTEM_EIGEN=OFF \ | |
-DUSE_SYSTEM_FMTLIB=OFF \ | |
-DWITH_JAVA=OFF \ | |
-DWITH_CSCORE=OFF \ | |
-DWITH_NTCORE=ON \ | |
-DWITH_WPIMATH=OFF \ | |
-DWITH_WPILIB=OFF \ | |
-DWITH_TESTS=OFF \ | |
-DWITH_GUI=OFF \ | |
-DWITH_SIMULATION_MODULES=OFF \ | |
-Wno-dev | |
cmake --build wpilib_build_win | |
sudo cmake --install wpilib_build_win | |
- name: Prepare AppImage (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" | |
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage" | |
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" | |
- name: Configure CMake (Windows) | |
if: runner.os == 'Windows' | |
shell: msys2 {0} | |
run: | | |
cmake -S . -B ${{ env.BUILD_DIR }} \ | |
-DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} \ | |
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ | |
-DENABLE_LTO=ON \ | |
-G Ninja | |
- name: Configure CMake (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
cmake -S . -B ${{ env.BUILD_DIR }} \ | |
-DCMAKE_INSTALL_PREFIX=/usr \ | |
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} \ | |
-DENABLE_LTO=ON | |
-G Ninja | |
- name: Build | |
if: runner.os != 'Windows' | |
run: | | |
cmake --build ${{ env.BUILD_DIR }} | |
- name: Build (Windows) | |
if: runner.os == 'Windows' | |
shell: msys2 {0} | |
run: | | |
cmake --build ${{ env.BUILD_DIR }} | |
# - name: Test | |
# working-directory: ${{ steps.strings.outputs.build-output-dir }} | |
# # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). | |
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
# run: ctest --build-config ${{ matrix.build_type }} | |
- name: Package (Windows) | |
if: runner.os == 'Windows' | |
shell: msys2 {0} | |
run: | | |
cmake --install ${{ env.BUILD_DIR }} | |
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_DIR }} --component portable | |
- name: Package (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_DIR }} | |
cd ${{ env.INSTALL_DIR }} | |
tar --owner root --group root -czf ../QFRCDashboard.tar.gz * | |
- name: Package AppImage (Linux) | |
if: runner.os == 'Linux' | |
shell: bash | |
run: | | |
cmake --install ${{ env.BUILD_DIR }} --prefix ${{ env.INSTALL_APPIMAGE_DIR }}/usr | |
export OUTPUT="QFRCDashboard-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage" | |
chmod +x linuxdeploy-*.AppImage | |
mkdir -p ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines | |
cp -r /home/runner/work/QFRCDashboard/Qt/${{ matrix.qt_version }}/gcc_64/plugins/iconengines/* ${{ env.INSTALL_APPIMAGE_DIR }}/usr/plugins/iconengines | |
cp /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}/usr/lib/ | |
cp /usr/lib/x86_64-linux-gnu/libssl.so.1.1 ${{ env.INSTALL_APPIMAGE_DIR }}//usr/lib/ | |
./linuxdeploy-x86_64.AppImage --appdir ${{ env.INSTALL_APPIMAGE_DIR }} --output appimage --plugin qt |