Skip to content

Commit a45b494

Browse files
Implement the first version of setup-xamarin task (#1)
1 parent 97fc861 commit a45b494

25 files changed

+7071
-1
lines changed

.eslintrc.json

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"es6": true,
5+
"jest/globals": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:jest/recommended"
12+
],
13+
"parser": "@typescript-eslint/parser",
14+
"parserOptions": {
15+
"project": "./tsconfig.eslint.json",
16+
"ecmaVersion": 2018,
17+
"sourceType": "module"
18+
},
19+
"plugins": ["@typescript-eslint", "jest"],
20+
"ignorePatterns": ["node_modules/"],
21+
"rules": {
22+
"indent": ["error", 4],
23+
"linebreak-style": ["error", "unix"],
24+
"quotes": ["error", "double"],
25+
"semi": ["error", "always"]
26+
}
27+
}

.github/workflows/test-full.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Validate 'setup-xamarin' (all test cases)
2+
on:
3+
pull_request:
4+
types: [ labeled ]
5+
6+
jobs:
7+
partial-versions:
8+
name: valid versions (should pass)
9+
runs-on: macos-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@master
13+
14+
- name: setup-xamarin
15+
uses: ./
16+
with:
17+
mono-version: 6.6
18+
xamarin-ios-version: 13.8
19+
xamarin-mac-version: 6.6
20+
xamarin-android-version: 10.1
21+
22+
- name: Validate versions
23+
run: ./__tests__/validate-versions.sh '6.6' '13.8' '6.6' '10.1'
24+
25+
latest-keyword:
26+
name: latest keyword (should pass)
27+
runs-on: macos-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@master
31+
32+
- name: setup-xamarin
33+
uses: ./
34+
with:
35+
mono-version: latest
36+
xamarin-ios-version: latest
37+
xamarin-mac-version: latest
38+
xamarin-android-version: latest
39+
40+
full-versions:
41+
name: valid full versions (should warn)
42+
runs-on: macos-latest
43+
steps:
44+
- name: Checkout
45+
uses: actions/checkout@master
46+
47+
- name: setup-xamarin
48+
uses: ./
49+
with:
50+
xamarin-ios-version: 13.10.0.21
51+
xamarin-mac-version: 6.6.0.12
52+
53+
- name: Validate versions
54+
run: ./__tests__/validate-versions.sh '6.6.0' '13.10.0.21' '6.6.0.12' '10.1.3'
55+
56+
invalid-version-format:
57+
name: invalid version format (should fail)
58+
runs-on: macos-latest
59+
steps:
60+
- name: setup-xamarin
61+
id: test
62+
uses: ./
63+
with:
64+
xamarin-mac-version: 6_6_0 # this version has invalid format
65+
66+
xamarin-version-not-found:
67+
name: Xamarin.iOS version is not found (should fail)
68+
runs-on: macos-latest
69+
steps:
70+
- name: setup-xamarin
71+
id: test
72+
uses: ./
73+
with:
74+
mono-version: 6.6
75+
xamarin-ios-version: 11.1 # this versino doesn't exist
76+
77+
invalid-platform:
78+
name: invalid platform (should fail)
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: setup-xamarin
82+
id: test
83+
uses: ./
84+
with:
85+
mono-version: latest
86+
xamarin-ios-version: latest
87+
xamarin-mac-version: latest
88+
xamarin-android-version: latest

.github/workflows/test.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Validate 'setup-xamarin'
2+
on:
3+
pull_request:
4+
schedule:
5+
- cron: 0 0 * * *
6+
7+
jobs:
8+
partial-versions:
9+
name: valid versions (should pass)
10+
runs-on: macos-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@master
14+
15+
- name: setup-xamarin
16+
uses: ./
17+
with:
18+
mono-version: 6.6
19+
xamarin-ios-version: 13.8
20+
xamarin-mac-version: 6.6
21+
xamarin-android-version: 10.1
22+
23+
- name: Validate versions
24+
run: ./__tests__/validate-versions.sh '6.6' '13.8' '6.6' '10.1'
25+
26+
latest-keyword:
27+
name: latest keyword (should pass)
28+
runs-on: macos-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@master
32+
33+
- name: setup-xamarin
34+
uses: ./
35+
with:
36+
mono-version: latest
37+
xamarin-ios-version: latest
38+
xamarin-mac-version: latest
39+
xamarin-android-version: latest
40+
41+
full-versions:
42+
name: valid full versions (should warn)
43+
runs-on: macos-latest
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@master
47+
48+
- name: setup-xamarin
49+
uses: ./
50+
with:
51+
xamarin-ios-version: 13.10.0.21
52+
xamarin-mac-version: 6.6.0.12
53+
54+
- name: Validate versions
55+
run: ./__tests__/validate-versions.sh '6.6.0' '13.10.0.21' '6.6.0.12' '10.1.3'

.github/workflows/workflow.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build task
2+
on: [pull_request]
3+
4+
jobs:
5+
Build:
6+
runs-on: macos-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@master
10+
11+
- name: Set Node.JS
12+
uses: actions/setup-node@master
13+
with:
14+
node-version: 13.x
15+
16+
- name: npm install
17+
run: npm install
18+
19+
- name: Build
20+
run: npm run build
21+
22+
- name: Run tests
23+
run: npm run test
24+
25+
- name: Lint
26+
run: npm run lint

.gitignore

+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
node_modules/
2+
lib
3+
4+
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
jspm_packages/
46+
47+
# TypeScript v1 declaration files
48+
typings/
49+
50+
# TypeScript cache
51+
*.tsbuildinfo
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variables file
69+
.env
70+
.env.test
71+
72+
# parcel-bundler cache (https://parceljs.org/)
73+
.cache
74+
75+
# next.js build output
76+
.next
77+
78+
# nuxt.js build output
79+
.nuxt
80+
81+
# vuepress build output
82+
.vuepress/dist
83+
84+
# Serverless directories
85+
.serverless/
86+
87+
# FuseBox cache
88+
.fusebox/
89+
90+
# DynamoDB Local files
91+
.dynamodb/

LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2020 Maxim Lobanov and contributors
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
11
# setup-xamarin
2-
Set up your GitHub Actions workflow with a specific version of Mono & Xamarin
2+
This action is intended to switch between pre-installed versions Xamarin & Mono on macos-10.15 image in GitHub Actions.
3+
The list of available versions can be found in [virtual-environments](https://github.com/actions/virtual-environments/blob/master/images/macos/macos-10.15-Readme.md#mono) repository.
4+
# Available parameters
5+
| Argument | Required | Description |
6+
|-------------------------|----------|--------------------------------------------------|
7+
| mono-version | False | Specify the version of Mono to switch |
8+
| xamarin-ios-version | False | Specify the version of Xamarin.iOS to switch |
9+
| xamarin-mac-version | False | Specify the version of Xamarin.Mac to switch |
10+
| xamarin-android-version | False | Specify the version of Xamarin.Android to switch |
11+
12+
All fields support the following format: `latest`, `13`, `13.2`, `13.2.1.4`
13+
14+
# Usage
15+
```
16+
name: CI
17+
on: [push]
18+
jobs:
19+
build:
20+
name: valid versions (should pass)
21+
runs-on: macos-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@master
25+
26+
- name: setup-xamarin
27+
uses: maxim-lobanov/setup-xamarin
28+
with:
29+
mono-version: 6.6 # specify version in '<major>.<minor>' format
30+
xamarin-ios-version: 13 # specify version in '<major>' format
31+
xamarin-mac-version: latest # specify 'latest' keyword to pick up the latest available version
32+
xamarin-android-version: 10.1.3.7 # specify full version; it is not recomended option because your pipeline can be broken suddenly in future
33+
```
34+
35+
# License
36+
The scripts and documentation in this project are released under the [MIT License](LICENSE)

0 commit comments

Comments
 (0)