JPMartha's Pancake

This blog is the way to brush up my poor English.

#swiftlang Try Running The Swift Package Manager on Travis CI ๐Ÿš€

Updated: 2016-04-10

f:id:JPMartha:20160327115818p:plain

๐Ÿ‘‰ ๆ—ฅๆœฌ่ชž: Travis CI で Swift Package Manager を試す 🚀 - Qiita

Overview

I tried running the Swift Package Manager on Travis CI.

โš ๏ธ Please note, it might become invalid before Swift 3.0 is released.

Premise

  • The purpose of this entry is just to make sure of running $ swift build on Travis CI.
    • The library for Swift 2.2 is not support $ swift build.
    • So, just run $ swift build --fetch.
    • No $ swift test.
  • I used Development Snapshots released in March 24.
    • swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a
  • The following settings is at the very least. Please add some settings for your environment. โ˜บ๏ธ

Settings in a .travis.yml

language: objective-c
osx_image: xcode7.3
script:
  - swift build --fetch
before_install:
  - export SWIFT_VERSION=swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a
  - curl -O https://swift.org/builds/development/xcode/${SWIFT_VERSION}/${SWIFT_VERSION}-osx.pkg
  - sudo installer -pkg ${SWIFT_VERSION}-osx.pkg -target /
  - export TOOLCHAINS=swift

Improvement:

Updated: 2016-04-10

Diff

 language: objective-c
 osx_image: xcode7.3
+env:
+  - TOOLCHAINS=swift
 script:
   - swift build --fetch
 before_install:
-  - export SWIFT_VERSION=swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a
-  - curl -O https://swift.org/builds/development/xcode/${SWIFT_VERSION}/${SWIFT_VERSION}-osx.pkg
-  - sudo installer -pkg ${SWIFT_VERSION}-osx.pkg -target /
-  - export TOOLCHAINS=swift
+  - TOOLCHAIN_VERSION=swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a
+  - curl -O https://swift.org/builds/development/xcode/${TOOLCHAIN_VERSION}/${TOOLCHAIN_VERSION}-osx.pkg
+  - sudo installer -pkg ${TOOLCHAIN_VERSION}-osx.pkg -target /

Environment Variables - Travis CI

Result

The command "swift build --fetch" exited with 0.
Done. Your build exited with 0.

Reference

try! Swift

Practical Cross-Platform Swift by JP Simard (@simjp)

https://speakerdeck.com/jpsim/practical-cross-platform-swift?slide=36

Supplementaries

https://github.com/apple/swift-package-manager/blob/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a/README.md

To use the Swift Package Manager, run the following command:

export TOOLCHAINS=swift
export PATH=/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a.xctoolchain/usr/bin:"${PATH}"

Addition

The following was mentioned in the mailing list in January 2016.

https://lists.swift.org/pipermail/swift-build-dev/Week-of-Mon-20160111/000233.html

We are hoping that people will adopt SwiftPM.


Alternatively, call it swift build

I think we call the Swift Package Manager SwiftPM or `swift build` in the community at Swift.org better. ๐Ÿ’