The core of Puma is Task
. When you call run
method, it actually uses Workflow
, which is a group of tasks. Workflow
is intended for cases where you need to run tasks for multiple projects.
run {
Build()
Test()
}
is the same as
let workflow = Workflow {
Build()
Test()
}
workflow.run()
At the core of Puma sits the Task
protocol, every task has a name
, isEnabled
flag and an action.
public typealias TaskCompletion = (Result<(), Error>) -> Void
public protocol Task: AnyObject {
var name: String { get }
var isEnabled: Bool { get }
func run(workflow: Workflow, completion: @escaping TaskCompletion)
}
The workflow
parameter in run
function acts as the context for all the tasks. When a task completes, you need to invoke completion
so workflow know when to execute the next task in the pipeline.
Some times you want to temporarily disable a task, every task in Puma needs to conform to Task
protocol, and there is a modifier enable(_:)
where you can toggle on/off a task
Build()
.enable(false)
Every task has a default name, and this name is used when summarizing, to change the name of a task, assign a different name using the name(_:)
modifier
Build()
.name("Build my awesome app")
Puma comes with a bunch of predefined tasks for popular actions, and they are sat in respective framework.
The facade, which exposes convenient run
function, and includes other frameworks
Contains the core utilities, Task protocol and some core tasks
- PrintWorkingDirectory: prints the current working directory
- RunScript: run arbitrary shell script
- Sequence: run sub tasks in sequence
- Concurrent: run sub tasks in parallel
- DownloadFile: Download and save file
- MoveFile: Move file to another location
- Slack: send message as a bot to Slack
- Wait: wait for some time before moving to the next task
- Retry: retry a task n number of times.
Contains iOS related tasks.
- Build: build workspace or project
- Test: test workspace or project
- Archive: archive to xcarchive
- ExportArchive: export archive into .ipa
- Screenshot: automate screenshot capturing, you can specify device, sdk, version, language and locale. It also supports test plan in Xcode 11
- UploadApp: upload, notarize, validate app with AppStore
- ShowDestinations: show all available destinations when building and testing
- BootSimulator: boot simulator
- UpdateSimulator: update statusbar of simulator. This is nifty before taking screenshots
- DownloadMetadata: download metadata from AppStore Connect
Contains Android related tasks. TBD
Contains extra tasks
- AppStoreConnect: interact with AppStore Connect
- AppDistribution: interact with Firebase AppDistribution
- Crashlytics: interact with Firebase Crashlytics