Migrate from travis to azure (#96)

* Migrate from travis to azure

* Make scripts executable

* Add codecov token

* Add fail key to lint.sh

* Add fail flag to codecov.sh

* Add azure status to README.md
This commit is contained in:
matvii 2019-05-18 21:56:28 +03:00 committed by GitHub
parent 7d0b41ce4c
commit bd700035e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 47 deletions

View File

@ -1,46 +0,0 @@
# references:
# * https://www.objc.io/issues/6-build-tools/travis-ci/
# * https://github.com/supermarin/xcpretty#usage
osx_image: xcode10.2
language: swift
jobs:
include:
- stage: lint
osx_image: xcode10.2
language: swift
before_install:
- brew install swiftformat
script:
# temporarily disabled due to Swift ABI issues on Xcode 10.2, Mojave 10.14.4
- swiftformat --lint --verbose .
- swiftlint
- &test
stage: test
osx_image: xcode10.2
language: swift
install: skip
env: TEST_DEVICE='platform=iOS Simulator,OS=12.2,name=iPhone SE'
script:
- swift package generate-xcodeproj --xcconfig-overrides Package.xcconfig
- git checkout HEAD Tokamak.xcodeproj/xcshareddata/xcschemes/TokamakCLI.xcscheme
- set -o pipefail && xcodebuild -scheme TokamakUIKit -sdk iphonesimulator | xcpretty
- set -o pipefail && xcodebuild -scheme TokamakAppKit -sdk macosx | xcpretty
# this runs the build the second time, but it's the only way to make sure
# that `Package.swift` is in a good state
- swift build --target Tokamak
- set -o pipefail && xcodebuild test -enableCodeCoverage YES -scheme Tokamak | xcpretty
after_success:
- bash <(curl -s https://codecov.io/bash)
# before_install:
# - gem install cocoapods --pre # Since Travis is not always on latest version
# - brew outdated carthage || brew upgrade carthage
# cache: cocoapods
# podfile: Example/Podfile
# before_install:
# - gem install cocoapods # Since Travis is not always on latest version
# - pod install --project-directory=Example
# - swift build
# - set -o pipefail && set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/Tokamak.xcworkspace -scheme Tokamak-Example -sdk iphonesimulator11.0 ONLY_ACTIVE_ARCH=NO | xcpretty
# - pod lib lint

View File

@ -2,7 +2,7 @@
## React-like framework for native UI written in pure Swift 🛠⚛️📲
[![CI Status](https://img.shields.io/travis/MaxDesiatov/Tokamak/master.svg?style=flat)](https://travis-ci.org/MaxDesiatov/Tokamak)
[![Build Status](https://dev.azure.com/max0484/max/_apis/build/status/MaxDesiatov.Tokamak?branchName=master)](https://dev.azure.com/max0484/max/_build/latest?definitionId=3&branchName=master)
[![Coverage](https://img.shields.io/codecov/c/github/MaxDesiatov/Tokamak/master.svg?style=flat)](https://codecov.io/gh/maxdesiatov/Tokamak)
[![Version](https://img.shields.io/cocoapods/v/Tokamak.svg?style=flat)](https://cocoapods.org/pods/Tokamak)
[![License](https://img.shields.io/cocoapods/l/Tokamak.svg?style=flat)](https://cocoapods.org/pods/Tokamak)

21
azure-pipelines.yml Normal file
View File

@ -0,0 +1,21 @@
trigger:
- master
jobs:
- job: lint
pool:
vmImage: "macos-latest"
steps:
- bash: ./lint.sh
- job: test
pool:
vmImage: "macos-latest"
steps:
- bash: ./test.sh
env:
IOS_DEVICE: "platform=iOS Simulator,OS=12.2,name=iPhone SE"
- bash: ./codecov.sh
env:
CODECOV_TOKEN: $(codecovToken)
condition: succeeded()

6
codecov.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set -e
set -o pipefail
bash <(curl -s https://codecov.io/bash)

10
lint.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e
set -o pipefail
brew update
brew install swiftformat swiftlint
swiftformat --lint --verbose .
swiftlint

10
test.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
swift package generate-xcodeproj --xcconfig-overrides Package.xcconfig
git checkout HEAD Tokamak.xcodeproj/xcshareddata/xcschemes/TokamakCLI.xcscheme
set -o pipefail && xcodebuild -scheme TokamakUIKit -sdk iphonesimulator | xcpretty
set -o pipefail && xcodebuild -scheme TokamakAppKit -sdk macosx | xcpretty
# this runs the build the second time, but it's the only way to make sure
# that `Package.swift` is in a good state
swift build --target Tokamak
set -o pipefail && xcodebuild test -enableCodeCoverage YES -scheme Tokamak | xcpretty