My notes on Swift PM + CI Travis
- Create a project named HelloTravis on github. Then download it via Github desktop app
cd dev/HelloTravis👈 Navigate to the folder you just downloaded
swift package init👈 Creates a Package.swift file etc
swift test👈 Runs the first test
- add an .travis.yml see YML paragraph
- Uploaded all the changes to github again.
- Create an account at: travis-ci.org (it takes zero time if you are logged into github)
- Find your HelloTravis project in your account list. Then switch the on/off but to on.
- Copy the MarkDown badge and add it to your README.md file in the HelloTravis project on github.
- Wait a little while and your Badge will become Green if all tests pass like this:
- Add More complex tests under the HelloTravis/Tests/HelloTravisTests.swift file.
- Add nested dependencies to your Tests by following this Tutorial on SPM + Nested frameworks
.travis.yml file looks like this: (This is the config file for Travis)
os: - osx language: generic sudo: required dist: trusty osx_image: xcode8.2 script: - swift build #Builds the dependencies - swift test #Tests whatever is inside the Test folder notifications: email: on_success: never on_failure: change
Some people like to keep a /Tests folder in the github repo. I prefer not to because they are not always relevant to whom ever uses the repo. As such I prefer to keep tests in a “test” repo. Which pulls in the dependencies from other repos. Travis-ci has a simple button which can test your project daily/weekly/monthly. So you don’t have to push changes to test things.