iOS Github Actions(构建、测试和部署)

Art*_*uro 9 github ios github-actions github-actions-services

我正在尝试使用 github actons 制作一个简单的工作流程,因此当我将例如推送到我的主分支时,它会macOS-latestOS 12.4, iPhone 11 Pro Max. 因为很新,教程不全,谁能借我一下?

这就是我现在所拥有的:

name: StyleOn_Workflow

on: [push]

jobs:
  build:

    runs-on: macOS-latest
    strategy:
      matrix:
        destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']

    steps:
    - uses: actions/checkout@master
    - name: Build
      run: swift build -v

  test:
      name: Test
      runs-on: macOS-latest
      strategy:
          matrix:
            destination: ['platform=iOS Simulator,OS=12.4,name=iPhone 11 Pro Max']
      steps:
        - name: Checkout
          uses: actions/checkout@master
        - name: Run tests
          run: swift test -v
Run Code Online (Sandbox Code Playgroud)

此外,由于我没有将应用程序部署到应用程序商店,我该如何进行部署阶段?也许将它合并到主分支?我需要有 3 个阶段,构建、测试和部署

这是我得到的错误:

在此处输入图片说明

Ger*_*ely 9

根据您的问题,我认为您应该使用xcodebuild命令行工具而不是swift buildand swift test

正如我所见,您应该使用这样的命令进行构建:

set -o pipefail && xcodebuild clean -scheme $SCHEME -destination $DESTINATION -derivedDataPath $DERIVED_DATA_PATH build-for-testing
Run Code Online (Sandbox Code Playgroud)

并将其用于测试:

set -o pipefail && xcodebuild test-without-building -xctestrun $(find . -type f -name "*.xctestrun") -destination "platform=iOS Simulator,name=$DEVICE" -derivedDataPath $DERIVED_DATA_PATH -enableCodeCoverage YES
Run Code Online (Sandbox Code Playgroud)

请注意,您应该在作业之间上传和下载.xctestrun文件。

您可以在此处找到详细示例。