Skip to content

Commit

Permalink
Implement the first version of setup-xamarin task (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-lobanov authored Mar 15, 2020
1 parent 97fc861 commit a45b494
Show file tree
Hide file tree
Showing 25 changed files with 7,071 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"node": true,
"es6": true,
"jest/globals": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.eslint.json",
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "jest"],
"ignorePatterns": ["node_modules/"],
"rules": {
"indent": ["error", 4],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"]
}
}
88 changes: 88 additions & 0 deletions .github/workflows/test-full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Validate 'setup-xamarin' (all test cases)
on:
pull_request:
types: [ labeled ]

jobs:
partial-versions:
name: valid versions (should pass)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: setup-xamarin
uses: ./
with:
mono-version: 6.6
xamarin-ios-version: 13.8
xamarin-mac-version: 6.6
xamarin-android-version: 10.1

- name: Validate versions
run: ./__tests__/validate-versions.sh '6.6' '13.8' '6.6' '10.1'

latest-keyword:
name: latest keyword (should pass)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: setup-xamarin
uses: ./
with:
mono-version: latest
xamarin-ios-version: latest
xamarin-mac-version: latest
xamarin-android-version: latest

full-versions:
name: valid full versions (should warn)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: setup-xamarin
uses: ./
with:
xamarin-ios-version: 13.10.0.21
xamarin-mac-version: 6.6.0.12

- name: Validate versions
run: ./__tests__/validate-versions.sh '6.6.0' '13.10.0.21' '6.6.0.12' '10.1.3'

invalid-version-format:
name: invalid version format (should fail)
runs-on: macos-latest
steps:
- name: setup-xamarin
id: test
uses: ./
with:
xamarin-mac-version: 6_6_0 # this version has invalid format

xamarin-version-not-found:
name: Xamarin.iOS version is not found (should fail)
runs-on: macos-latest
steps:
- name: setup-xamarin
id: test
uses: ./
with:
mono-version: 6.6
xamarin-ios-version: 11.1 # this versino doesn't exist

invalid-platform:
name: invalid platform (should fail)
runs-on: ubuntu-latest
steps:
- name: setup-xamarin
id: test
uses: ./
with:
mono-version: latest
xamarin-ios-version: latest
xamarin-mac-version: latest
xamarin-android-version: latest
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Validate 'setup-xamarin'
on:
pull_request:
schedule:
- cron: 0 0 * * *

jobs:
partial-versions:
name: valid versions (should pass)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: setup-xamarin
uses: ./
with:
mono-version: 6.6
xamarin-ios-version: 13.8
xamarin-mac-version: 6.6
xamarin-android-version: 10.1

- name: Validate versions
run: ./__tests__/validate-versions.sh '6.6' '13.8' '6.6' '10.1'

latest-keyword:
name: latest keyword (should pass)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: setup-xamarin
uses: ./
with:
mono-version: latest
xamarin-ios-version: latest
xamarin-mac-version: latest
xamarin-android-version: latest

full-versions:
name: valid full versions (should warn)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: setup-xamarin
uses: ./
with:
xamarin-ios-version: 13.10.0.21
xamarin-mac-version: 6.6.0.12

- name: Validate versions
run: ./__tests__/validate-versions.sh '6.6.0' '13.10.0.21' '6.6.0.12' '10.1.3'
26 changes: 26 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build task
on: [pull_request]

jobs:
Build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Set Node.JS
uses: actions/setup-node@master
with:
node-version: 13.x

- name: npm install
run: npm install

- name: Build
run: npm run build

- name: Run tests
run: npm run test

- name: Lint
run: npm run lint
91 changes: 91 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
node_modules/
lib

# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

The MIT License (MIT)

Copyright (c) 2020 Maxim Lobanov and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
# setup-xamarin
Set up your GitHub Actions workflow with a specific version of Mono & Xamarin
This action is intended to switch between pre-installed versions Xamarin & Mono on macos-10.15 image in GitHub Actions.
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.
# Available parameters
| Argument | Required | Description |
|-------------------------|----------|--------------------------------------------------|
| mono-version | False | Specify the version of Mono to switch |
| xamarin-ios-version | False | Specify the version of Xamarin.iOS to switch |
| xamarin-mac-version | False | Specify the version of Xamarin.Mac to switch |
| xamarin-android-version | False | Specify the version of Xamarin.Android to switch |

All fields support the following format: `latest`, `13`, `13.2`, `13.2.1.4`

# Usage
```
name: CI
on: [push]
jobs:
build:
name: valid versions (should pass)
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: setup-xamarin
uses: maxim-lobanov/setup-xamarin
with:
mono-version: 6.6 # specify version in '<major>.<minor>' format
xamarin-ios-version: 13 # specify version in '<major>' format
xamarin-mac-version: latest # specify 'latest' keyword to pick up the latest available version
xamarin-android-version: 10.1.3.7 # specify full version; it is not recomended option because your pipeline can be broken suddenly in future
```

# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)
Loading

0 comments on commit a45b494

Please sign in to comment.