Skip to content

Commit 171c5bd

Browse files
Copilottido64
andauthored
ci(windows): make build jobs non-blocking and aggregate results (#2696)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tido64 <4123478+tido64@users.noreply.github.com>
1 parent 4eaa8ba commit 171c5bd

1 file changed

Lines changed: 66 additions & 33 deletions

File tree

.github/workflows/build.yml

Lines changed: 66 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -582,12 +582,6 @@ jobs:
582582
- name: Determine whether the Windows app needs to be built
583583
id: affected
584584
uses: ./.github/actions/affected
585-
- name: Install Windows App SDK
586-
if: ${{ steps.affected.outputs.windows != '' }}
587-
uses: ./.github/actions/setup-windows-app-sdk
588-
with:
589-
solution: Example.sln
590-
working-directory: packages/app/example/windows
591585
- name: Build
592586
id: build
593587
if: ${{ steps.affected.outputs.windows != '' }}
@@ -599,25 +593,35 @@ jobs:
599593
}
600594
working-directory: packages/app/example
601595
continue-on-error: true
602-
- name: Build (2nd attempt)
603-
if: ${{ steps.affected.outputs.windows != '' && steps.build.outcome != 'success' }}
596+
# GitHub Actions currently does not support outputs from jobs with matrices
597+
# The workaround is to upload artifacts to communicate between jobs
598+
- name: Set build result
599+
id: build_result
600+
if: ${{ steps.affected.outputs.windows != '' }}
604601
run: |
605-
if ("${{ matrix.configuration }}" -eq "Release") {
606-
yarn ci:windows --release --arch ${{ matrix.platform }}
607-
} else {
608-
yarn ci:windows --arch ${{ matrix.platform }}
609-
}
610-
working-directory: packages/app/example
602+
path=${{ format('windows-build.{0}.{1}.result', matrix.platform, matrix.configuration) }}
603+
echo "${{ steps.build.outcome }}" >> $path
604+
echo "path=$path" >> "$GITHUB_OUTPUT"
605+
shell: bash
606+
- name: Upload build result
607+
if: ${{ steps.affected.outputs.windows != '' }}
608+
uses: actions/upload-artifact@v7
609+
with:
610+
name: ${{ steps.build_result.outputs.path }}
611+
path: ${{ steps.build_result.outputs.path }}
612+
retention-days: 1
613+
archive: false
614+
overwrite: true
611615
- name: Upload build logs
612-
if: ${{ steps.affected.outputs.windows != '' && failure() }}
613-
uses: actions/upload-artifact@v6
616+
if: ${{ steps.affected.outputs.windows != '' && steps.build.outcome != 'success' }}
617+
uses: actions/upload-artifact@v7
614618
with:
615619
name: windows-msbuild.binlog
616620
path: packages/app/example/windows/*.binlog
617-
if-no-files-found: error
618621
retention-days: 14
622+
overwrite: true
619623
- name: Test
620-
if: ${{ steps.affected.outputs.windows != '' && matrix.platform == 'x64' }}
624+
if: ${{ steps.affected.outputs.windows != '' && matrix.platform == 'x64' && steps.build.outcome == 'success' }}
621625
run: |
622626
../../../scripts/build/MSBuild.ps1 -Configuration ${{ matrix.configuration }} -Platform ${{ matrix.platform }} -Target Build ReactAppTests.vcxproj
623627
../../../scripts/build/VSTest.ps1 ${{ matrix.platform }}\${{ matrix.configuration }}\ReactAppTests.dll
@@ -657,33 +661,63 @@ jobs:
657661
- name: Determine whether the Windows app needs to be built
658662
id: affected
659663
uses: ./.github/actions/affected
660-
- name: Install Windows App SDK
661-
if: ${{ steps.affected.outputs.windows != '' }}
662-
uses: ./.github/actions/setup-windows-app-sdk
663-
with:
664-
solution: TemplateExample.sln
665-
working-directory: template-example/windows
666664
- name: Build
667665
id: build
668666
if: ${{ steps.affected.outputs.windows != '' }}
669667
run: |
670668
yarn windows --logging --no-packager --no-launch --no-deploy
671669
working-directory: template-example
672670
continue-on-error: true
673-
- name: Build (2nd attempt)
674-
if: ${{ steps.affected.outputs.windows != '' && steps.build.outcome != 'success' }}
671+
# GitHub Actions currently does not support outputs from jobs with matrices
672+
# The workaround is to upload artifacts to communicate between jobs
673+
- name: Set build result
674+
id: build_result
675+
if: ${{ steps.affected.outputs.windows != '' }}
675676
run: |
676-
yarn windows --logging --no-packager --no-launch --no-deploy
677-
working-directory: packages/app/example
677+
path=${{ format('windows-template-build.{0}.result', matrix.template) }}
678+
echo "${{ steps.build.outcome }}" >> $path
679+
echo "path=$path" >> "$GITHUB_OUTPUT"
680+
shell: bash
681+
- name: Upload build result
682+
if: ${{ steps.affected.outputs.windows != '' }}
683+
uses: actions/upload-artifact@v7
684+
with:
685+
name: ${{ steps.build_result.outputs.path }}
686+
path: ${{ steps.build_result.outputs.path }}
687+
retention-days: 1
688+
archive: false
689+
overwrite: true
678690
- name: Upload build logs
679-
if: ${{ steps.affected.outputs.windows != '' && failure() }}
680-
uses: actions/upload-artifact@v6
691+
if: ${{ steps.affected.outputs.windows != '' && steps.build.outcome != 'success' }}
692+
uses: actions/upload-artifact@v7
681693
with:
682694
name: windows-template-msbuild.binlog
683695
path: template-example/windows/*.binlog
684-
if-no-files-found: error
685696
retention-days: 14
697+
overwrite: true
686698
timeout-minutes: 60
699+
windows-result:
700+
name: "Windows [result]"
701+
permissions: {}
702+
runs-on: ubuntu-24.04
703+
if: ${{ github.event_name != 'schedule' }}
704+
needs:
705+
- windows
706+
- windows-template
707+
steps:
708+
- name: Download build results
709+
uses: actions/download-artifact@v8
710+
with:
711+
path: results
712+
pattern: "windows-*.result"
713+
merge-multiple: true
714+
- name: Warn if Windows builds failed
715+
run: |
716+
for file in results/*; do
717+
if grep -q fail "$file"; then
718+
echo "::warning::$(basename $file .result): $(cat $file) (this is non-blocking but should be investigated)"
719+
fi
720+
done
687721
release:
688722
permissions:
689723
contents: write # create releases (Nx Release)
@@ -696,8 +730,7 @@ jobs:
696730
- android-template
697731
- macos
698732
- macos-template
699-
- windows
700-
- windows-template
733+
- windows-result
701734
runs-on: ubuntu-24.04
702735
if: ${{ github.event_name != 'schedule' }}
703736
steps:

0 commit comments

Comments
 (0)