|
| 1 | +name: CI - Extended Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + run_device_tests: |
| 7 | + description: 'Run device tests after build' |
| 8 | + required: false |
| 9 | + default: false |
| 10 | + type: boolean |
| 11 | + run_android_build: |
| 12 | + description: 'Include Android platform build' |
| 13 | + required: false |
| 14 | + default: true |
| 15 | + type: boolean |
| 16 | + schedule: |
| 17 | + # Run nightly at 2 AM UTC |
| 18 | + - cron: '0 2 * * *' |
| 19 | + |
| 20 | +env: |
| 21 | + DOTNET_NOLOGO: true |
| 22 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true |
| 23 | + DOTNET_CLI_TELEMETRY_OPTOUT: true |
| 24 | + |
| 25 | +jobs: |
| 26 | + build-core: |
| 27 | + name: Core Build and Unit Tests |
| 28 | + runs-on: ubuntu-latest |
| 29 | + outputs: |
| 30 | + success: ${{ steps.build.outcome == 'success' }} |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + |
| 38 | + - name: Setup .NET |
| 39 | + uses: actions/setup-dotnet@v4 |
| 40 | + with: |
| 41 | + global-json-file: global.json |
| 42 | + |
| 43 | + - name: Install dotnet tools |
| 44 | + run: dotnet tool restore |
| 45 | + |
| 46 | + - name: Build build tasks |
| 47 | + run: dotnet build ./Microsoft.Maui.BuildTasks.slnf |
| 48 | + |
| 49 | + - name: Build and test core |
| 50 | + id: build |
| 51 | + run: | |
| 52 | + echo "Building core solution..." |
| 53 | + dotnet build Microsoft.Maui.sln --configuration Release |
| 54 | + |
| 55 | + echo "Running unit tests..." |
| 56 | + dotnet test src/Core/tests/UnitTests/Core.UnitTests.csproj --configuration Release --logger trx |
| 57 | + dotnet test src/Essentials/test/UnitTests/Essentials.UnitTests.csproj --configuration Release --logger trx |
| 58 | + dotnet test src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj --configuration Release --logger trx |
| 59 | + dotnet test src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj --configuration Release --logger trx |
| 60 | +
|
| 61 | + - name: Upload artifacts |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: build-artifacts |
| 65 | + path: | |
| 66 | + artifacts/ |
| 67 | + **/*.trx |
| 68 | + retention-days: 30 |
| 69 | + |
| 70 | + build-android: |
| 71 | + name: Android Build |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: build-core |
| 74 | + if: needs.build-core.outputs.success == 'true' && (github.event.inputs.run_android_build == 'true' || github.event_name == 'schedule') |
| 75 | + |
| 76 | + steps: |
| 77 | + - name: Checkout |
| 78 | + uses: actions/checkout@v4 |
| 79 | + |
| 80 | + - name: Setup .NET |
| 81 | + uses: actions/setup-dotnet@v4 |
| 82 | + with: |
| 83 | + global-json-file: global.json |
| 84 | + |
| 85 | + - name: Setup Java |
| 86 | + uses: actions/setup-java@v4 |
| 87 | + with: |
| 88 | + distribution: 'microsoft' |
| 89 | + java-version: '17' |
| 90 | + |
| 91 | + - name: Install dotnet tools |
| 92 | + run: dotnet tool restore |
| 93 | + |
| 94 | + - name: Build build tasks |
| 95 | + run: dotnet build ./Microsoft.Maui.BuildTasks.slnf |
| 96 | + |
| 97 | + - name: Download build artifacts |
| 98 | + uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + name: build-artifacts |
| 101 | + |
| 102 | + - name: Build Android sample |
| 103 | + run: | |
| 104 | + echo "Building Android sample to verify platform integration..." |
| 105 | + dotnet build src/Controls/samples/Maui.Controls.Sample/Maui.Controls.Sample.csproj -f net9.0-android --configuration Release |
| 106 | +
|
| 107 | + build-ios: |
| 108 | + name: iOS Build (macOS) |
| 109 | + runs-on: macos-latest |
| 110 | + needs: build-core |
| 111 | + if: needs.build-core.outputs.success == 'true' && github.event_name == 'schedule' |
| 112 | + |
| 113 | + steps: |
| 114 | + - name: Checkout |
| 115 | + uses: actions/checkout@v4 |
| 116 | + |
| 117 | + - name: Setup .NET |
| 118 | + uses: actions/setup-dotnet@v4 |
| 119 | + with: |
| 120 | + global-json-file: global.json |
| 121 | + |
| 122 | + - name: Install dotnet tools |
| 123 | + run: dotnet tool restore |
| 124 | + |
| 125 | + - name: Build build tasks |
| 126 | + run: dotnet build ./Microsoft.Maui.BuildTasks.slnf |
| 127 | + |
| 128 | + - name: Build iOS sample |
| 129 | + run: | |
| 130 | + echo "Building iOS sample to verify platform integration..." |
| 131 | + dotnet build src/Controls/samples/Maui.Controls.Sample/Maui.Controls.Sample.csproj -f net9.0-ios --configuration Release |
| 132 | +
|
| 133 | + device-tests: |
| 134 | + name: Device Tests (if requested) |
| 135 | + runs-on: ubuntu-latest |
| 136 | + needs: [build-core, build-android] |
| 137 | + if: needs.build-core.outputs.success == 'true' && github.event.inputs.run_device_tests == 'true' |
| 138 | + |
| 139 | + steps: |
| 140 | + - name: Checkout |
| 141 | + uses: actions/checkout@v4 |
| 142 | + |
| 143 | + - name: Setup .NET |
| 144 | + uses: actions/setup-dotnet@v4 |
| 145 | + with: |
| 146 | + global-json-file: global.json |
| 147 | + |
| 148 | + - name: Setup Java |
| 149 | + uses: actions/setup-java@v4 |
| 150 | + with: |
| 151 | + distribution: 'microsoft' |
| 152 | + java-version: '17' |
| 153 | + |
| 154 | + - name: Install dotnet tools |
| 155 | + run: dotnet tool restore |
| 156 | + |
| 157 | + - name: Build device tests |
| 158 | + run: | |
| 159 | + echo "Building device tests (Android only in public runners)..." |
| 160 | + dotnet build src/Essentials/test/DeviceTests/Essentials.DeviceTests.csproj -f net9.0-android --configuration Release |
| 161 | + dotnet build src/Core/tests/DeviceTests/Core.DeviceTests.csproj -f net9.0-android --configuration Release |
| 162 | +
|
| 163 | + - name: Note about device tests |
| 164 | + run: | |
| 165 | + echo "Device tests built successfully!" |
| 166 | + echo "Note: Actual device testing requires physical devices or emulators with additional setup." |
| 167 | + echo "This workflow validates that device test projects compile correctly." |
| 168 | +
|
| 169 | + summary: |
| 170 | + name: Summary |
| 171 | + runs-on: ubuntu-latest |
| 172 | + needs: [build-core, build-android, build-ios, device-tests] |
| 173 | + if: always() |
| 174 | + |
| 175 | + steps: |
| 176 | + - name: Build Summary |
| 177 | + run: | |
| 178 | + echo "## Extended Build Summary" >> $GITHUB_STEP_SUMMARY |
| 179 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 180 | + echo "| Stage | Status | Notes |" >> $GITHUB_STEP_SUMMARY |
| 181 | + echo "|-------|--------|-------|" >> $GITHUB_STEP_SUMMARY |
| 182 | + echo "| Core Build & Unit Tests | ${{ needs.build-core.result == 'success' && '✅ Passed' || '❌ Failed' }} | Basic .NET MAUI build and unit tests |" >> $GITHUB_STEP_SUMMARY |
| 183 | + echo "| Android Build | ${{ needs.build-android.result == 'success' && '✅ Passed' || needs.build-android.result == 'skipped' && '⏭️ Skipped' || '❌ Failed' }} | Android platform validation |" >> $GITHUB_STEP_SUMMARY |
| 184 | + echo "| iOS Build | ${{ needs.build-ios.result == 'success' && '✅ Passed' || needs.build-ios.result == 'skipped' && '⏭️ Skipped' || '❌ Failed' }} | iOS platform validation (macOS only) |" >> $GITHUB_STEP_SUMMARY |
| 185 | + echo "| Device Tests | ${{ needs.device-tests.result == 'success' && '✅ Passed' || needs.device-tests.result == 'skipped' && '⏭️ Skipped' || '❌ Failed' }} | Device test compilation check |" >> $GITHUB_STEP_SUMMARY |
| 186 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 187 | + |
| 188 | + if [[ "${{ needs.build-core.result }}" == "success" ]]; then |
| 189 | + echo "🎉 **Core build successful!** The .NET MAUI codebase compiles and unit tests pass." >> $GITHUB_STEP_SUMMARY |
| 190 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 191 | + echo "### Next Steps" >> $GITHUB_STEP_SUMMARY |
| 192 | + echo "- ✅ Core functionality validated" >> $GITHUB_STEP_SUMMARY |
| 193 | + if [[ "${{ needs.build-android.result }}" == "success" ]]; then |
| 194 | + echo "- ✅ Android platform integration confirmed" >> $GITHUB_STEP_SUMMARY |
| 195 | + fi |
| 196 | + if [[ "${{ needs.build-ios.result }}" == "success" ]]; then |
| 197 | + echo "- ✅ iOS platform integration confirmed" >> $GITHUB_STEP_SUMMARY |
| 198 | + fi |
| 199 | + echo "- 🔄 Ready for more comprehensive testing in Azure DevOps pipelines" >> $GITHUB_STEP_SUMMARY |
| 200 | + else |
| 201 | + echo "❌ **Core build failed.** Please fix compilation issues before proceeding." >> $GITHUB_STEP_SUMMARY |
| 202 | + fi |
0 commit comments