Code Monkey home page Code Monkey logo

swiftlane's Introduction

Swiftlane

Swiftlane contains a set of build utilities to speed up iOS and macOS development and deployment

There's no additional configuration file, your Swift script file is the source of truth. With auto completion and type safety, you are ensured to do the right things in Swiftlane.

  • Swiftlane and its dependencies are written in pure Swift, making it easy to read and contribute.
  • Use latest Swift features like async/await to enable declarative syntax
  • Type-safe. All required and optional arguments are clear.
  • No configuration file. Your Swift script is your definition.
  • Simple wrapper around existing tools like xcodebuild, instruments and agvtool
  • Reuse awesome Swift scripting dependencies from Swift community

How to use

Swiftlane is intended to be used as a Swift Package. Please consult Examples folder for ways to integrate

  • CLI: make a macOS Command Line Tool project
  • Script: make an executable Swift Package
import Swiftlane
import AppStoreConnect

@main
struct Script {
    static func main() async throws {
        try await deployMyApp()
    }
    
    private static func deployMyApp() async throws {
        var workflow = Workflow()
        workflow.directory = Settings.fs
            .homeDirectory()
            .appendingPathComponent("Projects/swiftlane/Examples/MyApp")
        workflow.xcodeApp = URL(string: "/Applications/Xcode.app")
        
        let build = Build()
        build.project("MyApp")
        build.allowProvisioningUpdates()
        build.destination(platform: .iOSSimulator, name: "iPhone 13")
        build.workflow = workflow
        try await build.run()
        
        guard
            let issuerId = Settings.env["ASC_ISSUER_ID"],
            let privateKeyId = Settings.env["ASC_PRIVATE_KEY_ID"],
            let privateKey = Settings.env["ASC_PRIVATE_KEY"]
        else { return }
        
        let asc = try ASC(
            credential: AppStoreConnect.Credential(
                issuerId: issuerId,
                privateKeyId: privateKeyId,
                privateKey: privateKey
            )
        )
        
        try await asc.fetchCertificates()
        try await asc.fetchProvisioningProfiles()
        
        let keychain = try await Keychain.create(
            path: Keychain.Path(
                rawValue: Settings.fs
                    .downloadsDirectory
                    .appendingPathComponent("custom.keychain")),
            password: "keychain_password"
        )
        try await keychain.unlock()
        try await keychain.import(
            certificateFile: Settings.fs
                .downloadsDirectory
                .appendingPathComponent("abcpass.p12"),
            certificatePassword: "123"
        )
        
    }
}

Actions

iOS

  • Build: build project
  • Test: test project
  • Archive: archive project
  • ExportArchive: export archive
  • AppStore Connect: use https://github.com/onmyway133/AppStoreConnect
  • GetBuildSettings: get project build settings
  • GenerateIcon: generate app icon set
  • Screenshot: take screenshot
  • Frame: frame screenshot
  • UploadASC: upload IPA to AppStore Connect

ASC

  • Fetch certificates
  • Fetch provisioning profiles
  • Save certificates into file system
  • Save profiles into file system
  • Install provisioning profile
  • Fetch TestFlight versions
  • Fetch TestFlight builds
  • Fetch latest TestFlight build number

Project

  • Set version
  • Set build number
  • Increment build number

Keychain

  • Create custom keychain
  • Unlock keychain
  • Delete keychain
  • List searchable keychain paths
  • Add keychain to searchable paths
  • Import certificate into keychain

Simulator

  • Boot a simulator
  • Update and style simulator

Xcode

  • Print current Xcode path

macOS

  • Notarize: notarize project
  • MakeDMG: package as DMG
  • Sparkle: update Spackle Appcast file

Standard

  • Slack: send message to a Slack channel
  • RunScript: run arbitrary script
  • PrintWorkingDirectory: print current working directory
  • S3: upload to S3
  • Setapp: upload to Setapp
  • Download: download file
  • MoveFile: move file
  • CopyFile: copy file
  • AppCenter: use appcenter-cli

Settings

Configurations via Settings

  • Console: log to console
  • FileSystem: interact with file system
  • Environment: read environment values
  • CommandLine: run command line tools

Credit

License

Swiftlane is released under the MIT license. See LICENSE for details.

swiftlane's People

Contributors

donnywdavis avatar el-hoshino avatar onmyway133 avatar tedgonzalez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftlane's Issues

Slack support

Hi,

I've started analyzing what is required to enable Slack support and there are quite different options, depending on whether additional dependencies are allowed or not (how many of them, etc). More concretely, I've found this awesome library SlackKit - https://github.com/pvzig/SlackKit, however it pulls quite a few dependencies like:

  • Swifter
  • WebSocker
  • Starscream
  • Vapor (Core, Crypto, HTTP)
  • swift-nio (ssl, zlib)

Does it make sense to continue with SlackKit or there any guidelines / restrictions?

Thanks in advance.

Can't build package

Howdy. ๐Ÿ™‚

I'm trying to use the package for the first time, however, I cannot get it to build. I am getting errors in XcodeBuildProcessHandler.

The error is on this line let parser = XcbeautifyLib.Parser(additionalLines: { nil }). Parser is expecting a required renderer parameter and it does not have a default value.

I'm using Xcode 14.3
The version of xcbeautify that is being used is 0.21.1.

[Help needed] Can't build swift package

I tried to make a swiftlane package, but when I got some errors when trying to build the package

Error message:
me@my-machine swiftlanetest % swift build
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATSUI.framework/Modules/module.modulemap:2:19: error: umbrella for module 'ApplicationServices.ATSUI' already covers this directory
  umbrella header "ATSUnicode.h"
                  ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/ATSUI.framework/Modules/module.modulemap:4:10: error: inferred submodules require a module with an umbrella
  module * { export * }
         ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/AppKit.h"
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:15:9: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:15:
#import <AppKit/NSActionCell.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSActionCell.h:8:9: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSActionCell.h:8:
#import <AppKit/NSCell.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:11:9: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSCell.h:11:
#import <AppKit/NSText.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:9:9: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSText.h:9:
#import <AppKit/NSView.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSView.h:19:9: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSView.h:19:
#import <AppKit/NSResponder.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:10:9: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:10:
#import <AppKit/NSEvent.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:10:9: error: could not build module 'ApplicationServices'
#import <ApplicationServices/ApplicationServices.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:51:9: note: while building module 'CoreImage' imported from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:51:
#import <CoreImage/CIColor.h>
        ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreImage.h"
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.h:8:9: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImage.h:8:
#import <CoreImage/CoreImageDefines.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CoreImageDefines.h:19:10: error: could not build module 'ApplicationServices'
#include <ApplicationServices/ApplicationServices.h>
         ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:51:9: note: while building module 'CoreImage' imported from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSColor.h:51:
#import <CoreImage/CIColor.h>
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:10:9: note: while building module 'CoreVideo' imported from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIImage.h:10:
#import <CoreVideo/CoreVideo.h>
        ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/CoreVideo.h"
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:10: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CoreVideo.h:29:
#include <CoreVideo/CVPixelBuffer.h>
         ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:23:10: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVPixelBuffer.h:23:
#include <CoreVideo/CVImageBuffer.h>
         ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/CoreVideo.framework/Headers/CVImageBuffer.h:28:10: error: could not build module 'ApplicationServices'
#include <ApplicationServices/ApplicationServices.h>
         ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGLLayer.h:11:9: note: while building module 'QuartzCore' imported from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSOpenGLLayer.h:11:
#import <QuartzCore/CAOpenGLLayer.h>
        ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/QuartzCore.h"
        ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h:9:10: note: in file included from /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h:9:
#include <QuartzCore/CoreImage.h>
         ^
/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CoreImage.h:1:10: error: could not build module 'CoreImage'
#include <CoreImage/CoreImage.h>
         ^
<unknown>:0: error: could not build Objective-C module 'AppKit'
[144/927] Compiling a_i2d_fp.c
me@my-machine swiftlanetest % 
My Package.swift file:
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "swiftlanetest",
    platforms: [
        .macOS(.v12),
    ],
    products: [
        .executable(name: "swiftlane_runner", targets: ["SwiftlaneRunner"]),
    ],
    dependencies: [
        // Dependencies declare other packages that this package depends on.
        // .package(url: /* package url */, from: "1.0.0"),
        .package(name: "Swiftlane", url: "https://github.com/onmyway133/Swiftlane", from: "0.1.5"),
    ],
    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 this package depends on.
        .executableTarget(
            name: "SwiftlaneRunner",
            dependencies: [
                .product(name: "Swiftlane", package: "swiftlane"),
            ]),
    ]
)

And my specs are:
OS: macOS 12.2.1
Chips: Apple M1 Max
Xcode: 13.2.1

What should I do next?

exit when simulator is missing

Not sure if this is already supported but need to make sure that it works and is verified

When you run tests given specified simulators, if one of those are missing, we should fail the test

Incorporating Puma into its own lifecycle

Let's consider build tool as a product. To develop necessary features that are just in time and see the weak points it's essential to use the product day-to-day. So incorporating Puma and using it for development could be one of such use cases. So all developers are first-class users and experiencing all (some) problems that actual users see.

Some obvious use cases I see are related to releasing new version, like:

  • Send a message to Slack channel
  • Upload artifacts to GitHub, like source code or binaries
  • Bump version in Package.swi
  • Push version tag to git
  • Generate draft changelog based on the previous commits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.