more fixes #228
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
name: Build and create packages | |
on: | |
push: | |
branches: | |
- main | |
- github-actions | |
tags: | |
- 'v*.*.*' # Trigger on tags that follow semantic versioning (e.g., v1.0.0) | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-cmake: | |
name: Build ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
# see https://gist.github.com/NickNaso/0d478f1481686d5bcc868cac06620a60 | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows MSVC", | |
build_dir: "windows-msvc", | |
os: windows-2022, | |
build_type: "Release", | |
cc: "cl", | |
cxx: "cl", | |
generators: "Ninja", | |
} | |
# - { | |
# name: "Windows MinGW", | |
# build_dir: "windows-mingw", | |
# os: windows-latest, | |
# build_type: "Release", | |
# cc: "gcc", | |
# cxx: "g++", | |
# generators: "Ninja" | |
# } | |
- { | |
name: "Windows Clang 16", | |
build_dir: "windows-clang", | |
os: windows-2022, | |
build_type: "Release", | |
cc: "clang", | |
cxx: "clang++", | |
generators: "Ninja", | |
} | |
- { | |
name: "Ubuntu GCC", | |
build_dir: "ubuntu-gcc", | |
os: ubuntu-22.04, | |
build_type: "Release", | |
cc: "gcc", | |
cxx: "g++", | |
generators: "Ninja", | |
} | |
- { | |
name: "Ubuntu Clang", | |
build_dir: "ubuntu-clang", | |
os: ubuntu-22.04, | |
build_type: "Release", | |
cc: "clang", | |
cxx: "clang++", | |
generators: "Ninja", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: lukka/get-cmake@latest | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: 6.7.1 | |
modules: "qt5compat" | |
cache: true | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Install cmake-format | |
run: pip3 install cmake-format | |
- name: Setup MSVC (optional) | |
if: ${{ matrix.config.cxx == 'cl' }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: Confiure | |
working-directory: ${{ github.workspace }} | |
id: runcmake | |
run: | | |
pwd | |
cmake -B "build/${{ matrix.config.build_dir }}" -G "${{ matrix.config.generators }}" -DCMAKE_BUILD_TYPE="${{ matrix.config.build_type }}" -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} | |
pwd | |
- name: Build | |
working-directory: ${{ github.workspace }} | |
id: runcmakebuild | |
run: | | |
cmake --build "build/${{ matrix.config.build_dir }}" --parallel --verbose | |
- name: Install | |
working-directory: ${{ github.workspace }} | |
id: runcmakeinstall | |
run: | | |
cmake --install "build/${{ matrix.config.build_dir }}" --prefix="dist/${{ matrix.config.build_dir }}/usr" | |
- name: Create AppImage | |
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc' | |
run: | | |
# Qt plugin does not bundle the needed plugins, do this manually | |
mkdir -p "dist/${{ matrix.config.build_dir }}/usr/plugins/iconengines/" | |
mkdir -p "dist/${{ matrix.config.build_dir }}/usr/plugins/platforms/" | |
cp -arv ${QT_ROOT_DIR}/plugins/iconengines/* "dist/${{ matrix.config.build_dir }}/usr/plugins/iconengines/" | |
cp -arv ${QT_ROOT_DIR}/plugins/platforms/libqwayland-*.so "dist/${{ matrix.config.build_dir }}/usr/plugins/platforms/" | |
export LD_LIBRARY_PATH=dist/${{ matrix.config.build_dir }}/usr/lib:$LD_LIBRARY_PATH | |
export OUTPUT=build/qtedit4-qt671-x86_64.AppImage | |
sudo apt install fuse libxkbcommon-x11-0 libxcb-cursor-dev libxkbcommon-dev | |
wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" | |
wget --no-verbose "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" | |
chmod +x linuxdeploy*.AppImage | |
./linuxdeploy-x86_64.AppImage --appdir "dist/${{ matrix.config.build_dir }}" --plugin qt --output appimage | |
- name: Upload AppImage | |
if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qtedit4-qt671-x86_64.AppImage | |
path: build/qtedit4-qt671-x86_64.AppImage | |
- name: windeployqt (Windows) | |
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | |
run: | | |
windeployqt --release --no-translations --no-system-d3d-compiler --no-compiler-runtime --no-opengl-sw dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.exe | |
- name: Create setup (Windows) | |
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | |
uses: Minionguyjpro/[email protected] | |
with: | |
path: "setup_script.iss" | |
options: /O+ | |
- name: Install WiX Toolset | |
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | |
run: | | |
choco install wixtoolset -y | |
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH | |
- name: Create MSI (Windows) | |
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | |
run: | | |
# Generate file lists using heat | |
wix heat dir dist/${{ matrix.config.build_dir }}/usr/bin -cg DLLFiles -gg -srd -sfrag -var var.DLLFiles -out DLLFiles.wxs | |
wix heat dir dist/${{ matrix.config.build_dir }}/usr/bin/generic -cg GenericDLLFiles -gg -srd -sfrag -var var.GenericDLLFiles -out GenericDLLFiles.wxs | |
wix heat dir dist/${{ matrix.config.build_dir }}/usr/share/icons/breeze -cg IconFiles -gg -srd -sfrag -var var.IconFiles -out IconFiles.wxs | |
# Build the MSI | |
wix build qtedit4.wxs DLLFiles.wxs GenericDLLFiles.wxs IconFiles.wxs -out dist/qtedit4.msi | |
- name: Upload MSI (Windows) | |
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qtedit4-qt671-x86_64.msi | |
path: dist/qtedit4.msi | |
- name: Upload Release Asset (Windows MSI) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/qtedit4-qt671-x86_64.msi/qtedit4.msi | |
asset_name: qtedit4-qt671-x86_64.msi | |
asset_content_type: application/octet-stream | |
- name: Upload setup | |
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: qtedit4-qt671-x86_64.exe | |
path: dist/qtedit4-win64.exe | |
- name: Upload MSI (Windows MSI) | |
if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./dist/qtedit4.msi | |
asset_name: qtedit4-qt671-x86_64.msi | |
asset_content_type: application/octet-stream | |
create-release: | |
needs: build-cmake | |
runs-on: ubuntu-latest | |
# if: startsWith(github.ref, 'refs/tags/v') # Trigger only on tags | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/github-actions') | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }}-${{ github.sha }} | |
release_name: Release ${{ github.ref }}-${{ github.sha }} | |
draft: true | |
prerelease: true | |
- name: Upload Release Asset (AppImage) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/qtedit4-qt671-x86_64.AppImage/qtedit4-qt671-x86_64.AppImage | |
asset_name: qtedit4-qt671-x86_64.AppImage | |
asset_content_type: application/x-executable | |
- name: Upload Release Asset (Windows Setup) | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/qtedit4-qt671-x86_64.exe/qtedit4-win64.exe | |
asset_name: qtedit4-qt671-x86_64-setup.exe | |
asset_content_type: application/vnd.microsoft.portable-executable |