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: Build and create packages | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - github-actions | ||
| tags: | ||
| - 'v*' | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| build-cmake: | ||
| name: Build ${{ matrix.config.name }} Qt ${{ matrix.qt_version }} | ||
| runs-on: ${{ matrix.config.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| config: | ||
| - name: "Windows MSVC" | ||
| build_dir: "windows-msvc" | ||
| os: windows-2022 | ||
| cc: "cl" | ||
| cxx: "cl" | ||
| - name: "Windows Clang" | ||
| build_dir: "windows-clang" | ||
| os: windows-2022 | ||
| cc: "clang" | ||
| cxx: "clang++" | ||
| - name: "Ubuntu GCC" | ||
| build_dir: "linux-gcc" | ||
| os: ubuntu-22.04 | ||
| cc: "gcc" | ||
| cxx: "g++" | ||
| - name: "Ubuntu Clang" | ||
| build_dir: "linux-clang" | ||
| os: ubuntu-22.04 | ||
| cc: "clang" | ||
| cxx: "clang++" | ||
| - name: "macOS" | ||
| build_dir: "macos" | ||
| os: macos-latest | ||
| cc: "clang" | ||
| cxx: "clang++" | ||
| qt_version: | ||
| - "6.9.1" | ||
| include: | ||
| - generators: "Ninja" | ||
| - build_type: "Release" | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: lukka/get-cmake@latest | ||
| with: | ||
| cmakeVersion: "~3.31.0" | ||
| - name: Install Qt | ||
| uses: jurplel/install-qt-action@v4.1.1 | ||
| with: | ||
| version: ${{ matrix.qt_version }} | ||
| modules: "qt5compat" | ||
| cache: true | ||
| - uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
| - name: Install cmake-format | ||
| run: pip3 install cmake-format | ||
| - name: Set up Clang 19.1.7 | ||
| if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'clang' | ||
| uses: egor-tensin/setup-clang@v1 | ||
| with: | ||
| version: 19.1.7 | ||
| platform: x64 | ||
| - name: Install missing packages (linux) | ||
| if: matrix.config.os == 'ubuntu-22.04' | ||
| run: sudo apt install libcups2-dev | ||
| - name: Setup MSVC (Windows) | ||
| if: ${{ matrix.config.cxx == 'cl' }} | ||
| uses: ilammy/msvc-dev-cmd@v1 | ||
| - name: Configure | ||
| working-directory: ${{ github.workspace }} | ||
| id: runcmake | ||
| run: cmake -B "build/${{ matrix.config.build_dir }}" -G "${{ matrix.generators }}" -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} | ||
| - 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: Set version tag or commit SHA | ||
| id: version | ||
| run: | | ||
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | ||
| echo "version=${GITHUB_REF##refs/tags/}" >> $GITHUB_ENV | ||
| else | ||
| echo "version=${GITHUB_SHA::7}" >> $GITHUB_ENV | ||
| fi | ||
| shell: bash | ||
| - name: Create TGZ archive (Linux) | ||
| if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc' | ||
| run: | | ||
| mkdir -p dist/qtedit4/ | ||
| ln -s ../${{ matrix.config.build_dir }}/usr/ "dist/qtedit4/qtedit4-${{ matrix.config.build_dir }}-${{ env.version }}" | ||
| tar -czhf "dist/qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz" -C "dist/qtedit4/" . | ||
| shell: bash | ||
| - name: Create AppImage (Linux) | ||
| if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc' | ||
| run: | | ||
| 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-qt${{ matrix.qt_version }}-${{ env.version }}-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 (Linux) | ||
| if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.AppImage | ||
| path: build/qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.AppImage | ||
| - name: Upload TGZ archive (Linux) | ||
| if: matrix.config.os == 'ubuntu-22.04' && matrix.config.cc == 'gcc' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz | ||
| path: "dist/qtedit4-${{ matrix.config.build_dir }}-qt${{ matrix.qt_version }}-${{ env.version }}.tar.gz" | ||
| - 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/Inno-Setup-Action@v1.2.4 | ||
| with: | ||
| path: "setup_script.iss" | ||
| options: /O+ | ||
| - name: Rename and upload setup (Windows) | ||
| if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | ||
| run: | | ||
| copy dist\qtedit4-win64.exe dist\qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.exe | ||
| shell: cmd | ||
| - name: Upload renamed setup (Windows) | ||
| if: matrix.config.os == 'windows-2022' && matrix.config.cc == 'cl' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.exe | ||
| path: dist/qtedit4-qt${{ matrix.qt_version }}-${{ env.version }}-x86_64.exe | ||
| - name: macdeployqt (macOS) | ||
| if: matrix.config.os == 'macos-latest' | ||
| run: | | ||
| # First, find where the actual binary was installed | ||
| echo "Looking for qtedit4 binary:" | ||
| find "dist/${{ matrix.config.build_dir }}" -name "qtedit4" -type f | ||
| # Check if we have an app bundle or just a binary | ||
| if [ -d "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app" ]; then | ||
| echo "Found existing app bundle" | ||
| APP_PATH="dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app" | ||
| else | ||
| echo "Creating app bundle structure" | ||
| APP_PATH="dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app" | ||
| mkdir -p "$APP_PATH/Contents/MacOS" | ||
| mkdir -p "$APP_PATH/Contents/Resources" | ||
| mkdir -p "$APP_PATH/Contents/Frameworks" | ||
| mkdir -p "$APP_PATH/Contents/PlugIns" | ||
| # Copy the binary to the app bundle | ||
| if [ -f "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4" ]; then | ||
| cp "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4" "$APP_PATH/Contents/MacOS/" | ||
| chmod +x "$APP_PATH/Contents/MacOS/qtedit4" | ||
| echo "Copied binary to app bundle" | ||
| else | ||
| echo "ERROR: Could not find qtedit4 binary!" | ||
| exit 1 | ||
| fi | ||
| # Create Info.plist | ||
| cat > "$APP_PATH/Contents/Info.plist" << EOF | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>CFBundleExecutable</key> | ||
| <string>qtedit4</string> | ||
| <key>CFBundleIdentifier</key> | ||
| <string>com.qtedit4.app</string> | ||
| <key>CFBundleName</key> | ||
| <string>QTEdit4</string> | ||
| <key>CFBundleVersion</key> | ||
| <string>1.0</string> | ||
| <key>CFBundleShortVersionString</key> | ||
| <string>1.0</string> | ||
| <key>CFBundlePackageType</key> | ||
| <string>APPL</string> | ||
| </dict> | ||
| </plist> | ||
| EOF | ||
| fi | ||
| # Copy resources to the app bundle | ||
| if [ -d "resources" ]; then | ||
| cp -r resources/* "$APP_PATH/Contents/Resources/" | ||
| echo "Copied resources to app bundle" | ||
| fi | ||
| # Verify binary is in place | ||
| echo "Checking for binary in app bundle:" | ||
| ls -la "$APP_PATH/Contents/MacOS/" | ||
| # Run macdeployqt | ||
| echo "Running macdeployqt..." | ||
| macdeployqt "$APP_PATH" -verbose=2 -always-overwrite | ||
| # Verify Qt frameworks were bundled | ||
| echo "App bundle contents after macdeployqt:" | ||
| ls -la "$APP_PATH/Contents/" | ||
| if [ -d "$APP_PATH/Contents/Frameworks" ]; then | ||
| echo "Bundled Qt Frameworks:" | ||
| ls -la "$APP_PATH/Contents/Frameworks/" | ||
| else | ||
| echo "WARNING: No Frameworks directory found!" | ||
| fi | ||
| # Check app bundle size | ||
| echo "Final app bundle size:" | ||
| du -sh "$APP_PATH" | ||
| - name: Create ZIP archive (macOS) | ||
| if: matrix.config.os == 'macos-latest' | ||
| run: | | ||
| cd "dist/${{ matrix.config.build_dir }}/usr/bin" | ||
| zip -r "../../../../qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.zip" qtedit4.app | ||
| shell: bash | ||
| - name: Create DMG (macOS) | ||
| if: matrix.config.os == 'macos-latest' | ||
| run: | | ||
| # Install create-dmg if not available | ||
| brew install create-dmg | ||
| # Verify app bundle size before DMG creation | ||
| echo "Final app bundle size before DMG creation:" | ||
| du -sh "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app" | ||
| # Create a temporary directory for DMG contents | ||
| mkdir -p dmg_temp | ||
| cp -r "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app" dmg_temp/ | ||
| # Verify copied app size | ||
| echo "App size in DMG temp directory:" | ||
| du -sh dmg_temp/qtedit4.app | ||
| # Create the DMG with larger initial size | ||
| create-dmg \ | ||
| --volname "QTEdit4" \ | ||
| --volicon "dist/${{ matrix.config.build_dir }}/usr/bin/qtedit4.app/Contents/Resources/qtedit4.icns" \ | ||
| --window-pos 200 120 \ | ||
| --window-size 600 300 \ | ||
| --icon-size 100 \ | ||
| --icon "qtedit4.app" 175 120 \ | ||
| --hide-extension "qtedit4.app" \ | ||
| --app-drop-link 425 120 \ | ||
| --disk-image-size 500 \ | ||
| --skip-jenkins \ | ||
| "qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" \ | ||
| "dmg_temp/" || true | ||
| # Fallback: create simple DMG if create-dmg fails, with larger size | ||
| if [ ! -f "qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" ]; then | ||
| echo "create-dmg failed, using hdiutil fallback..." | ||
| hdiutil create -volname "QTEdit4" -srcfolder dmg_temp -ov -format UDZO -fs HFS+ -size 500m "qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" | ||
| fi | ||
| # Verify final DMG size | ||
| echo "Final DMG size:" | ||
| ls -lh "qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.dmg" | ||
| - name: Upload ZIP archive (macOS) | ||
| if: matrix.config.os == 'macos-latest' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.zip | ||
| path: qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.zip | ||
| - name: Upload DMG (macOS) | ||
| if: matrix.config.os == 'macos-latest' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.dmg | ||
| path: qtedit4-macos-100-qt${{ matrix.qt_version }}-${{ env.version }}.dmg | ||
| create-release: | ||
| name : Draft GitHub Release | ||
| needs : build-cmake | ||
| runs-on : ubuntu-latest | ||
| env : | ||
| GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} | ||
| if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | ||
| steps : | ||
| - uses : actions/checkout@v4 | ||
| - name : Download all artifacts | ||
| uses : actions/download-artifact@v4 | ||
| with : | ||
| merge-multiple : true | ||
| path : ./artifacts | ||
| - name : Create Draft Release | ||
| run : | | ||
| gh release create ${{ github.ref_name }} --title ${{ github.ref_name }} --generate-notes --draft | ||
| - name : Upload assets to release | ||
| run : | | ||
| gh release upload ${{ github.ref_name }} ./artifacts/* | ||