Skip to content

fix: install flatpak tooling on Ubuntu CI runners to fix spawn flatpak ENOENT#593

Merged
cute-omega merged 13 commits intofix-flatpakfrom
copilot/fix-ubuntu-build-flatpak-tooling
Apr 13, 2026
Merged

fix: install flatpak tooling on Ubuntu CI runners to fix spawn flatpak ENOENT#593
cute-omega merged 13 commits intofix-flatpakfrom
copilot/fix-ubuntu-build-flatpak-tooling

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 12, 2026

  • Fixed invalid Flatpak app ID (dev-sidecarcn.docmirror.DevSidecar)
  • Remove the invalid flatpak: { icon: ... } block from vue.config.js (unsupported by electron-builder)
  • Delete build/mac/1024x1024.png (Flatpak max icon size is 512x512; the directory-based icon config doesn't support per-target overrides)
Original prompt

Create a PR that fixes the failing GitHub Actions job in docmirror/dev-sidecar run https://github.com/docmirror/dev-sidecar/actions/runs/24313663002/job/70987606718?pr=592.

Failure: ubuntu build step npm run electron:build fails with spawn flatpak ENOENT during electron-builder flatpak target packaging. The workflow .github/workflows/test-and-upload.yml (commit ref 91d8ed5) currently does not install flatpak tooling.

Implement Option A:

  • Update .github/workflows/test-and-upload.yml to install required flatpak tooling on Ubuntu runners before the npm run electron:build step.
  • Ensure the step prints versions for both flatpak and flatpak-builder (e.g., flatpak --version and flatpak-builder --version).
  • The job matrix runs on windows/ubuntu/macos; ensure the new step only runs on Ubuntu.

Additionally:

  • Check whether electron-builder’s flatpak target requires any additional system deps on Ubuntu runners (e.g., xdg-desktop-portal, appstream, etc.). If required to make flatpak-builder work reliably, add minimal needed packages.
  • If there are other workflow files or scripts that run electron-builder on Ubuntu, update them too so CI is consistent.

Acceptance criteria:

  • CI no longer fails with spawn flatpak ENOENT.
  • Logs show flatpak and flatpak-builder versions during the run.
  • Keep changes minimal and focused.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The job is failing during the Linux (ubuntu-latest) Electron build when electron-builder tries to create a Flatpak package, but the runner doesn’t have the flatpak binary installed.

What failed (from logs)

The build reaches the Flatpak target and then dies with:

  • NestedError: Cannot cleanup
  • Error: spawn flatpak ENOENT

That error means: the process tried to execute flatpak, but it’s not on PATH.

Where it’s triggered (workflow)

In .github/workflows/test-and-upload.yml (ref: 91d8ed568ec805b0170607be09ebb2b962ad1bca), the Linux build step runs:

  • npm run electron:build (in packages/gui)

…and later the workflow expects .flatpak artifacts to exist and uploads them. So Flatpak is intended to be produced on Ubuntu, but the environment isn’t prepared for it.


Solution options (pick one)

Option A (recommended): Install Flatpak on Ubuntu before building

Add a step before npm run electron:build that installs Flatpak (and typically flatpak-builder too).

Patch for .github/workflows/test-and-upload.yml (ref: 91d8ed568ec805b0170607be09ebb2b962ad1bca), insert before the "npm run electron:build" step:

      - name: Install Flatpak tooling (Ubuntu)
        if: ${{ matrix.os == 'ubuntu' }}
        run: |
          sudo apt-get update
          sudo apt-get install -y flatpak flatpak-builder
          flatpak --version

This resolves spawn flatpak ENOENT by ensuring the binary exists on the runner.

Option B: Disable Flatpak output in CI (if Flatpak isn’t required)

If you don’t need Flatpak artifacts from CI, change your Electron build config (likely in packages/gui electron-builder config) to not build the flatpak target on Linux, and remove/guard the Flatpak rename + upload steps in the workflow.

A minimal workflow-only mitigation (keeps build working, skips upload failures) would be to remove these Linux lines:

  • Rename: mv ...-x86_64.flatpak, ...-arm64.flatpak, ...-armv7l.flatpak
  • Upload: the three Upload ... .flatpak steps

But note: this does not fix the build itself if electron-builder is still configured to produce Flatpak; it just avoids expecting the files. To truly fix, you must also stop electron-builder from attempting Flatpak.


Why this is the correct fix

The failure is not a JS/TS code issue; it’s a missing system dependency on ubuntu-latest. electron-builder invokes external tooling for some targets (Flatpak being one of them). Installing the required OS packages (Option A) aligns the runner environment with what the build expects and should make the Ubuntu job succeed without changing your app code.

User: Try your option A. After installing flatpak tools, show flatpak and flatpak-builder's version. Make a pull request for it. You may need to edit all relative files not only test-and-upload.yml

Assistant: I’ve initiated the pull request workflow to add an Ubuntu-only step that installs Flatpak + flatpak-builder and prints both versions, and we’re now waiting for your confirmation in the approval dialog to proceed with creating the PR and applying the changes.

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix failing GitHub Actions job by installing flatpak tooling fix: install flatpak tooling on Ubuntu CI runners to fix spawn flatpak ENOENT Apr 12, 2026
Copilot AI requested a review from cute-omega April 12, 2026 18:53
@cute-omega
Copy link
Copy Markdown
Collaborator

Merge the origin/master branch, in which it has solved C++ 17 problems. Then you can make a new commit to trigger the CI/CD. @copilot

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 12, 2026

Merge the origin/master branch, in which it has solved C++ 17 problems. Then you can make a new commit to trigger the CI/CD. @copilot

Done — merged origin/master (commit f69b9c9, which includes the C++17 compiler flag fixes from PR #592) into this branch in commit 5a4cf80. CI should now be triggered.

@cute-omega cute-omega marked this pull request as ready for review April 12, 2026 19:03
Copilot AI review requested due to automatic review settings April 12, 2026 19:03
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Ubuntu CI failures when electron-builder attempts to build the Flatpak target by ensuring the required Flatpak tooling is installed on Ubuntu GitHub Actions runners before npm run electron:build.

Changes:

  • Add an Ubuntu-only step to install flatpak and flatpak-builder (plus supporting packages) before the Electron build.
  • Print flatpak and flatpak-builder versions in CI logs to aid troubleshooting.
  • Apply the same fix consistently across both CI workflows that run npm run electron:build.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/workflows/test-and-upload.yml Installs Flatpak tooling on Ubuntu runners immediately before npm run electron:build and prints versions.
.github/workflows/build-and-release.yml Mirrors the same Ubuntu-only Flatpak tooling install/version logging step for consistency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cute-omega cute-omega changed the base branch from master to fix-flatpak April 12, 2026 20:14
@cute-omega
Copy link
Copy Markdown
Collaborator

Why doesn't it trigger any CI/CD? Although the target branch of this PR has changed in order not to mess master branch up, CI/CD is still needed.

@cute-omega
Copy link
Copy Markdown
Collaborator

为什么没有触发任何 CI/CD?虽然为了不影响主分支,此 PR 的目标分支已经更改,但仍然需要 CI/CD。

@copilot

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 12, 2026

为什么没有触发任何 CI/CD?虽然为了不影响主分支,此 PR 的目标分支已经更改,但仍然需要 CI/CD。

@copilot

The CI wasn't triggering because the test-and-upload.yml workflow's pull_request trigger only fires for PRs targeting master, develop, or 1.x — not fix-flatpak. Fixed in commit b018eef by adding fix-flatpak to the pull_request branches list. This push should now trigger the CI workflow.

Add 'fix*' branch pattern to trigger workflows
@cute-omega cute-omega merged commit f47fc12 into fix-flatpak Apr 13, 2026
@cute-omega cute-omega deleted the copilot/fix-ubuntu-build-flatpak-tooling branch April 13, 2026 10:15
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.

【非glibc的linux】能发布一个真正通用的版本吗

3 participants