Skip to content

Commit 20de949

Browse files
[copilot] setup .github/workflows/copilot-setup-steps.yml (#10193)
Context: https://docs.github.com/en/copilot/customizing-copilot/customizing-the-development-environment-for-copilot-coding-agent Setup `.github/workflows/copilot-setup-steps.yml`, which is a Github action that runs (only on Ubuntu) prior to Copilot doing its work. This makes Copilot more useful, as it has a locally cloned and built source tree with all dependencies installed. Copilot will be able to run various commands to achieve tasks as assigned. Other changes: * Ignore errors from `<GitCommitsInRange/>` Copilot must keep some custom `git` history, as this command was failing during our build: > git log ^cfa4209..HEAD --oneline fatal: bad revision '^cfa4209..HEAD' We can ignore the error, and just use 0 for the commit range if this occurs. * Our `android-deps` workload for provisioning Mono, can simply use: "android-deps": { "extends" : [ "microsoft-net-runtime-android" ] } Previously, it was failing to install a non-existent pack on Linux: Installing pack Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x86 version 10.0.0-preview.6.25304.106... Co-authored-by: Jonathan Peppers <[email protected]>
1 parent 96a73e6 commit 20de949

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: "Copilot Setup Steps"
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
copilot-setup-steps:
7+
runs-on: ubuntu-latest
8+
timeout-minutes: 120
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
with:
14+
submodules: recursive
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '9.x'
20+
21+
- name: Run jenkins build
22+
run: |
23+
make jenkins PREPARE_CI=1 PREPARE_AUTOPROVISION=1 CONFIGURATION=Debug
24+
timeout-minutes: 60
25+
26+
- name: Upload logs
27+
uses: actions/upload-artifact@v4
28+
if: failure()
29+
with:
30+
name: copilot-artifacts
31+
path: |
32+
bin/**/*.log
33+
bin/**/*.binlog
34+
retention-days: 30

build-tools/create-packs/ConfigureLocalWorkload.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@
9090
Targets="_GenerateXAWorkloadContent"
9191
/>
9292

93-
<GetAndroidWorkloadExtends JsonFilePath="$(_LocalAndroidManifestFolder)WorkloadManifest.json">
93+
<GetAndroidWorkloadExtends Condition="!$([MSBuild]::IsOSPlatform('linux'))" JsonFilePath="$(_LocalAndroidManifestFolder)WorkloadManifest.json">
9494
<Output TaskParameter="ExtendsElement" PropertyName="AndroidWorkloadExtendsElement" />
9595
</GetAndroidWorkloadExtends>
9696

9797
<PropertyGroup>
98+
<!-- Linux can fail to install "microsoft-net-runtime-android-aot" and Microsoft.NETCore.App.Runtime.AOT.linux-x64.Cross.android-x86 -->
99+
<AndroidWorkloadExtendsElement Condition="$([MSBuild]::IsOSPlatform('linux'))">&quot;microsoft-net-runtime-android&quot;</AndroidWorkloadExtendsElement>
98100
<_EmptyWorkloadJsonContent>
99101
<![CDATA[
100102
{"version": "0.0.1", "workloads": { "android-deps": { "extends" : [ $(AndroidWorkloadExtendsElement) ] } } }

build-tools/scripts/XAVersionInfo.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<Output TaskParameter="Commits" ItemName="_XAVersionCommit" />
4141
</GitBlame>
4242
<GitCommitsInRange
43+
ContinueOnError="true"
4344
StartCommit="%(_XAVersionCommit.CommitHash)"
4445
WorkingDirectory="$(XamarinAndroidSourcePath)"
4546
ToolPath="$(GitToolPath)"
@@ -55,6 +56,7 @@
5556
<Output TaskParameter="Commits" ItemName="_PackVersionCommit" />
5657
</GitBlame>
5758
<GitCommitsInRange
59+
ContinueOnError="true"
5860
StartCommit="%(_PackVersionCommit.CommitHash)"
5961
WorkingDirectory="$(XamarinAndroidSourcePath)"
6062
ToolPath="$(GitToolPath)"

build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/GitCommitsInRange.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ public override bool Execute ()
3232

3333
base.Execute ();
3434

35+
// fatal: bad revision '^cfa4209..HEAD'
36+
if (ExitCode == 128) {
37+
Log.LogMessage (MessageImportance.Normal, $"git exited with code 128. Setting {nameof (CommitCount)} to 0.");
38+
CommitCount = 0;
39+
return true;
40+
}
41+
3542
Log.LogMessage (MessageImportance.Low, $" [Output] {nameof (CommitCount)}: {CommitCount}");
3643

3744
return !Log.HasLoggedErrors;

0 commit comments

Comments
 (0)