Skip to content

ci: speed up GitHub Actions workflows - #5149

Merged
leaanthony merged 2 commits into
v3-alphafrom
feature/ci-speed-improvements-v2
Apr 14, 2026
Merged

leaanthony merged 2 commits into
v3-alphafrom
feature/ci-speed-improvements-v2

Conversation

@leaanthony

@leaanthony leaanthony commented Apr 14, 2026 •

Copy link
Copy Markdown
Member

Summary

CI audit (LEA-37) identified several workflow inefficiencies. This PR applies targeted fixes to reduce wall-clock time and eliminate the root cause of p95 spikes.

2 files changed, 33 insertions, 40 deletions.

Recommendations Table

Finding Workflow Change Est. Saving
No-op check_approval gate serialises test_js startup with no benefit (approved output never used) build-and-test-v3 Remove job; remove from needs: ~30–60s queue overhead per run
dbus-update-activation-environment --systemd hangs without a systemd user session — root cause of 22-min ubuntu test spikes build-and-test-v3 Replace with dbus-run-session -- on both GTK3 and GTK4 steps Up to 15 min off p95
No job timeout on test_go — a hung dbus/xvfb session runs forever build-and-test-v3 Add timeout-minutes: 25 + -timeout 10m to go test Caps worst case
No npm cache on test_js — npm ci downloads all packages fresh every run build-and-test-v3 actions/cache@v4 on ~/.npm keyed on package-lock.json hash ~20–40s/run
test_go if: condition was github.event.review.state == 'approved' — tests never ran on regular PR pushes pr-master Fix to github.event_name == 'pull_request' || review.state == 'approved' Tests now run on every push
Missing types: filter on pull_request trigger pr-master Add types: [opened, synchronize, reopened] Prevents double-trigger on some events
actions/checkout@v3 and setup-go@v3 are outdated; no Go module/build cache active pr-master Upgrade to @v4 / @v5 with cache-dependency-path: v2/go.sum Go cache now active
Raw apt-get update && apt-get install uncached on every v2 PR run pr-master Switch to awalsh128/cache-apt-pkgs-action (already used in v3 workflow) ~30s per Linux job

Expected Impact

Build + Test v3:

  • test_js starts immediately (no check_approval gate)
  • Ubuntu Go tests: median ~8 min → ~8 min, p95 ~22 min → ~10 min (dbus hang eliminated)
  • Overall median wall-clock: ~37 min → ~25 min

PR Checks (master):

  • Tests now run on every PR push (previously broken — only ran on approval)
  • Go module + build cache active

Notes

  • All YAML validated before push
  • dbus-run-session ships with the dbus package, available on all GitHub-hosted ubuntu runners
  • pr-master.yml changes affect the master branch workflow; both files exist on v3-alpha and are included in this PR for a single clean review
  • Workflow trigger events (on:) are not changed in build-and-test-v3

Summary by CodeRabbit

  • Chores
    • Updated CI workflows and Actions versions.
    • Removed an approval gating job so tests run more broadly on PR activity.
    • Broadened PR triggers for test runs and simplified run conditions.
    • Improved caching for JS, Go, and system packages.
    • Added tighter test timeouts and adjusted test-run session handling for reliability.

build-and-test-v3:
- Remove no-op check_approval gate that serialised test_js startup
  without ever conditioning on its approved output
- Remove check_approval from test_go needs (now only needs test_js)
- Add npm cache (actions/cache@v4 on ~/.npm) before npm ci in test_js,
  keyed on package-lock.json hash
- Add timeout-minutes: 25 to test_go job
- Add -timeout 10m flag to all go test invocations
- Fix ubuntu xvfb/dbus: replace dbus-update-activation-environment
  --systemd (hangs without systemd user session, root cause of 22-min
  spikes) with dbus-run-session which starts a clean session daemon;
  applies to both GTK3 and GTK4 test steps

pr-master:
- Fix test_go condition: was approval-only (github.event.review.state
  == 'approved'), so tests never ran on regular PR pushes; now runs on
  all pull_request events too
- Add types filter to pull_request trigger
- Upgrade actions/checkout v3 → v4 (both jobs)
- Upgrade actions/setup-go v3 → v5 with cache-dependency-path
- Replace bare apt-get with awalsh128/cache-apt-pkgs-action (saves
  ~30s per Linux job on cache hit, consistent with v3 workflow)
@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Removed the approval gate from CI, decoupled test job dependencies, added npm and apt caching, upgraded GitHub Actions, and tightened Go test timeouts and session invocation across workflows. (50 words)

Changes

Cohort / File(s) Summary
Build & Test v3 workflow
/.github/workflows/build-and-test-v3.yml
Removed check_approval job and its gating; test_js no longer needs approval; test_go now depends on test_js only and gained timeout-minutes: 25; added actions/cache@v4 npm cache; added -timeout 10m to Go tests; replaced xvfb-run wrapper with dbus-run-session -- xvfb-run; switched Ubuntu GTK4 apt install to awalsh128/cache-apt-pkgs-action@latest.
PR / Master workflow
/.github/workflows/pr-master.yml
Expanded pull_request event types for test_go; removed unconditional review-approved requirement and instead allowlisted PR/review events; upgraded actions/checkout@v3→@v4 and actions/setup-go@v3→@v5; switched Ubuntu apt installs to awalsh128/cache-apt-pkgs-action@latest and added Go dependency cache path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

github_actions, v3-alpha

Suggested reviewers

  • atterpac

Poem

🐰 I hopped through CI, gates undone,

Caches tucked—npm and apt—what fun!
Tests now sprint with tighter time,
Sessions wrapped in cleaner rhyme.
A rabbit cheers: the pipeline's run! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is comprehensive and detailed, covering summary, methodology, expected impact, and notes. However, it does not follow the repository's required template structure, missing completion of the template sections like issue reference, type of change, testing verification, and the checklist items. Fill out the required template sections: add 'Fixes #' reference, select type of change, describe testing performed, include test configuration output from 'wails doctor', and complete all checklist items including changelog and self-review.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: optimization of GitHub Actions workflows to improve performance and reduce execution time.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/ci-speed-improvements-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Deploying wails with  Cloudflare Pages  Cloudflare Pages

Latest commit: 76eee17
Status:🚫  Build failed.

View logs

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

@leaanthony
leaanthony marked this pull request as ready for review April 14, 2026 12:27
Copilot AI review requested due to automatic review settings April 14, 2026 12:27

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/pr-master.yml (1)

5-5: Add ready_for_review to PR trigger types.

Draft PRs marked ready for review will not trigger this workflow without it. The ready_for_review activity type must be explicitly listed alongside opened, synchronize, and reopened to handle draft-to-ready transitions.

Suggested change
-    types: [opened, synchronize, reopened]
+    types: [opened, synchronize, reopened, ready_for_review]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-master.yml at line 5, The workflow trigger currently
lists types: [opened, synchronize, reopened] and misses the ready_for_review
event, so add "ready_for_review" to that array (i.e., change the types value
used in the PR trigger block to include ready_for_review alongside opened,
synchronize, and reopened) so draft->ready transitions fire this workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/pr-master.yml:
- Around line 54-58: Replace the mutable reference "uses:
awalsh128/cache-apt-pkgs-action@latest" with the immutable commit SHA "uses:
awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05" for
both occurrences of the cache-apt-pkgs-action in the workflow so the action is
pinned to a fixed commit SHA instead of `@latest`; update every instance of the
string so both usages are consistent.

---

Nitpick comments:
In @.github/workflows/pr-master.yml:
- Line 5: The workflow trigger currently lists types: [opened, synchronize,
reopened] and misses the ready_for_review event, so add "ready_for_review" to
that array (i.e., change the types value used in the PR trigger block to include
ready_for_review alongside opened, synchronize, and reopened) so draft->ready
transitions fire this workflow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: be2b0a5d-ef9e-45fc-98d1-75a34fa7cc98

📥 Commits

Reviewing files that changed from the base of the PR and between 5d38171 and 04d4127.

📒 Files selected for processing (2)
  • .github/workflows/build-and-test-v3.yml
  • .github/workflows/pr-master.yml

Comment on lines +54 to +58
uses: awalsh128/cache-apt-pkgs-action@latest
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
version: 1.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Current workflow refs:"
rg -nP 'uses:\s*awalsh128/cache-apt-pkgs-action@' .github/workflows

echo
echo "Recent upstream tags and commit SHAs:"
curl -s https://api.github.com/repos/awalsh128/cache-apt-pkgs-action/tags \
  | jq -r '.[0:10][] | "\(.name)\t\(.commit.sha)"'

Repository: wailsapp/wails

Length of output: 1255


Pin awalsh128/cache-apt-pkgs-action to an immutable commit SHA.

Using @latest is mutable and undermines reproducibility and security. Pin both occurrences (lines 54 and 61) to a stable commit SHA. Current latest is acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 (from v1.6.0).

Proposed hardening
-        uses: awalsh128/cache-apt-pkgs-action@latest
+        uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
uses: awalsh128/cache-apt-pkgs-action@latest
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
version: 1.0
uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05
if: matrix.os == 'ubuntu-22.04'
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
version: 1.0
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/pr-master.yml around lines 54 - 58, Replace the mutable
reference "uses: awalsh128/cache-apt-pkgs-action@latest" with the immutable
commit SHA "uses:
awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05" for
both occurrences of the cache-apt-pkgs-action in the workflow so the action is
pinned to a fixed commit SHA instead of `@latest`; update every instance of the
string so both usages are consistent.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 targets CI wall-clock improvements and reliability by reducing unnecessary workflow serialization, adding caching, and hardening Linux GUI test execution to avoid DBus-related hangs and unbounded job runtimes.

Changes:

  • Simplifies build-and-test-v3 by removing the no-op approval gate, adding npm caching, adding job/test timeouts, and replacing dbus-update-activation-environment with dbus-run-session for Linux test stability.
  • Fixes pr-master Go test job gating so tests run on PR pushes (and on approval reviews), adds a pull_request.types filter, and upgrades/adjusts actions to enable caching and speed up Linux dependency installs.

Reviewed changes

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

File Description
.github/workflows/pr-master.yml Adjusts PR triggers, fixes test job if: logic, upgrades checkout/setup-go, and adds cached apt installs for Linux runners.
.github/workflows/build-and-test-v3.yml Removes unused approval job, adds npm cache, adds job/test timeouts, and updates Linux test execution to use dbus-run-session with xvfb-run.

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

Comment on lines 53 to +58
- name: Install linux dependencies (22.04)
uses: awalsh128/cache-apt-pkgs-action@latest
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
with:
packages: libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
version: 1.0

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

Using awalsh128/cache-apt-pkgs-action@latest makes the workflow non-deterministic and introduces supply-chain risk (the action can change without a PR). Pin this to a specific release tag (or preferably a commit SHA) and bump intentionally when needed.

Copilot uses AI. Check for mistakes.
Comment on lines 165 to 169
- name: Run tests (ubuntu) - GTK3 default
if: matrix.os == 'ubuntu-latest'
working-directory: v3
run: >
xvfb-run --auto-servernum
sh -c '
dbus-update-activation-environment --systemd --all &&
go test -v ./...
'
run: dbus-run-session -- xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" go test -v -timeout 10m ./...

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

dbus-run-session is now a hard dependency for the Linux test steps, but the Linux dependency install list doesn't explicitly install a package that provides it. To avoid failures if the runner image changes, add the appropriate package (e.g., dbus/dbus-x11, depending on Ubuntu packaging) to the apt packages list or add a preflight check with a clear error message.

Copilot uses AI. Check for mistakes.
Comment on lines 170 to +174
- name: Run tests (ubuntu) - GTK4
if: matrix.os == 'ubuntu-latest'
working-directory: v3
# Skip service tests that hang in CI due to GTK4 display requirements
run: >
xvfb-run --auto-servernum
sh -c '
dbus-update-activation-environment --systemd --all &&
go test -tags gtk4 -v -skip "TestService" ./...
'
run: dbus-run-session -- xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" go test -tags gtk4 -v -timeout 10m -skip "TestService" ./...

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

Same as the GTK3 step: these tests now rely on dbus-run-session, but it's not guaranteed by the explicit apt install list. Consider installing the package that provides dbus-run-session to keep the workflow resilient across runner image updates.

Copilot uses AI. Check for mistakes.

on:
pull_request:
types: [opened, synchronize, reopened]

Copilot AI Apr 14, 2026

Copy link

Choose a reason for hiding this comment

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

pull_request trigger is now limited to [opened, synchronize, reopened], which means checks will not run when a draft PR is marked "Ready for review" (ready_for_review event). If the intent is to keep draft PRs from running, consider adding ready_for_review here so checks start automatically once the PR is ready, or document that a new push is required to trigger CI.

Suggested change
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened, ready_for_review]

Copilot uses AI. Check for mistakes.
libwebkitgtk-6.0-dev can hit slow apt mirrors, causing 32-41 min installs
instead of the normal ~0.1 min. Use awalsh128/cache-apt-pkgs-action for
libgtk-4-dev and libwebkitgtk-6.0-dev (same as GTK3 deps already do) to
eliminate this flakiness in both test_go and test_templates jobs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Missing Changelog Update

Hi @leaanthony, please update v3/UNRELEASED_CHANGELOG.md with a description of your changes.

This helps us keep track of changes for the next release.

@leaanthony
leaanthony merged commit ae96d8b into v3-alpha Apr 14, 2026
12 of 15 checks passed
@leaanthony
leaanthony deleted the feature/ci-speed-improvements-v2 branch April 14, 2026 13:56
leaanthony added a commit that referenced this pull request Apr 14, 2026
)

- Upgrade actions/checkout v3 → v4 in both check_docs and test_go
- Upgrade actions/setup-go v3 → v5 with cache-dependency-path: v2/go.sum
  (enables Go module and build cache, was missing previously)
- Replace bare apt-get update/install with awalsh128/cache-apt-pkgs-action
  for ubuntu-22.04 and ubuntu-24.04 (saves ~30s per Linux job on cache hit,
  consistent with how v3 workflows handle Linux deps)

The test_go condition and trigger types were already correct on master.
Companion to #5149 which makes equivalent changes on the v3-alpha branch.

Co-authored-by: Wails Documentation Agent <agent@wails.local>
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.

2 participants