Skip to content

Commit 3e2bb4e

Browse files
committed
run musescore and audacity app builds automatically on every PR
1 parent 5a48cf5 commit 3e2bb4e

2 files changed

Lines changed: 17 additions & 82 deletions

File tree

‎.github/pull_request_template.md‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ Resolves: #NNNNN <!-- Replace `NNNNN` with a GitHub issue number, or a direct li
1616

1717
## Build configuration
1818
<!--
19-
Comment `/build` on this PR to dispatch consumer-app builds against this
20-
framework PR. Edit the lines below to override defaults; remove the
21-
section entirely to use defaults.
19+
Consumer-app builds run automatically for every PR. Edit the lines below to
20+
override defaults; remove the section entirely to use defaults.
2221
2322
Format: {owner}/{repo}/{branch} (any public fork works).
2423
2524
Available platforms (space-separated):
2625
audacity: linux_x64 macos windows_x64
27-
musescore: linux_x64 linux_arm64 macos windows_x64 windows_portable
26+
musescore: linux_x64 macos windows_x64
2827
-->
2928
audacity: audacity/audacity/master
3029
audacity platforms: linux_x64

‎.github/workflows/pr_dispatch.yml‎

Lines changed: 14 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
1-
name: pr_dispatch
1+
name: Applications Build
22

33
on:
4-
issue_comment:
5-
types: [created]
4+
pull_request:
5+
types: [opened, reopened, synchronize, edited]
66

77
permissions:
8-
pull-requests: write
98
contents: read
10-
statuses: write
119

1210
concurrency:
13-
group: pr-dispatch-${{ github.event.issue.number }}
11+
group: pr-dispatch-${{ github.event.pull_request.number }}
1412
cancel-in-progress: true
1513

1614
jobs:
1715
parse:
18-
if: >-
19-
github.event.issue.pull_request != null
20-
&& startsWith(github.event.comment.body, '/build')
21-
&& contains(fromJSON('["OWNER","MEMBER","COLLABORATOR"]'), github.event.comment.author_association)
16+
name: Configure
2217
runs-on: ubuntu-latest
2318
outputs:
2419
head_sha: ${{ steps.pr.outputs.head_sha }}
@@ -31,19 +26,10 @@ jobs:
3126
mu_branch: ${{ steps.cfg.outputs.mu_branch }}
3227
mu_platforms: ${{ steps.cfg.outputs.mu_platforms }}
3328
steps:
34-
- name: React with eyes
35-
env:
36-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
run: |
38-
gh api -X POST \
39-
"repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions" \
40-
-f content=eyes
4129
- name: Fetch PR
4230
id: pr
43-
env:
44-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4531
run: |
46-
pr_json=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}")
32+
pr_json=$(jq -c '.pull_request' "$GITHUB_EVENT_PATH")
4733
head_sha=$(echo "$pr_json" | jq -r .head.sha)
4834
echo "head_sha=$head_sha" >> "$GITHUB_OUTPUT"
4935
echo "$pr_json" | jq -r .body > /tmp/pr_body.txt
@@ -84,28 +70,9 @@ jobs:
8470
echo "mu_branch=$mu_branch"
8571
echo "mu_platforms=$mu_platforms"
8672
} >> "$GITHUB_OUTPUT"
87-
- name: Post pending statuses + run-link comment
88-
env:
89-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90-
SHA: ${{ steps.pr.outputs.head_sha }}
91-
AU_PLATFORMS: ${{ steps.cfg.outputs.au_platforms }}
92-
MU_PLATFORMS: ${{ steps.cfg.outputs.mu_platforms }}
93-
run: |
94-
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
95-
post_pending() {
96-
gh api -X POST "repos/${{ github.repository }}/statuses/$SHA" \
97-
-f state=pending -f context="$1" -f target_url="$RUN_URL" -f description="dispatched"
98-
}
99-
[[ "$AU_PLATFORMS" == *linux_x64* ]] && post_pending "build / Audacity Linux"
100-
[[ "$AU_PLATFORMS" == *macos* ]] && post_pending "build / Audacity macOS"
101-
[[ "$AU_PLATFORMS" == *windows_x64* ]] && post_pending "build / Audacity Windows"
102-
[[ "$MU_PLATFORMS" =~ linux_(x64|arm64) ]] && post_pending "build / MuseScore Linux"
103-
[[ "$MU_PLATFORMS" == *macos* ]] && post_pending "build / MuseScore macOS"
104-
[[ "$MU_PLATFORMS" =~ windows_(x64|portable) ]] && post_pending "build / MuseScore Windows"
105-
gh pr comment "${{ github.event.issue.number }}" --repo "${{ github.repository }}" \
106-
--body "Build dispatched: $RUN_URL"
10773
10874
build_au_linux:
75+
name: Audacity Linux
10976
needs: parse
11077
if: contains(needs.parse.outputs.au_platforms, 'linux_x64')
11178
uses: audacity/audacity/.github/workflows/au4_build_linux.yml@master
@@ -116,6 +83,7 @@ jobs:
11683
framework_ref: ${{ needs.parse.outputs.head_sha }}
11784

11885
build_au_macos:
86+
name: Audacity macOS
11987
needs: parse
12088
if: contains(needs.parse.outputs.au_platforms, 'macos')
12189
uses: audacity/audacity/.github/workflows/au4_build_macos.yml@master
@@ -126,6 +94,7 @@ jobs:
12694
framework_ref: ${{ needs.parse.outputs.head_sha }}
12795

12896
build_au_windows:
97+
name: Audacity Windows
12998
needs: parse
13099
if: contains(needs.parse.outputs.au_platforms, 'windows_x64')
131100
uses: audacity/audacity/.github/workflows/au4_build_windows.yml@master
@@ -136,18 +105,20 @@ jobs:
136105
framework_ref: ${{ needs.parse.outputs.head_sha }}
137106

138107
build_mu_linux:
108+
name: MuseScore Linux
139109
needs: parse
140-
if: contains(needs.parse.outputs.mu_platforms, 'linux_x64') || contains(needs.parse.outputs.mu_platforms, 'linux_arm64')
110+
if: contains(needs.parse.outputs.mu_platforms, 'linux_x64')
141111
uses: musescore/MuseScore/.github/workflows/build_linux.yml@main
142112
with:
143113
app_repo: ${{ needs.parse.outputs.mu_owner }}/${{ needs.parse.outputs.mu_repo }}
144114
app_ref: ${{ needs.parse.outputs.mu_branch }}
145115
framework_repo: ${{ github.repository }}
146116
framework_ref: ${{ needs.parse.outputs.head_sha }}
147-
platforms: ${{ needs.parse.outputs.mu_platforms }}
117+
platforms: linux_x64
148118
build_mode: devel
149119

150120
build_mu_macos:
121+
name: MuseScore macOS
151122
needs: parse
152123
if: contains(needs.parse.outputs.mu_platforms, 'macos')
153124
uses: musescore/MuseScore/.github/workflows/build_macos.yml@main
@@ -159,6 +130,7 @@ jobs:
159130
build_mode: devel
160131

161132
build_mu_windows:
133+
name: MuseScore Windows
162134
needs: parse
163135
if: contains(needs.parse.outputs.mu_platforms, 'windows_x64') || contains(needs.parse.outputs.mu_platforms, 'windows_portable')
164136
uses: musescore/MuseScore/.github/workflows/build_windows.yml@main
@@ -169,39 +141,3 @@ jobs:
169141
framework_ref: ${{ needs.parse.outputs.head_sha }}
170142
platforms: ${{ needs.parse.outputs.mu_platforms }}
171143
build_mode: devel
172-
173-
report:
174-
needs: [parse, build_au_linux, build_au_macos, build_au_windows, build_mu_linux, build_mu_macos, build_mu_windows]
175-
if: always() && needs.parse.result == 'success'
176-
runs-on: ubuntu-latest
177-
steps:
178-
- name: Forward final statuses to PR head
179-
env:
180-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181-
SHA: ${{ needs.parse.outputs.head_sha }}
182-
AU_LINUX: ${{ needs.build_au_linux.result }}
183-
AU_MACOS: ${{ needs.build_au_macos.result }}
184-
AU_WINDOWS: ${{ needs.build_au_windows.result }}
185-
MU_LINUX: ${{ needs.build_mu_linux.result }}
186-
MU_MACOS: ${{ needs.build_mu_macos.result }}
187-
MU_WINDOWS: ${{ needs.build_mu_windows.result }}
188-
run: |
189-
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
190-
post() {
191-
local context="$1" result="$2" state
192-
case "$result" in
193-
success) state=success ;;
194-
skipped) return 0 ;;
195-
cancelled) state=error ;;
196-
*) state=failure ;;
197-
esac
198-
gh api -X POST "repos/${{ github.repository }}/statuses/$SHA" \
199-
-f state="$state" -f context="$context" -f target_url="$RUN_URL" \
200-
-f description="$context: $result"
201-
}
202-
post "build / Audacity Linux" "$AU_LINUX"
203-
post "build / Audacity macOS" "$AU_MACOS"
204-
post "build / Audacity Windows" "$AU_WINDOWS"
205-
post "build / MuseScore Linux" "$MU_LINUX"
206-
post "build / MuseScore macOS" "$MU_MACOS"
207-
post "build / MuseScore Windows" "$MU_WINDOWS"

0 commit comments

Comments
 (0)