Skip to content

[Deepin-Kernel-SIG] [linux 6.18.y] ci: Add workflow to build loonggpu DKMS module against the kernel - #2076

Open
opsiff wants to merge 1 commit into
deepin-community:linux-6.18.yfrom
opsiff:linux-6.18.y-2026-08-12-ci
Open

[Deepin-Kernel-SIG] [linux 6.18.y] ci: Add workflow to build loonggpu DKMS module against the kernel#2076
opsiff wants to merge 1 commit into
deepin-community:linux-6.18.yfrom
opsiff:linux-6.18.y-2026-08-12-ci

Conversation

@opsiff

@opsiff opsiff commented Aug 12, 2026

Copy link
Copy Markdown
Member

Build the loonggpu DKMS package on every push and pull request so that DRM/KAPI changes breaking the out-of-tree module build (e.g. the drm_buddy_* and drm_fb_helper_*_fbi renames) are caught early.

The DKMS source is taken from the deepin package pool: the workflow fetches the directory index of the loonggpu-kernel-dkms pool, picks the newest loong64 deb and unpacks it, so DKMS package updates require no changes to this file. The kernel is cross-compiled the same way as in build-kernel-loong64.yml to provide headers and Module.symvers, then the DKMS module is built through its own Makefile entry point (with its conftest-based API detection), which is equivalent to the compile step of a dkms build.

Assisted-by: kimi:Kimi-K3

Summary by Sourcery

CI:

  • Introduce a GitHub Actions workflow that cross-compiles the loongarch kernel and builds the loonggpu DKMS module on pushes, pull requests, and manual dispatch, failing early on incompatible DRM/KAPI changes.

Build the loonggpu DKMS package on every push and pull request so that
DRM/KAPI changes breaking the out-of-tree module build (e.g. the
drm_buddy_* and drm_fb_helper_*_fbi renames) are caught early.

The DKMS source is taken from the deepin package pool: the workflow
fetches the directory index of the loonggpu-kernel-dkms pool, picks the
newest loong64 deb and unpacks it, so DKMS package updates require no
changes to this file. The kernel is cross-compiled the same way as in
build-kernel-loong64.yml to provide headers and Module.symvers, then
the DKMS module is built through its own Makefile entry point (with
its conftest-based API detection), which is equivalent to the compile
step of a dkms build.

Assisted-by: kimi:Kimi-K3
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@sourcery-ai

sourcery-ai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds a GitHub Actions workflow that cross-compiles the loongarch kernel and then builds the out-of-tree loonggpu DKMS module on every push, PR, and manual dispatch to detect DRM/KAPI incompatibilities early.

Sequence diagram for the build-dkms-loonggpu CI workflow

sequenceDiagram
  actor Developer
  participant GitHub
  participant Runner
  participant DeepinRepo
  participant KernelTree
  participant DKMS_Source

  Developer->>GitHub: push / pull_request / workflow_dispatch
  GitHub->>Runner: start build-dkms-loonggpu job

  Runner->>GitHub: actions_checkout@v6 (path kernel)
  GitHub-->>Runner: kernel source

  Runner->>DeepinRepo: curl LOONGGPU_DKMS_POOL index
  DeepinRepo-->>Runner: deb listing
  Runner->>DeepinRepo: curl loonggpu-kernel-dkms_<version>_loong64.deb
  DeepinRepo-->>Runner: DKMS deb
  Runner->>DKMS_Source: dpkg-deb -x loonggpu-dkms.deb
  Runner->>DKMS_Source: locate Makefile in usr/src/loonggpu-*

  Runner->>KernelTree: make deepin_loongarch_desktop_defconfig
  Runner->>KernelTree: make ARCH=loongarch CROSS_COMPILE=loongarch64-linux-gnu-

  Runner->>DKMS_Source: make modules SYSSRC=kernel ARCH=loongarch CROSS_COMPILE=loongarch64-linux-gnu-

  Runner->>Runner: rm -rf dkms_workdir
Loading

File-Level Changes

Change Details Files
Introduce a CI workflow to build the loonggpu DKMS module against the repository kernel on pushes and pull requests.
  • Create .github/workflows/build-dkms-loonggpu.yml with a job running on a self-hosted x64 Linux runner
  • Configure workflow triggers for push, pull_request, and manual workflow_dispatch events
  • Set environment variables for reproducible kernel builds and the loonggpu DKMS package pool URL
  • Enable concurrency control to cancel in-progress runs for the same ref
  • Restrict workflow permissions to read-only for pull requests
.github/workflows/build-dkms-loonggpu.yml
Automate retrieval and unpacking of the latest loonggpu DKMS package from the deepin package pool.
  • Create a temporary working directory in /tmp for DKMS artifacts to avoid cross-job conflicts
  • Fetch the pool directory index and select the newest loonggpu-kernel-dkms loong64 .deb via version-aware sorting
  • Download the selected .deb and extract it with dpkg-deb
  • Locate the DKMS source directory under usr/src and export its path as dkms_src to GITHUB_ENV, with validation that a Makefile exists
.github/workflows/build-dkms-loonggpu.yml
Cross-compile the loongarch kernel to provide headers and Module.symvers for the DKMS build.
  • Check out the kernel source into a kernel subdirectory
  • Run make with ARCH=loongarch and CROSS_COMPILE=loongarch64-linux-gnu- using deepin_loongarch_desktop_defconfig
  • Perform a parallel build with -j$(nproc) to generate the kernel image, headers, and Module.symvers
.github/workflows/build-dkms-loonggpu.yml
Build the loonggpu DKMS module using its own Makefile entry point against the freshly built kernel.
  • Invoke make modules in the DKMS source directory with SYSSRC pointing to the checked-out kernel tree
  • Pass ARCH and CROSS_COMPILE to match the kernel build configuration
  • Use the module’s conftest-based API detection to adapt to DRM/KAPI changes, equating this step to dkms build’s compile phase
.github/workflows/build-dkms-loonggpu.yml
Ensure cleanup of temporary DKMS work directory after workflow execution.
  • Store the mktemp-created workdir in dkms_workdir via GITHUB_ENV
  • Add a final cleanup step that always runs and removes the temporary directory
.github/workflows/build-dkms-loonggpu.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • The logic that fetches and selects the newest loonggpu-kernel-dkms deb from the package pool should defensively filter by architecture and expected filename pattern to avoid accidentally picking an unintended artifact if the index format changes.
  • Consider factoring out the cross-compilation steps shared with build-kernel-loong64.yml into a reusable composite action or a shared job template to reduce duplication and keep kernel build configuration consistent across workflows.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The logic that fetches and selects the newest loonggpu-kernel-dkms deb from the package pool should defensively filter by architecture and expected filename pattern to avoid accidentally picking an unintended artifact if the index format changes.
- Consider factoring out the cross-compilation steps shared with build-kernel-loong64.yml into a reusable composite action or a shared job template to reduce duplication and keep kernel build configuration consistent across workflows.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds CI validation for loonggpu DKMS compatibility with the LoongArch kernel.

Changes:

  • Downloads and extracts the latest loonggpu DKMS package.
  • Cross-compiles the kernel and builds the external module.
  • Cleans temporary build files.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


on:
push:
pull_request:
Comment on lines +45 to +48
deb=$(curl -fsSL "$LOONGGPU_DKMS_POOL/" \
| grep -oE 'loonggpu-kernel-dkms_[^"]*_loong64\.deb' \
| sort -uV | tail -1)
[ -n "$deb" ] || { echo "no loonggpu-kernel-dkms deb found in $LOONGGPU_DKMS_POOL"; exit 1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants