Skip to content

Commit d8314bb

Browse files
authored
Merge branch 'master' into fix/5752-macos27-tray-click-event-coercion
2 parents 36d3f5a + 1b8f20d commit d8314bb

102 files changed

Lines changed: 5211 additions & 1456 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
#
3+
# GitHub's Ubuntu runner images preinstall Microsoft's apt repositories (azure-cli and the
4+
# packages.microsoft.com prod repo). Wails uses neither, and when that host serves a 403 for
5+
# them - see https://github.com/wailsapp/wails/issues/6040 - `apt-get update` fails and takes
6+
# the whole job down with it. Dropping the two list files makes our CI independent of it.
7+
#
8+
# Only do this on ephemeral GitHub-hosted VMs. On a self-hosted runner, or on a developer's
9+
# machine running these workflows locally with `act`, /etc/apt belongs to the host: deleting
10+
# real apt sources there is destructive and not something a CI job should do.
11+
set -euo pipefail
12+
13+
if [ "${ACT:-}" = "true" ] || [ "${RUNNER_ENVIRONMENT:-}" != "github-hosted" ]; then
14+
echo "Leaving apt sources untouched (ACT=${ACT:-unset}, RUNNER_ENVIRONMENT=${RUNNER_ENVIRONMENT:-unset})."
15+
exit 0
16+
fi
17+
18+
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list /etc/apt/sources.list.d/azure-cli.list

.github/workflows/build-and-test-v3.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ jobs:
108108
- name: Install linux dependencies (GTK4 default)
109109
if: matrix.os == 'ubuntu-latest'
110110
run: |
111+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
112+
./.github/scripts/prune-runner-apt-sources.sh
111113
sudo apt-get update -qq
112114
sudo apt-get install -y --no-install-recommends libgtk-4-dev libwebkitgtk-6.0-dev libwayland-dev build-essential pkg-config xvfb x11-xserver-utils at-spi2-core xdg-desktop-portal-gtk
113115
@@ -219,6 +221,8 @@ jobs:
219221
- name: Install linux dependencies (GTK4 default)
220222
if: matrix.os == 'ubuntu-latest'
221223
run: |
224+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
225+
./.github/scripts/prune-runner-apt-sources.sh
222226
sudo apt-get update -qq
223227
sudo apt-get install -y --no-install-recommends libgtk-4-dev libwebkitgtk-6.0-dev libwayland-dev build-essential pkg-config
224228

.github/workflows/build-and-test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ jobs:
2727
- name: Install apt packages (ubuntu-22.04)
2828
if: matrix.os == 'ubuntu-22.04'
2929
run: |
30+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
31+
./.github/scripts/prune-runner-apt-sources.sh
3032
sudo apt-get update -qq
3133
sudo apt-get install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
3234
3335
- name: Install apt packages (ubuntu-24.04)
3436
if: matrix.os == 'ubuntu-24.04'
3537
run: |
38+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
39+
./.github/scripts/prune-runner-apt-sources.sh
3640
sudo apt-get update -qq
3741
sudo apt-get install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config libegl1
3842
@@ -130,6 +134,8 @@ jobs:
130134
- name: Install apt packages (ubuntu-22.04)
131135
if: matrix.os == 'ubuntu-22.04'
132136
run: |
137+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
138+
./.github/scripts/prune-runner-apt-sources.sh
133139
sudo apt-get update -qq
134140
sudo apt-get install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
135141
@@ -140,6 +146,8 @@ jobs:
140146
- name: Install apt packages (ubuntu-24.04)
141147
if: matrix.os == 'ubuntu-24.04'
142148
run: |
149+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
150+
./.github/scripts/prune-runner-apt-sources.sh
143151
sudo apt-get update -qq
144152
sudo apt-get install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config libegl1
145153

.github/workflows/build-cross-image.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ jobs:
162162

163163
- name: Install Linux dev dependencies
164164
run: |
165+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
166+
./.github/scripts/prune-runner-apt-sources.sh
165167
sudo apt-get update
166168
sudo apt-get install -y libgtk-4-dev libwebkitgtk-6.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev libwayland-dev
167169

.github/workflows/changelog-v3.yml

Lines changed: 67 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,32 @@ jobs:
1616
validate:
1717
runs-on: ubuntu-latest
1818
if: github.repository == 'wailsapp/wails'
19+
outputs:
20+
pr_number: ${{ steps.pr_info.outputs.pr_number }}
21+
result: ${{ steps.validate.outputs.result }}
1922
env:
2023
GOWORK: "off"
2124
permissions:
22-
contents: write
23-
pull-requests: write
24-
actions: write
25+
contents: read
2526

2627
steps:
2728
- name: Checkout PR code
2829
uses: actions/checkout@v4
2930
with:
3031
ref: ${{ github.event.pull_request.head.sha || format('refs/pull/{0}/head', github.event.inputs.pr_number) }}
3132
fetch-depth: 0
32-
token: ${{ secrets.GITHUB_TOKEN || github.token }}
33+
persist-credentials: false
3334

34-
- name: Get validation script from master
35+
- name: Select validation script
3536
run: |
3637
echo "Fetching the validation script from master branch..."
3738
git fetch origin master
38-
git checkout origin/master -- v3/scripts/validate-changelog.go
39+
40+
if git diff --quiet origin/master...HEAD -- v3/scripts/validate-changelog.go v3/scripts/validate-changelog_test.go; then
41+
git checkout origin/master -- v3/scripts/validate-changelog.go
42+
else
43+
echo "The PR updates the validator; retaining that version for focused tests."
44+
fi
3945
4046
echo "Validation script fetched successfully:"
4147
ls -la v3/scripts/
@@ -44,6 +50,12 @@ jobs:
4450
uses: actions/setup-go@v4
4551
with:
4652
go-version: '1.25'
53+
54+
- name: Test validation script changes
55+
run: |
56+
if ! git diff --quiet origin/master...HEAD -- v3/scripts/validate-changelog.go v3/scripts/validate-changelog_test.go; then
57+
go test v3/scripts/validate-changelog.go v3/scripts/validate-changelog_test.go
58+
fi
4759
4860
- name: Get PR information
4961
id: pr_info
@@ -75,145 +87,74 @@ jobs:
7587
if: steps.changelog_check.outputs.changelog_modified == 'true'
7688
run: |
7789
echo "Getting diff for changelog changes..."
78-
git diff origin/${{ steps.pr_info.outputs.base_ref }}..HEAD docs/src/content/docs/changelog.mdx | grep "^+" | grep -v "^+++" | sed 's/^+//' > /tmp/pr_added_lines.txt
90+
git diff origin/${{ steps.pr_info.outputs.base_ref }}..HEAD docs/src/content/docs/changelog.mdx > /tmp/pr_changelog.diff
91+
awk '/^\+\+\+/ { next } /^\+/ { sub(/^\+/, ""); print }' /tmp/pr_changelog.diff > /tmp/pr_added_lines.txt
92+
awk '/^---/ { next } /^-/ { sub(/^-/, ""); print }' /tmp/pr_changelog.diff > /tmp/pr_deleted_lines.txt
93+
git show origin/${{ steps.pr_info.outputs.base_ref }}:docs/src/content/docs/changelog.mdx > /tmp/base_changelog.mdx
7994
8095
echo "Lines added in this PR:"
8196
cat /tmp/pr_added_lines.txt
8297
echo "Total lines added: $(wc -l < /tmp/pr_added_lines.txt)"
98+
99+
echo "Lines deleted in this PR:"
100+
cat /tmp/pr_deleted_lines.txt
101+
echo "Total lines deleted: $(wc -l < /tmp/pr_deleted_lines.txt)"
83102
84103
- name: Validate changelog
85104
id: validate
86105
if: steps.changelog_check.outputs.changelog_modified == 'true'
87106
run: |
88107
echo "Running changelog validation..."
89108
cd v3/scripts
90-
OUTPUT=$(go run validate-changelog.go ../../docs/src/content/docs/changelog.mdx /tmp/pr_added_lines.txt 2>&1)
109+
if ! OUTPUT=$(go run validate-changelog.go ../../docs/src/content/docs/changelog.mdx /tmp/pr_added_lines.txt /tmp/pr_deleted_lines.txt /tmp/base_changelog.mdx 2>&1); then
110+
echo "$OUTPUT"
111+
exit 1
112+
fi
91113
echo "$OUTPUT"
92114
93115
RESULT=$(echo "$OUTPUT" | grep "VALIDATION_RESULT=" | cut -d'=' -f2)
94116
echo "result=$RESULT" >> $GITHUB_OUTPUT
95117
96-
- name: Commit fixes
97-
id: commit_fixes
98-
if: steps.validate.outputs.result == 'fixed'
99-
run: |
100-
echo "Committing automatic fixes..."
101-
git config --local user.email "action@github.com"
102-
git config --local user.name "GitHub Action"
103-
104-
# Check only the changelog file for changes
105-
if git diff --quiet docs/src/content/docs/changelog.mdx; then
106-
echo "No changes to commit"
107-
echo "committed=false" >> $GITHUB_OUTPUT
108-
else
109-
# Ensure validation script doesn't get committed
110-
echo "v3/scripts/validate-changelog.go" >> .git/info/exclude
111-
# Get the correct branch name to push to
112-
REPO_OWNER="wailsapp" # Always wailsapp for this repo
113-
114-
if [ "${{ github.event_name }}" = "pull_request" ]; then
115-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
116-
else
117-
# For manual workflow dispatch, get PR info
118-
PR_INFO=$(gh pr view ${{ steps.pr_info.outputs.pr_number }} --json headRefName,headRepository)
119-
BRANCH_NAME=$(echo "$PR_INFO" | jq -r '.headRefName')
120-
HEAD_REPO=$(echo "$PR_INFO" | jq -r '.headRepository.name')
121-
122-
echo "🔍 PR source branch: $BRANCH_NAME"
123-
echo "🔍 Head repository: $HEAD_REPO"
124-
125-
# Don't push if this is from a fork or if branch is master (main branch)
126-
if [ "$HEAD_REPO" != "wails" ] || [ "$BRANCH_NAME" = "master" ]; then
127-
echo "⚠️ Cannot push - either fork or master branch. Manual fix required."
128-
echo "committed=false" >> $GITHUB_OUTPUT
129-
exit 0
130-
fi
131-
fi
132-
133-
echo "Pushing to branch: $BRANCH_NAME in repo: $REPO_OWNER"
134-
135-
# Only commit the changelog changes, not the validation script
136-
git add docs/src/content/docs/changelog.mdx
137-
git commit -m "🤖 Fix changelog: move entries to Unreleased section"
138-
139-
# Only push if running on the main wailsapp repository
140-
if [ "${{ github.repository }}" = "wailsapp/wails" ]; then
141-
# Pull latest changes and rebase our commit
142-
git fetch origin $BRANCH_NAME
143-
git rebase origin/$BRANCH_NAME
144-
git push origin HEAD:$BRANCH_NAME
145-
else
146-
echo "⚠️ Running on fork (${{ github.repository }}). Skipping push - manual fix required."
147-
echo "committed=false" >> $GITHUB_OUTPUT
148-
exit 0
149-
fi
150-
151-
echo "committed=true" >> $GITHUB_OUTPUT
152-
echo "✅ Changes committed and pushed"
153-
fi
154-
env:
155-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
156-
157-
- name: Get PR author for tagging
158-
id: pr_author
159-
if: steps.validate.outputs.result && github.event.inputs.pr_number
118+
- name: Fail if validation failed
119+
if: steps.validate.outputs.result && steps.validate.outputs.result != 'success'
160120
run: |
161-
PR_AUTHOR=$(gh pr view ${{ steps.pr_info.outputs.pr_number }} --json author --jq '.author.login')
162-
echo "author=$PR_AUTHOR" >> $GITHUB_OUTPUT
163-
env:
164-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
echo "❌ Changelog validation failed"
122+
exit 1
165123
124+
report:
125+
needs: validate
126+
if: always() && github.event.inputs.pr_number && needs.validate.outputs.result
127+
runs-on: ubuntu-latest
128+
permissions:
129+
contents: read
130+
issues: write
131+
pull-requests: read
132+
133+
steps:
166134
- name: Comment on PR
167-
if: steps.validate.outputs.result && github.event.inputs.pr_number
168135
uses: actions/github-script@v7
136+
env:
137+
PR_NUMBER: ${{ needs.validate.outputs.pr_number }}
138+
VALIDATION_RESULT: ${{ needs.validate.outputs.result }}
169139
with:
170140
script: |
171-
const result = '${{ steps.validate.outputs.result }}';
172-
const committed = '${{ steps.commit_fixes.outputs.committed }}';
173-
const author = '${{ steps.pr_author.outputs.author }}';
174-
175-
let message;
176-
if (result === 'success') {
177-
message = '## ✅ Changelog Validation Passed\n\nNo misplaced changelog entries detected.';
178-
} else if (result === 'fixed' && committed === 'true') {
179-
message = '## 🔧 Changelog Updated\n\nMisplaced entries were automatically moved to the `[Unreleased]` section. The changes have been committed to this PR.';
180-
} else if (result === 'fixed' || result === 'cannot_fix' || result === 'error') {
181-
// Read the fixed changelog content
182-
const fs = require('fs');
183-
let fixedContent = '';
184-
try {
185-
fixedContent = fs.readFileSync('docs/src/content/docs/changelog.mdx', 'utf8');
186-
} catch (error) {
187-
fixedContent = 'Error reading fixed changelog content';
188-
}
189-
190-
message = '## ⚠️ Changelog Validation Issue\\n\\n' +
191-
'@' + author + ' Your PR contains changelog entries that were added to already-released versions. These need to be moved to the `[Unreleased]` section.\\n\\n' +
192-
(committed === 'true' ?
193-
'✅ **Auto-fix applied**: The changes have been automatically committed to this PR.' :
194-
'❌ **Manual fix required**: Please apply the changes shown below manually.') + '\\n\\n' +
195-
'<details>\\n' +
196-
'<summary>📝 Click to see the corrected changelog content</summary>\\n\\n' +
197-
'```mdx\\n' +
198-
fixedContent +
199-
'\\n```\\n\\n' +
200-
'</details>\\n\\n' +
201-
'**What happened?** \\n' +
202-
'The validation script detected that you added changelog entries to a version section that has already been released (like `v3.0.0-alpha.10`). All new entries should go in the `[Unreleased]` section under the appropriate category (`### Added`, `### Fixed`, etc.).\\n\\n' +
203-
(committed !== 'true' ? '**Action needed:** Please copy the corrected content from above and replace your changelog file.' : '');
204-
}
205-
206-
if (message) {
207-
await github.rest.issues.createComment({
208-
issue_number: ${{ steps.pr_info.outputs.pr_number }},
209-
owner: context.repo.owner,
210-
repo: context.repo.repo,
211-
body: message
212-
});
213-
}
214-
215-
- name: Fail if validation failed
216-
if: steps.validate.outputs.result == 'cannot_fix' || steps.validate.outputs.result == 'error'
217-
run: |
218-
echo "❌ Changelog validation failed"
219-
exit 1
141+
const prNumber = Number(process.env.PR_NUMBER);
142+
const result = process.env.VALIDATION_RESULT;
143+
const { data: pr } = await github.rest.pulls.get({
144+
owner: context.repo.owner,
145+
repo: context.repo.repo,
146+
pull_number: prNumber,
147+
});
148+
149+
const message = result === 'success'
150+
? '## ✅ Changelog Validation Passed\n\nNo misplaced changelog entries detected.'
151+
: '## ⚠️ Changelog Validation Issue\n\n@' + pr.user.login +
152+
' your PR contains changelog entries outside `[Unreleased]`. ' +
153+
'The validation job is read-only; apply the correction manually and rerun it.';
154+
155+
await github.rest.issues.createComment({
156+
issue_number: prNumber,
157+
owner: context.repo.owner,
158+
repo: context.repo.repo,
159+
body: message,
160+
});

.github/workflows/cross-compile-test-v3.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ jobs:
8888

8989
- name: Install Linux dependencies
9090
run: |
91+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
92+
./.github/scripts/prune-runner-apt-sources.sh
9193
sudo apt-get update -qq
9294
sudo apt-get install -y --no-install-recommends libgtk-4-dev libwebkitgtk-6.0-dev libgtk-3-dev libwebkit2gtk-4.1-dev libwayland-dev build-essential pkg-config
9395

.github/workflows/pr-master.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,16 @@ jobs:
6868
- name: Install linux dependencies (22.04)
6969
if: matrix.os == 'ubuntu-22.04'
7070
run: |
71+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
72+
./.github/scripts/prune-runner-apt-sources.sh
7173
sudo apt-get update -qq
7274
sudo apt-get install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
7375
7476
- name: Install linux dependencies (24.04)
7577
if: matrix.os == 'ubuntu-24.04'
7678
run: |
79+
# Drop the runner image's unused Microsoft apt repos (no-op off GitHub-hosted runners).
80+
./.github/scripts/prune-runner-apt-sources.sh
7781
sudo apt-get update -qq
7882
sudo apt-get install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config
7983

0 commit comments

Comments
 (0)