-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
198 lines (179 loc) · 6.61 KB
/
Copy pathpr-master.yml
File metadata and controls
198 lines (179 loc) · 6.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- master
pull_request_review:
types: [submitted]
branches:
- master
workflow_dispatch: {}
name: PR Checks (master)
permissions:
contents: read
jobs:
check_docs:
name: Check Docs
if: >
github.repository == 'wailsapp/wails' &&
(
github.event_name == 'workflow_dispatch' ||
github.event.pull_request.base.ref == 'master'
)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Verify Changed files
uses: step-security/changed-files@3dbe17c78367e7d60f00d78ae6781a35be47b4a1 # v45.0.1
id: verify-changed-files
with:
files: |
website/**/*.mdx
website/**/*.md
- name: Run step only when files change.
if: steps.verify-changed-files.outputs.files_changed != 'true'
run: |
echo "::warning::Feature branch does not contain any changes to the website."
test_go:
name: Run Go Tests
runs-on: ${{ matrix.os }}
if: >
github.repository == 'wailsapp/wails' &&
github.event.pull_request.head.ref != 'update-sponsors' &&
(
github.event_name == 'workflow_dispatch' ||
(
github.event.pull_request.base.ref == 'master' &&
(
github.event_name == 'pull_request' ||
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
)
)
)
env:
GOWORK: "off"
strategy:
matrix:
os: [ubuntu-22.04, windows-latest, macos-latest, ubuntu-24.04]
go-version: ['1.25']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache apt archives (linux dependencies (22.04))
if: matrix.os == 'ubuntu-22.04'
uses: actions/cache@v4
with:
path: ~/.apt-archives
key: apt-install-linux-dependencies-22-04-libgtk--${{ github.job }}-${{ runner.arch }}-${{ github.run_id }}
restore-keys: |
apt-install-linux-dependencies-22-04-libgtk--${{ github.job }}-${{ runner.arch }}-
- name: Install linux dependencies (22.04)
if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update -qq
sudo mkdir -p $HOME/.apt-archives/partial
sudo apt-get -o Dir::Cache::Archives=$HOME/.apt-archives install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.0-dev build-essential pkg-config
sudo chown -R $(id -u):$(id -g) $HOME/.apt-archives
- name: Cache apt archives (linux dependencies (24.04))
if: matrix.os == 'ubuntu-24.04'
uses: actions/cache@v4
with:
path: ~/.apt-archives
key: apt-install-linux-dependencies-24-04-libgtk--${{ github.job }}-${{ runner.arch }}-${{ github.run_id }}
restore-keys: |
apt-install-linux-dependencies-24-04-libgtk--${{ github.job }}-${{ runner.arch }}-
- name: Install linux dependencies (24.04)
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get update -qq
sudo mkdir -p $HOME/.apt-archives/partial
sudo apt-get -o Dir::Cache::Archives=$HOME/.apt-archives install -y --no-install-recommends libgtk-3-dev libwebkit2gtk-4.1-dev build-essential pkg-config
sudo chown -R $(id -u):$(id -g) $HOME/.apt-archives
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
cache-dependency-path: v2/go.sum
- name: Run tests (mac)
if: matrix.os == 'macos-latest'
env:
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
working-directory: ./v2
run: go test -v ./...
- name: Run tests (!mac)
if: matrix.os != 'macos-latest' && matrix.os != 'ubuntu-24.04'
working-directory: ./v2
run: go test -v ./...
- name: Run tests (Ubuntu 24.04)
if: matrix.os == 'ubuntu-24.04'
working-directory: ./v2
run: go test -v -tags webkit2_41 ./...
# Gate job: provides the bare "Run Go Tests" check name that branch protection requires.
# The matrix job above posts "Run Go Tests (os, version)" per platform; this job
# aggregates those results under the exact name the rule expects.
test_go_gate:
name: Run Go Tests
runs-on: ubuntu-latest
needs: [test_go]
if: always()
steps:
- name: Check matrix result
run: |
result="${{ needs.test_go.result }}"
if [[ "$result" == "success" || "$result" == "skipped" ]]; then
echo "Go tests result: $result — gate passed"
else
echo "Go tests result: $result — gate failed"
exit 1
fi
# This job will run instead of test_go for the update-sponsors branch
skip_tests:
name: Skip Tests (Sponsor Update)
if: github.event.pull_request.head.ref == 'update-sponsors'
runs-on: ubuntu-latest
steps:
- name: Skip tests for sponsor updates
run: |
echo "Skipping tests for sponsor update branch"
echo "This is an automated update of the sponsors image."
continue-on-error: true
# Aggregate job that satisfies the "Run Go Tests" branch protection required check.
# Matrix jobs report as "Run Go Tests (os, version)" — no single check with the bare
# name is ever posted, so the requirement is never fulfilled without this fan-in job.
go_test_results:
name: Run Go Tests
if: >
always() &&
github.repository == 'wailsapp/wails' &&
(
github.event.pull_request.head.ref == 'update-sponsors' ||
(
github.event.pull_request.head.ref != 'update-sponsors' &&
(
github.event_name == 'workflow_dispatch' ||
(
github.event.pull_request.base.ref == 'master' &&
(
github.event_name == 'pull_request' ||
(github.event_name == 'pull_request_review' && github.event.review.state == 'approved')
)
)
)
)
)
needs: [test_go, skip_tests]
runs-on: ubuntu-latest
steps:
- run: |
test_result="${{ needs.test_go.result }}"
skip_result="${{ needs.skip_tests.result }}"
branch="${{ github.event.pull_request.head.ref }}"
if [[ "$test_result" == "success" ]]; then
exit 0
fi
if [[ "$branch" == "update-sponsors" && "$skip_result" == "success" ]]; then
exit 0
fi
echo "Go tests result: $test_result"
echo "Skip tests result: $skip_result"
exit 1