129 lines
4.3 KiB
YAML
129 lines
4.3 KiB
YAML
# only run for: merge commits, releases and pull-requests
|
||
if: type != push OR branch = master OR branch =~ /^\d+\.\d+(\.\d+)?(-\S*)?$/
|
||
|
||
stages:
|
||
- name: pretest
|
||
- name: test
|
||
- name: deploy
|
||
if: branch =~ ^\d+\.\d+\.\d+$
|
||
|
||
os: osx
|
||
language: swift
|
||
osx_image: xcode10.1
|
||
xcode_project: Path.swift.xcodeproj
|
||
xcode_scheme: Path.swift-Package
|
||
|
||
jobs:
|
||
include:
|
||
- script: swift test --parallel
|
||
name: macOS / Swift 4.2.1
|
||
|
||
- &xcodebuild
|
||
before_install: swift package generate-xcodeproj
|
||
xcode_destination: platform=iOS Simulator,OS=latest,name=iPhone XS
|
||
name: iOS / Swift 4.2.1
|
||
- <<: *xcodebuild
|
||
xcode_destination: platform=tvOS Simulator,OS=latest,name=Apple TV
|
||
name: tvOS / Swift 4.2.1
|
||
- <<: *xcodebuild
|
||
name: watchOS / Swift 4.2.1
|
||
script: |
|
||
set -o pipefail
|
||
xcodebuild \
|
||
-project Path.swift.xcodeproj \
|
||
-scheme Path.swift-Package \
|
||
-destination 'platform=watchOS Simulator,OS=latest,name=Apple Watch Series 4 - 40mm' \
|
||
build | xcpretty
|
||
|
||
- &linux
|
||
env: SWIFT_VERSION=4.2.1
|
||
os: linux
|
||
name: Linux / Swift 4.2.1
|
||
language: generic
|
||
dist: trusty
|
||
sudo: false
|
||
install: eval "$(curl -sL https://swiftenv.fuller.li/install.sh)"
|
||
script: swift test --parallel
|
||
|
||
- <<: *linux
|
||
env: SWIFT_VERSION='5.0-DEVELOPMENT-SNAPSHOT-2019-01-22-a'
|
||
name: Linux / Swift 5.0.0-dev (2019-01-22)
|
||
|
||
- stage: pretest
|
||
name: Check Linux tests are sync’d
|
||
install: swift test --generate-linuxmain
|
||
script: git diff --exit-code
|
||
|
||
- stage: deploy
|
||
name: Jazzy
|
||
before_install: |
|
||
cat <<\ \ EOF> .jazzy.yaml
|
||
module: Path
|
||
module_version: TRAVIS_TAG
|
||
custom_categories:
|
||
- name: Path
|
||
children:
|
||
- Path
|
||
- /(_:_:)
|
||
xcodebuild_arguments:
|
||
- UseModernBuildSystem=NO
|
||
output: output
|
||
github_url: https://github.com/mxcl/Path.swift
|
||
exclude:
|
||
- Sources/Path+StringConvertibles.swift
|
||
EOF
|
||
sed -i '' "s/TRAVIS_TAG/$TRAVIS_TAG/" .jazzy.yaml
|
||
# ^^ this weirdness because Travis multiline YAML is broken and inserts
|
||
# two spaces in front of the output which means we need a prefixed
|
||
# delimiter which also weirdly stops bash from doing variable substitution
|
||
install: gem install jazzy
|
||
before_script: swift package generate-xcodeproj
|
||
script: jazzy
|
||
deploy:
|
||
provider: pages
|
||
skip-cleanup: true
|
||
github-token: $GITHUB_TOKEN
|
||
local-dir: output
|
||
on:
|
||
tags: true
|
||
|
||
- name: CocoaPods
|
||
before_install: |
|
||
export DESCRIPTION=$(swift - <<\ \ EOF
|
||
import Foundation
|
||
struct Response: Decodable { let description: String }
|
||
let token = ProcessInfo.processInfo.environment["GITHUB_TOKEN"]!
|
||
let url = URL(string: "https://api.github.com/repos/mxcl/Path.swift")!
|
||
var rq = URLRequest(url: url)
|
||
rq.setValue("token \(token)", forHTTPHeaderField: "Authorization")
|
||
let semaphore = DispatchSemaphore(value: 0)
|
||
var data: Data!
|
||
URLSession.shared.dataTask(with: rq) { d, _, _ in
|
||
data = d
|
||
semaphore.signal()
|
||
}.resume()
|
||
semaphore.wait()
|
||
let rsp = try JSONDecoder().decode(Response.self, from: data)
|
||
print(rsp.description, terminator: "")
|
||
EOF)
|
||
cat <<\ \ EOF> Path.swift.podspec
|
||
Pod::Spec.new do |s|
|
||
s.name = 'Path.swift'
|
||
s.version = ENV['TRAVIS_TAG']
|
||
s.summary = ENV['DESCRIPTION']
|
||
s.homepage = 'https://github.com/mxcl/Path.swift'
|
||
s.license = { :type => 'Unlicense', :file => 'LICENSE.md' }
|
||
s.author = { 'mxcl' => 'mxcl@me.com' }
|
||
s.source = { :git => 'https://github.com/mxcl/Path.swift.git', :tag => s.version.to_s }
|
||
s.social_media_url = 'https://twitter.com/mxcl'
|
||
s.osx.deployment_target = '10.10'
|
||
s.ios.deployment_target = '8.0'
|
||
s.tvos.deployment_target = '10.0'
|
||
s.watchos.deployment_target = '3.0'
|
||
s.source_files = 'Sources/*'
|
||
s.swift_version = '4.2'
|
||
end
|
||
EOF
|
||
install: gem install cocoapods --pre
|
||
script: pod trunk push
|