Skip to content

Commit dbe4acb

Browse files
Added page on how to build a Xamarin apps in Actions (github#18946)
* Added building Xamarin apps doc * Fixed task name * Fixed code snippets, added information about bundles * Fixed Xcode path * adding extra topic to allowed topics * Fixed wording
1 parent d9339eb commit dbe4acb

File tree

4 files changed

+135
-6
lines changed

4 files changed

+135
-6
lines changed

content/actions/guides/building-and-testing-net.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
steps:
8787
- uses: actions/checkout@v2
8888
- name: Setup dotnet ${{ matrix.dotnet-version }}
89-
uses: actions/setup-dotnet@v1.7.2
89+
uses: actions/setup-dotnet@v1
9090
with:
9191
dotnet-version: ${{ matrix.dotnet-version }}
9292
# You can test your matrix by printing the current dotnet version
@@ -102,7 +102,7 @@ You can configure your job to use a specific version of .NET, such as `3.1.3`. A
102102
{% raw %}
103103
```yaml
104104
- name: Setup .NET 3.x
105-
uses: actions/setup-dotnet@v2
105+
uses: actions/setup-dotnet@v1
106106
with:
107107
# Semantic version range syntax or exact version of a dotnet version
108108
dotnet-version: '3.x'
@@ -118,7 +118,7 @@ You can configure your job to use a specific version of .NET, such as `3.1.3`. A
118118
steps:
119119
- uses: actions/checkout@v2
120120
- name: Setup dotnet
121-
uses: actions/setup-dotnet@v1.7.2
121+
uses: actions/setup-dotnet@v1
122122
with:
123123
dotnet-version: '3.1.x'
124124
- name: Install dependencies
@@ -139,7 +139,7 @@ For more information, see "[Caching dependencies to speed up workflows](/actions
139139
steps:
140140
- uses: actions/checkout@v2
141141
- name: Setup dotnet
142-
uses: actions/setup-dotnet@v1.7.2
142+
uses: actions/setup-dotnet@v1
143143
with:
144144
dotnet-version: '3.1.x'
145145
- uses: actions/cache@v2
@@ -171,7 +171,7 @@ You can use the same commands that you use locally to build and test your code.
171171
steps:
172172
- uses: actions/checkout@v2
173173
- name: Setup dotnet
174-
uses: actions/setup-dotnet@v1.7.2
174+
uses: actions/setup-dotnet@v1
175175
with:
176176
dotnet-version: '3.1.x'
177177
- name: Install dependencies
@@ -206,7 +206,7 @@ jobs:
206206
steps:
207207
- uses: actions/checkout@v2
208208
- name: Setup dotnet
209-
uses: actions/setup-dotnet@v1.7.2
209+
uses: actions/setup-dotnet@v1
210210
with:
211211
dotnet-version: ${{ matrix.dotnet-version }}
212212
- name: Install dependencies
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: Building and testing Xamarin applications
3+
intro: You can create a continuous integration (CI) workflow in GitHub Actions to build and test your Xamarin application.
4+
product: '{% data reusables.gated-features.actions %}'
5+
versions:
6+
free-pro-team: '*'
7+
enterprise-server: '>=2.22'
8+
github-ae: '*'
9+
type: 'tutorial'
10+
topics:
11+
- 'CI'
12+
- 'Xamarin'
13+
- 'Xamarin.iOS'
14+
- 'Xamarin.Android'
15+
- 'Android'
16+
- 'iOS'
17+
---
18+
19+
{% data reusables.actions.enterprise-beta %}
20+
{% data reusables.actions.enterprise-github-hosted-runners %}
21+
{% data reusables.actions.ae-beta %}
22+
23+
### Introduction
24+
25+
This guide shows you how to create a workflow that performs continuous integration (CI) for your Xamarin project. The workflow you create will allow you to see when commits to a pull request cause build or test failures against your default branch; this approach can help ensure that your code is always healthy.
26+
27+
{% data variables.product.prodname_actions %}-hosted macOS runner stores Xamarin SDK versions and the associated Mono versions as a set of symlinks to Xamarin SDK locations that are available by a single bundle symlink. For a full list of available Xamarin SDK versions and their corresponding bundles, see the runners documentation:
28+
29+
* [macOS 10.15](https://github.com/actions/virtual-environments/blob/main/images/macos/macos-10.15-Readme.md#xamarin-bundles)
30+
* [macOS 11.0](https://github.com/actions/virtual-environments/blob/main/images/macos/macos-11.0-Readme.md#xamarin-bundles)
31+
32+
{% data reusables.github-actions.macos-runner-preview %}
33+
34+
### Prerequisites
35+
36+
We recommend that you have a basic understanding of Xamarin, .NET Core SDK, YAML, workflow configuration options, and how to create a workflow file. For more information, see:
37+
38+
- "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions)"
39+
- "[Getting started with .NET](https://dotnet.microsoft.com/learn)"
40+
- "[Learn Xamarin](https://dotnet.microsoft.com/learn/xamarin)"
41+
42+
### Bulding Xamarin.iOS apps
43+
44+
The example below demonstrates how to change the default Xamarin bundle and build a Xamarin.iOS application.
45+
46+
{% raw %}
47+
```yaml
48+
name: Build Xamarin.iOS app
49+
50+
on: [push]
51+
52+
jobs:
53+
build:
54+
55+
runs-on: macos-latest
56+
57+
steps:
58+
- uses: actions/checkout@v2
59+
- name: Select default Xamarin bundle to 6_12_6
60+
run: |
61+
XAMARIN_SDK=6_12_6
62+
$VM_ASSETS/select-xamarin-sdk.sh $XAMARIN_SDK
63+
64+
- name: Set default Xcode 12.3
65+
run: |
66+
XCODE_ROOT=/Applications/Xcode_12.3.0.app
67+
echo "MD_APPLE_SDK_ROOT=$XCODE_ROOT" >> $GITHUB_ENV
68+
sudo xcode-select -s $XCODE_ROOT
69+
70+
- name: Setup .NET Core SDK 5.0.x
71+
uses: actions/setup-dotnet@v1
72+
with:
73+
dotnet-version: '5.0.x'
74+
75+
- name: Install dependencies
76+
run: nuget restore <sln_file_path>
77+
78+
- name: Build
79+
run: msbuild <csproj_file_path> /p:Configuration=Debug /p:Platform=iPhoneSimulator /t:Rebuild
80+
```
81+
{% endraw %}
82+
83+
### Bulding Xamarin.Android apps
84+
85+
The example below demonstrates how to change default the Xamarin bundle and build a Xamarin.Android application.
86+
87+
{% raw %}
88+
```yaml
89+
name: Build Xamarin.Android app
90+
91+
on: [push]
92+
93+
jobs:
94+
build:
95+
96+
runs-on: macos-latest
97+
98+
steps:
99+
- uses: actions/checkout@v2
100+
- name: Select default Xamarin bundle to 6_12_6
101+
run: |
102+
XAMARIN_SDK=6_12_6
103+
$VM_ASSETS/select-xamarin-sdk.sh $XAMARIN_SDK
104+
105+
- name: Setup .NET Core SDK 5.0.x
106+
uses: actions/setup-dotnet@v1
107+
with:
108+
dotnet-version: '5.0.x'
109+
110+
- name: Install dependencies
111+
run: nuget restore <sln_file_path>
112+
113+
- name: Build
114+
run: msbuild <csproj_file_path> /t:PackageForAndroid /p:Configuration=Debug
115+
```
116+
{% endraw %}
117+
118+
### Specifying a .NET version
119+
120+
To use a preinstalled version of the .NET Core SDK on a {% data variables.product.prodname_dotcom %}-hosted runner, use the `setup-dotnet` action. This action finds a specific version of .NET from the tools cache on each runner, and adds the necessary binaries to `PATH`. These changes will persist for the remainder of the job.
121+
122+
The `setup-dotnet` action is the recommended way of using .NET with {% data variables.product.prodname_actions %}, because it ensures consistent behavior across different runners and different versions of .NET. If you are using a self-hosted runner, you must install .NET and add it to `PATH`. For more information, see the [`setup-dotnet`](https://github.com/marketplace/actions/setup-net-core-sdk) action.

content/actions/guides/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ includeGuides:
4242
- /actions/guides/building-and-testing-java-with-maven
4343
- /actions/guides/building-and-testing-java-with-gradle
4444
- /actions/guides/building-and-testing-java-with-ant
45+
- /actions/guides/building-and-testing-xamarin-applications
4546
- /actions/guides/installing-an-apple-certificate-on-macos-runners-for-xcode-development
4647
- /actions/guides/publishing-nodejs-packages
4748
- /actions/guides/publishing-java-packages-with-maven
@@ -84,6 +85,7 @@ includeGuides:
8485
<!-- {% link_in_list /building-and-testing-java-with-gradle %} -->
8586
<!-- {% link_in_list /building-and-testing-java-with-ant %} -->
8687
<!-- {% link_in_list /installing-an-apple-certificate-on-macos-runners-for-xcode-development %} -->
88+
<!-- {% link_in_list /building-and-testing-xamarin-applications %} -->
8789
<!-- {% link_in_list /about-packaging-with-github-actions %} -->
8890
<!-- {% link_in_list /publishing-nodejs-packages %} -->
8991
<!-- {% link_in_list /publishing-java-packages-with-maven %} -->

data/allowed-topics.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module.exports = [
1414
'2fa',
1515
'Action development',
1616
'Amazon ECS',
17+
'Android',
1718
'Ant',
1819
'Analytics',
1920
'API',
@@ -31,6 +32,7 @@ module.exports = [
3132
'Google Kubernetes Engine',
3233
'Gradle',
3334
'GraphQL',
35+
'iOS',
3436
'Java',
3537
'JavaScript',
3638
'Jenkins',
@@ -92,5 +94,8 @@ module.exports = [
9294
'teams',
9395
'usernames',
9496
'webhooks', // replace this with Webhooks
97+
'Xamarin',
98+
'Xamarin.iOS',
99+
'Xamarin.Android',
95100
'Xcode'
96101
]

0 commit comments

Comments
 (0)