Skip to content

Commit

Permalink
Update CI for latest macOS and Xcode
Browse files Browse the repository at this point in the history
  • Loading branch information
luispadron committed Sep 19, 2024
1 parent d4cc5b5 commit 5e6476a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:
jobs:
xcode-build:
name: Xcode Build
runs-on: macOS-11
runs-on: macos-latest
strategy:
matrix:
platform: ['iOS_13']
fail-fast: false
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Bundle Install
run: bundle install --gemfile=Example/Gemfile
- name: Prepare Simulator Runtimes
Expand All @@ -26,17 +26,17 @@ jobs:
- name: Build and Test
run: Scripts/build.swift xcode ${{ matrix.platform }} `which xcpretty`
- name: Upload Results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
if: failure()
with:
name: Test Results
path: .build/derivedData/**/Logs/Test/*.xcresult
pod-lint:
name: Pod Lint
runs-on: macOS-11
runs-on: macos-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Bundle Install
run: bundle install --gemfile=Example/Gemfile
- name: Pod Install
Expand All @@ -47,7 +47,7 @@ jobs:
run: bundle exec --gemfile=Example/Gemfile pod lib lint --verbose --fail-fast --include-podspecs=Stagehand.podspec StagehandTesting.podspec
spm:
name: SPM Build
runs-on: macOS-11
runs-on: macos-latest
strategy:
matrix:
platform: ['iOS_13']
Expand All @@ -61,7 +61,7 @@ jobs:
run: Scripts/build.swift spm ${{ matrix.platform }}
bazel:
name: Bazel
runs-on: macOS-13
runs-on: macos-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
Expand Down
18 changes: 12 additions & 6 deletions Scripts/build.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ enum Task: String, CustomStringConvertible {
}
}

var scheme: String {
var scheme: String? {
switch self {
case .xcode:
return "Stagehand Demo App"
case .spm:
return "Stagehand-Package"
return nil
}
}

var shouldGenerateXcodeProject: Bool {
var shouldRunSwiftBuild: Bool {
switch self {
case .spm:
return true
Expand Down Expand Up @@ -131,8 +131,14 @@ guard let task = Task(rawValue: rawTask) else {
throw TaskError.code(1)
}

if task.shouldGenerateXcodeProject {
try execute(commandPath: "/usr/bin/swift", arguments: ["package", "generate-xcodeproj", "--output=generated/"])
if task.shouldRunSwiftBuild {
try execute(commandPath: "/usr/bin/swift", arguments: ["build"])
Darwin.exit(0)
}

guard let scheme = task.scheme else {
print("Received unknown scheme for Xcode task \"\(rawTask)\"")
throw TaskError.code(1)
}

guard let platform = Platform(rawValue: rawPlatform) else {
Expand All @@ -152,7 +158,7 @@ if let workspace = task.workspace {

xcodeBuildArguments.append(
contentsOf: [
"-scheme", task.scheme,
"-scheme", scheme,
"-sdk", "iphonesimulator",
"-PBXBuildsContinueAfterErrors=0",
"-destination", platform.destination,
Expand Down

0 comments on commit 5e6476a

Please sign in to comment.