|
| 1 | +name: Build dtkdeclarative on Arch Linux |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + container: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + container: archlinux:latest |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + include: |
| 16 | + - qt_version: 5 |
| 17 | + dtk5: "ON" |
| 18 | + - qt_version: 6 |
| 19 | + dtk5: "OFF" |
| 20 | + steps: |
| 21 | + - name: Initialize pacman and system update |
| 22 | + run: | |
| 23 | + pacman-key --init |
| 24 | + pacman --noconfirm --noprogressbar -Syu |
| 25 | +
|
| 26 | + - name: Install base build tools |
| 27 | + run: | |
| 28 | + pacman -S --noconfirm --noprogressbar base-devel git cmake ninja pkgconf |
| 29 | +
|
| 30 | + - name: Install dtkdeclarative Qt5 system dependencies |
| 31 | + if: matrix.qt_version == 5 |
| 32 | + run: | |
| 33 | + pacman -S --noconfirm --noprogressbar \ |
| 34 | + qt5-base qt5-tools qt5-declarative qt5-quickcontrols2 \ |
| 35 | + qt5-wayland qt5-svg qt5-imageformats \ |
| 36 | + extra-cmake-modules \ |
| 37 | + gtest \ |
| 38 | + librsvg libraw \ |
| 39 | + libqt5xdg \ |
| 40 | + icu uchardet dbus spdlog gsettings-qt \ |
| 41 | + dtkcommon dtklog \ |
| 42 | + treeland-protocols dtkcore dtkgui |
| 43 | +
|
| 44 | + - name: Install dtkdeclarative Qt6 system dependencies |
| 45 | + if: matrix.qt_version == 6 |
| 46 | + run: | |
| 47 | + pacman -S --noconfirm --noprogressbar \ |
| 48 | + qt6-base qt6-tools qt6-declarative qt6-shadertools \ |
| 49 | + qt6-wayland qt6-svg qt6-imageformats \ |
| 50 | + extra-cmake-modules \ |
| 51 | + gtest \ |
| 52 | + librsvg libraw \ |
| 53 | + libqtxdg \ |
| 54 | + icu uchardet dbus spdlog gsettings-qt \ |
| 55 | + vulkan-headers \ |
| 56 | + dtkcommon dtk6log \ |
| 57 | + treeland-protocols dtk6core dtk6gui |
| 58 | +
|
| 59 | + - uses: actions/checkout@v4 |
| 60 | + with: |
| 61 | + fetch-depth: 0 |
| 62 | + |
| 63 | + - name: Build and install latest DTK dependencies from source |
| 64 | + run: | |
| 65 | + set -euxo pipefail |
| 66 | +
|
| 67 | + build_repo() { |
| 68 | + local repo="$1" |
| 69 | + local extra_args="${2:-}" |
| 70 | + case "${repo}" in |
| 71 | + dtkcommon|dtklog|dtkcore|dtkgui) ;; |
| 72 | + *) echo "unsupported repo: ${repo}" >&2; exit 1 ;; |
| 73 | + esac |
| 74 | + cd /tmp |
| 75 | + rm -rf "${repo}" |
| 76 | + git clone --depth=1 "https://github.com/linuxdeepin/${repo}.git" |
| 77 | + cmake -S "${repo}" -B "${repo}/build" \ |
| 78 | + -GNinja \ |
| 79 | + -DCMAKE_BUILD_TYPE=Release \ |
| 80 | + -DCMAKE_INSTALL_PREFIX=/usr \ |
| 81 | + -DBUILD_DOCS=OFF \ |
| 82 | + -DBUILD_EXAMPLES=OFF \ |
| 83 | + -DBUILD_TESTING=OFF \ |
| 84 | + ${extra_args} |
| 85 | + cmake --build "${repo}/build" -j"$(nproc)" |
| 86 | + cmake --install "${repo}/build" |
| 87 | + } |
| 88 | +
|
| 89 | + build_repo dtkcommon |
| 90 | + build_repo dtklog "-DDTK5=${{ matrix.dtk5 }}" |
| 91 | + build_repo dtkcore "-DDTK5=${{ matrix.dtk5 }}" |
| 92 | + build_repo dtkgui "-DDTK5=${{ matrix.dtk5 }}" |
| 93 | +
|
| 94 | + - name: Configure dtkdeclarative |
| 95 | + run: | |
| 96 | + set -o pipefail |
| 97 | + cmake -B build \ |
| 98 | + -GNinja \ |
| 99 | + -DCMAKE_INSTALL_PREFIX=/usr \ |
| 100 | + -DCMAKE_INSTALL_LIBDIR=lib \ |
| 101 | + -DCMAKE_BUILD_TYPE=Release \ |
| 102 | + -DMKSPECS_INSTALL_DIR=lib/qt/mkspecs/modules \ |
| 103 | + -DQML_INSTALL_DIR=lib/qt/qml \ |
| 104 | + -DBUILD_DOCS=OFF \ |
| 105 | + -DBUILD_EXAMPLES=OFF \ |
| 106 | + -DBUILD_TESTING=${{ matrix.dtk5 }} \ |
| 107 | + -DDTK5=${{ matrix.dtk5 }} 2>&1 | tee /tmp/cmake-configure.log |
| 108 | + echo "✅ Configure done" |
| 109 | +
|
| 110 | + - name: Print configure log on failure |
| 111 | + if: failure() |
| 112 | + run: | |
| 113 | + echo "=== cmake-configure.log (last 80 lines) ===" |
| 114 | + tail -80 /tmp/cmake-configure.log 2>/dev/null || echo "(not found)" |
| 115 | + tail -20 /tmp/cmake-configure.log 2>/dev/null | while IFS= read -r line; do |
| 116 | + echo "::error::$line" |
| 117 | + done |
| 118 | +
|
| 119 | + - name: Build dtkdeclarative |
| 120 | + run: | |
| 121 | + set -o pipefail |
| 122 | + cmake --build build -j$(nproc) 2>&1 | tee /tmp/cmake-build.log |
| 123 | + echo "✅ dtkdeclarative Qt${{ matrix.qt_version }} built successfully!" |
| 124 | + echo "=== Built files ===" |
| 125 | + find build -name "*.so" -o -name "*.a" | head -20 |
| 126 | +
|
| 127 | + - name: Print build log on failure |
| 128 | + if: failure() |
| 129 | + run: | |
| 130 | + echo "=== cmake-build.log (last 100 lines) ===" |
| 131 | + tail -100 /tmp/cmake-build.log 2>/dev/null || echo "(not found)" |
| 132 | + grep -E "error:|Error:|FAILED" /tmp/cmake-build.log 2>/dev/null | head -20 | while IFS= read -r line; do |
| 133 | + echo "::error::$line" |
| 134 | + done |
| 135 | +
|
| 136 | + - name: Run unit tests |
| 137 | + if: matrix.dtk5 == 'ON' |
| 138 | + run: | |
| 139 | + set -o pipefail |
| 140 | + QT_QPA_PLATFORM=offscreen ctest --test-dir build --output-on-failure --timeout 300 -j$(nproc) 2>&1 | tee /tmp/ctest.log |
| 141 | + echo "✅ dtkdeclarative Qt${{ matrix.qt_version }} tests passed!" |
| 142 | +
|
| 143 | + - name: Print test log on failure |
| 144 | + if: failure() && matrix.dtk5 == 'ON' |
| 145 | + run: | |
| 146 | + echo "=== ctest.log (last 100 lines) ===" |
| 147 | + tail -100 /tmp/ctest.log 2>/dev/null || echo "(not found)" |
| 148 | + grep -E "FAILED|Error:|The following tests FAILED" /tmp/ctest.log 2>/dev/null | head -20 | while IFS= read -r line; do |
| 149 | + echo "::error::$line" |
| 150 | + done |
| 151 | +
|
| 152 | + - name: Install dtkdeclarative to staging directory |
| 153 | + run: | |
| 154 | + DESTDIR=/tmp/dtkdeclarative-install cmake --install build |
| 155 | + echo "Total: $(find /tmp/dtkdeclarative-install -type f | wc -l) files" |
| 156 | + find /tmp/dtkdeclarative-install -type f | head -20 |
| 157 | +
|
| 158 | + - name: Print install log on failure |
| 159 | + if: failure() |
| 160 | + run: echo "::error::Install step failed — check the step output above" |
| 161 | + |
| 162 | + - name: Create installation package |
| 163 | + run: | |
| 164 | + ls -la /tmp/dtkdeclarative-install/ || { echo "Install dir missing!"; exit 1; } |
| 165 | + tar -czf /tmp/dtkdeclarative-archlinux-qt${{ matrix.qt_version }}-$(date +%Y%m%d-%H%M%S).tar.gz -C /tmp/dtkdeclarative-install . |
| 166 | + ls -la /tmp/dtkdeclarative-archlinux-qt${{ matrix.qt_version }}-*.tar.gz |
| 167 | +
|
| 168 | + - name: Upload dtkdeclarative Arch Linux build artifacts |
| 169 | + if: ${{ !env.ACT }} |
| 170 | + uses: actions/upload-artifact@v4 |
| 171 | + with: |
| 172 | + name: dtkdeclarative-archlinux-qt${{ matrix.qt_version }}-build |
| 173 | + path: "/tmp/dtkdeclarative-archlinux-qt${{ matrix.qt_version }}-*.tar.gz" |
| 174 | + if-no-files-found: error |
| 175 | + retention-days: 30 |
0 commit comments