From a888ae38328d0cdab66197010fa51c34c52ecc72 Mon Sep 17 00:00:00 2001 From: zhaofangxun Date: Thu, 12 Nov 2026 15:32:22 +0800 Subject: [PATCH] ci: add unit tests GitHub Actions workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add .github/workflows/unit-tests.yml to run unit tests on push/PR 2. Use ubuntu-22.04 runner with deepin crimson container for deps 3. Build with appropriate build system and run test suite Influence: 1. Verify workflow triggers on push to master and pull requests 2. Confirm unit tests execute and report results correctly 3. Check dependency installation completes without errors ci: 添加单元测试 GitHub Actions 工作流 1. 添加 .github/workflows/unit-tests.yml 在 push/PR 时运行单元测试 2. 使用 ubuntu-22.04 runner 和 deepin crimson 容器安装依赖 3. 使用对应构建系统构建并运行测试套件 Influence: 1. 验证工作流在 push 到 master 和 PR 时正确触发 2. 确认单元测试执行并正确报告结果 3. 检查依赖安装无错误完成 --- .github/workflows/unit-tests.yml | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 000000000..547981b5a --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,68 @@ +# SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: CC0-1.0 + +name: Unit Tests + +on: + push: + branches: [master] + pull_request: + branches: [master] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + unit-test: + name: Build and Run Unit Tests + runs-on: ubuntu-22.04 + container: linuxdeepin/deepin:crimson + + steps: + - name: Checkout source + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup apt sources + run: | + set -euxo pipefail + echo "deb [trusted=yes] http://mirrors.kernel.org/deepin/beige/ crimson main commercial community" > /etc/apt/sources.list + echo "deb-src [trusted=yes] http://mirrors.kernel.org/deepin/beige/ crimson main commercial community" >> /etc/apt/sources.list + rm -rf /etc/apt/sources.list.d + apt-get update + + - name: Install build dependencies + run: | + set -euxo pipefail + apt-get install -y --no-install-recommends \ + build-essential g++ \ + devscripts equivs git cmake pkg-config \ + qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools \ + qt6-declarative-dev qt6-declarative-private-dev \ + qt6-svg-dev qt6-l10n-tools \ + qt6-wayland-dev qt6-wayland-private-dev qt6-wayland-dev-tools \ + libdtkcommon-dev libdtk6core-dev libdtk6core-bin \ + libdtk6gui-dev libdtk6declarative libdtk6widget-dev \ + dde-api-dev dde-tray-loader-dev \ + dde-application-manager-api \ + extra-cmake-modules \ + libgtest-dev libgmock-dev \ + libicu-dev \ + libxcb-ewmh-dev libxcb-icccm4-dev libxcb-res0-dev \ + libxcb-util-dev libxcb1-dev libxcb-shape0-dev \ + libxtst-dev libyaml-cpp-dev \ + libqt6svg6 \ + qml6-module-qtquick-controls2-styles-chameleon \ + systemd wlr-protocols wayland-protocols treeland-protocols + + - name: Configure + run: cmake -B build -DBUILD_TESTING=ON + + - name: Build tests + run: cmake --build build -- -j$(nproc) + + - name: Run tests + run: ctest --test-dir build --output-on-failure \ No newline at end of file