Add build jobs/stages to .travis.yml (#80)

This will enable testing backward compatibility thanks to the build jobs for Xcode 10.0, 10.1 and 10.2.
This commit is contained in:
Max Desiatov 2019-04-01 09:44:20 +01:00 committed by GitHub
parent 36ec231b62
commit b6c94827ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 108 additions and 12 deletions

View File

@ -14,3 +14,7 @@ line_length:
function_body_length:
- 50
included:
- Sources
- Tests

View File

@ -2,25 +2,50 @@
# * https://www.objc.io/issues/6-build-tools/travis-ci/
# * https://github.com/supermarin/xcpretty#usage
osx_image: xcode10.1
osx_image: xcode10.2
language: swift
before_install:
jobs:
include:
- stage: lint
osx_image: xcode10.2
language: swift
before_install:
- brew update
- brew install swiftformat
script:
- swiftformat --lint --verbose .
- swiftlint
- &test
stage: test
osx_image: xcode10
language: swift
install: skip
env: TEST_DEVICE='platform=iOS Simulator,OS=12.0,name=iPhone SE'
script:
- xcodebuild -scheme TokamakUIKit -sdk iphonesimulator | xcpretty
- xcodebuild -scheme TokamakAppKit -sdk macosx10.14 | 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
- xcodebuild test -enableCodeCoverage YES -scheme Tokamak | xcpretty
- <<: *test
osx_image: xcode10.1
env: TEST_DEVICE='platform=iOS Simulator,OS=12.1,name=iPhone SE'
- <<: *test
osx_image: xcode10.2
env: TEST_DEVICE='platform=iOS Simulator,OS=12.2,name=iPhone SE'
after_success:
- bash <(curl -s https://codecov.io/bash)
# before_install:
# - gem install cocoapods --pre # Since Travis is not always on latest version
- brew update
- brew install swiftformat
# - 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
script:
- swiftformat --lint --verbose .
- xcodebuild -scheme TokamakUIKit -sdk iphonesimulator
- xcodebuild -scheme TokamakAppKit -sdk macosx10.14
- xcodebuild test -enableCodeCoverage YES -scheme Tokamak
after_success:
- bash <(curl -s https://codecov.io/bash)
# - swift build
# - 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

@ -1,4 +1,4 @@
// swift-tools-version:4.2
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to
// build this package.
@ -6,6 +6,10 @@ import PackageDescription
let package = Package(
name: "Tokamak",
platforms: [
.macOS(.v10_14),
.iOS(.v11),
],
products: [
// Products define the executables and libraries produced by a package,
// and make them visible to other packages.

63
Package@swift-4.2.swift Normal file
View File

@ -0,0 +1,63 @@
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to
// build this package.
import PackageDescription
let package = Package(
name: "Tokamak",
products: [
// Products define the executables and libraries produced by a package,
// and make them visible to other packages.
.library(
name: "Tokamak",
targets: ["Tokamak"]
),
.library(
name: "TokamakUIKit",
targets: ["TokamakUIKit"]
),
.library(
name: "TokamakAppKit",
targets: ["TokamakAppKit"]
),
.library(
name: "TokamakTestRenderer",
targets: ["TokamakTestRenderer"]
),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define
// a module or a test suite.
// Targets can depend on other targets in this package, and on products
// in packages which this package depends on.
.target(
name: "Tokamak",
dependencies: []
),
.target(
name: "TokamakDemo",
dependencies: ["Tokamak"]
),
.target(
name: "TokamakUIKit",
dependencies: ["Tokamak"]
),
.target(
name: "TokamakAppKit",
dependencies: ["Tokamak"]
),
.target(
name: "TokamakTestRenderer",
dependencies: ["Tokamak"]
),
.testTarget(
name: "TokamakTests",
dependencies: ["TokamakTestRenderer"]
),
]
)