From f24beb996564ad80b15648974c32bad9aad811df Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 15:48:50 -0800 Subject: [PATCH 01/15] Slightly better layout for Xcode App --- .../contents.xcworkspacedata | 2 +- .../project.pbxproj | 29 +++++++++++++---- .../SwiftProjectTemplateApp/Placeholder.swift | 1 + .../.gitignore | 0 .../Package.swift | 32 +++++++++++++++++++ .../SwiftProjectTemplateAppPackage}/App.swift | 0 .../Content View.swift | 0 .../SwiftProjectTemplatePackageTests.swift | 0 .../SwiftProjectTemplatePackage/Package.swift | 32 ------------------- .../SwiftProjectTemplatePackage.swift | 2 -- 10 files changed, 57 insertions(+), 41 deletions(-) create mode 100644 Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/Placeholder.swift rename Xcode/{SwiftProjectTemplatePackage => SwiftProjectTemplateAppPackage}/.gitignore (100%) create mode 100644 Xcode/SwiftProjectTemplateAppPackage/Package.swift rename Xcode/{SwiftProjectTemplateApp/SwiftProjectTemplateApp => SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage}/App.swift (100%) rename Xcode/{SwiftProjectTemplateApp/SwiftProjectTemplateApp => SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage}/Content View.swift (100%) rename Xcode/{SwiftProjectTemplatePackage => SwiftProjectTemplateAppPackage}/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift (100%) delete mode 100644 Xcode/SwiftProjectTemplatePackage/Package.swift delete mode 100644 Xcode/SwiftProjectTemplatePackage/Sources/SwiftProjectTemplatePackage/SwiftProjectTemplatePackage.swift diff --git a/Xcode/SwiftProjectTemplate.xcworkspace/contents.xcworkspacedata b/Xcode/SwiftProjectTemplate.xcworkspace/contents.xcworkspacedata index 3eda0e8..382e077 100644 --- a/Xcode/SwiftProjectTemplate.xcworkspace/contents.xcworkspacedata +++ b/Xcode/SwiftProjectTemplate.xcworkspace/contents.xcworkspacedata @@ -2,7 +2,7 @@ + location = "group:SwiftProjectTemplateAppPackage"> diff --git a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj index b475e78..900d2e6 100644 --- a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj +++ b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 5E7621BA2CD7FA7900E5C4CA /* SwiftProjectTemplatePackage in Frameworks */ = {isa = PBXBuildFile; productRef = 5E7621B92CD7FA7900E5C4CA /* SwiftProjectTemplatePackage */; }; + 5E28D4402CE02B9A00420ECE /* SwiftProjectTemplateAppPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 5E28D43F2CE02B9A00420ECE /* SwiftProjectTemplateAppPackage */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -27,7 +27,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5E7621BA2CD7FA7900E5C4CA /* SwiftProjectTemplatePackage in Frameworks */, + 5E28D4402CE02B9A00420ECE /* SwiftProjectTemplateAppPackage in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -71,6 +71,7 @@ name = SwiftProjectTemplateApp; packageProductDependencies = ( 5E7621B92CD7FA7900E5C4CA /* SwiftProjectTemplatePackage */, + 5E28D43F2CE02B9A00420ECE /* SwiftProjectTemplateAppPackage */, ); productName = SwiftProjectTemplateApp; productReference = 5E2C493B2CA4F8C9001FB83C /* SwiftProjectTemplateApp.app */; @@ -84,10 +85,11 @@ attributes = { BuildIndependentTargetsInParallel = 1; LastSwiftUpdateCheck = 1610; - LastUpgradeCheck = 1610; + LastUpgradeCheck = 1620; TargetAttributes = { 5E2C493A2CA4F8C9001FB83C = { CreatedOnToolsVersion = 16.1; + LastSwiftMigration = 1620; }; }; }; @@ -101,7 +103,7 @@ mainGroup = 5E2C49322CA4F8C9001FB83C; minimizedProjectReferenceProxies = 1; packageReferences = ( - 5E7621B82CD7FA7900E5C4CA /* XCLocalSwiftPackageReference "../SwiftProjectTemplatePackage" */, + 5E28D43E2CE02B9A00420ECE /* XCLocalSwiftPackageReference "../SwiftProjectTemplateAppPackage" */, ); preferredProjectObjectVersion = 77; productRefGroup = 5E2C493C2CA4F8C9001FB83C /* Products */; @@ -168,6 +170,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -229,6 +232,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -253,10 +257,14 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SwiftProjectTemplateApp/SwiftProjectTemplateApp.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"SwiftProjectTemplateApp/Preview Content\""; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; @@ -279,6 +287,7 @@ SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; XROS_DEPLOYMENT_TARGET = 2.1; @@ -290,10 +299,14 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = SwiftProjectTemplateApp/SwiftProjectTemplateApp.entitlements; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; + DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"SwiftProjectTemplateApp/Preview Content\""; + DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; "INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES; @@ -346,13 +359,17 @@ /* End XCConfigurationList section */ /* Begin XCLocalSwiftPackageReference section */ - 5E7621B82CD7FA7900E5C4CA /* XCLocalSwiftPackageReference "../SwiftProjectTemplatePackage" */ = { + 5E28D43E2CE02B9A00420ECE /* XCLocalSwiftPackageReference "../SwiftProjectTemplateAppPackage" */ = { isa = XCLocalSwiftPackageReference; - relativePath = ../SwiftProjectTemplatePackage; + relativePath = ../SwiftProjectTemplateAppPackage; }; /* End XCLocalSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ + 5E28D43F2CE02B9A00420ECE /* SwiftProjectTemplateAppPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = SwiftProjectTemplateAppPackage; + }; 5E7621B92CD7FA7900E5C4CA /* SwiftProjectTemplatePackage */ = { isa = XCSwiftPackageProductDependency; productName = SwiftProjectTemplatePackage; diff --git a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/Placeholder.swift b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/Placeholder.swift new file mode 100644 index 0000000..1a901a8 --- /dev/null +++ b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/Placeholder.swift @@ -0,0 +1 @@ +/// This file only exists so code signing doesn't fail diff --git a/Xcode/SwiftProjectTemplatePackage/.gitignore b/Xcode/SwiftProjectTemplateAppPackage/.gitignore similarity index 100% rename from Xcode/SwiftProjectTemplatePackage/.gitignore rename to Xcode/SwiftProjectTemplateAppPackage/.gitignore diff --git a/Xcode/SwiftProjectTemplateAppPackage/Package.swift b/Xcode/SwiftProjectTemplateAppPackage/Package.swift new file mode 100644 index 0000000..166c95c --- /dev/null +++ b/Xcode/SwiftProjectTemplateAppPackage/Package.swift @@ -0,0 +1,32 @@ +// swift-tools-version: 6.0 + +import PackageDescription + +let package = Package( + name: "SwiftProjectTemplateAppPackage", + platforms: [ + .macOS(.v15), + .iOS(.v18), + ], + products: [ + .library( + name: "SwiftProjectTemplateAppPackage", + targets: ["SwiftProjectTemplateAppPackage"] + ) + ], + dependencies: [ + .package(name: "SwiftProjectTemplate", path: "../..") + ], + targets: [ + .target( + name: "SwiftProjectTemplateAppPackage", + dependencies: [ + "SwiftProjectTemplate" + ] + ), + .testTarget( + name: "SwiftProjectTemplateAppPackageTests", + dependencies: ["SwiftProjectTemplateAppPackage"] + ), + ] +) diff --git a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/App.swift b/Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/App.swift similarity index 100% rename from Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/App.swift rename to Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/App.swift diff --git a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/Content View.swift b/Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/Content View.swift similarity index 100% rename from Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp/Content View.swift rename to Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/Content View.swift diff --git a/Xcode/SwiftProjectTemplatePackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift b/Xcode/SwiftProjectTemplateAppPackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift similarity index 100% rename from Xcode/SwiftProjectTemplatePackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift rename to Xcode/SwiftProjectTemplateAppPackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift diff --git a/Xcode/SwiftProjectTemplatePackage/Package.swift b/Xcode/SwiftProjectTemplatePackage/Package.swift deleted file mode 100644 index a2fbc83..0000000 --- a/Xcode/SwiftProjectTemplatePackage/Package.swift +++ /dev/null @@ -1,32 +0,0 @@ -// swift-tools-version: 6.0 - -import PackageDescription - -let package = Package( - name: "SwiftProjectTemplatePackage", - platforms: [ - .macOS(.v15), - .iOS(.v18), - ], - products: [ - .library( - name: "SwiftProjectTemplatePackage", - targets: ["SwiftProjectTemplatePackage"] - ) - ], - dependencies: [ - .package(path: "../..") - ], - targets: [ - .target( - name: "SwiftProjectTemplatePackage", - dependencies: [ - "SwiftProjectTemplate" - ] - ), - .testTarget( - name: "SwiftProjectTemplatePackageTests", - dependencies: ["SwiftProjectTemplatePackage"] - ), - ] -) diff --git a/Xcode/SwiftProjectTemplatePackage/Sources/SwiftProjectTemplatePackage/SwiftProjectTemplatePackage.swift b/Xcode/SwiftProjectTemplatePackage/Sources/SwiftProjectTemplatePackage/SwiftProjectTemplatePackage.swift deleted file mode 100644 index 08b22b8..0000000 --- a/Xcode/SwiftProjectTemplatePackage/Sources/SwiftProjectTemplatePackage/SwiftProjectTemplatePackage.swift +++ /dev/null @@ -1,2 +0,0 @@ -// The Swift Programming Language -// https://docs.swift.org/swift-book From 1395d1e267dba9889adb3c70333e1907207c3e75 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 15:53:50 -0800 Subject: [PATCH 02/15] Auto-remove template specialization logic after specializing manually --- .github/workflows/specialize-template.yml | 4 ---- specialize-template.sh | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/specialize-template.yml b/.github/workflows/specialize-template.yml index d070331..46e06ed 100644 --- a/.github/workflows/specialize-template.yml +++ b/.github/workflows/specialize-template.yml @@ -35,10 +35,6 @@ jobs: # Run specialization script (requires variables defined above) ./specialize-template.sh "$NEW_PROJECT_BUNDLE_ID_PREFIX" "$NEW_PROJECT_NAME" - rm -rf \ - .github/workflows/specialize-template.yml \ - specialize-template.sh - - name: Commit run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" diff --git a/specialize-template.sh b/specialize-template.sh index 45fb925..d6aec92 100755 --- a/specialize-template.sh +++ b/specialize-template.sh @@ -37,4 +37,9 @@ echo "Removing backup files..." find . -name '*.template-specialization-backup' -exec rm {} \; git add -A +echo "Remove this file and the associated GitHub action." +rm -rf \ + .github/workflows/specialize-template.yml \ + specialize-template.sh + echo "Done." From 59a550b078723a25779daacdf477e656a1221944 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 16:34:43 -0800 Subject: [PATCH 03/15] Add CI --- .devcontainer/devcontainer-helper | 54 +++++++++++ .github/workflows/Build and Test.yml | 97 +++++++++++++++++++ .../SwiftProjectTemplateAppPackage/App.swift | 2 +- .../SwiftProjectTemplatePackageTests.swift | 2 +- 4 files changed, 153 insertions(+), 2 deletions(-) create mode 100755 .devcontainer/devcontainer-helper create mode 100644 .github/workflows/Build and Test.yml diff --git a/.devcontainer/devcontainer-helper b/.devcontainer/devcontainer-helper new file mode 100755 index 0000000..c2779f4 --- /dev/null +++ b/.devcontainer/devcontainer-helper @@ -0,0 +1,54 @@ +#!/bin/bash + +set -euo pipefail + +PROJECT_ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd ) +cd "$PROJECT_ROOT" || exit 1 + +print_help() { + cat <<- EOF + Usage: devcontainer-helper --make-singular + --clean + + The devcontainer/ci GitHub action does not support named devcontainers (i.e. ones located in subfolders of .devcontainer), so this script makes the selected devcontainer the singular devcontainer in the repo. +EOF +} + +case "$1" in + "--help") + print_help + ;; + + "--make-singular") + DEVCONTAINER_NAME=$2 + if [ -z "$DEVCONTAINER_NAME" ]; then + print_help + exit 1 + fi + + if [[ ! -d ".actual-devcontainer" ]]; then + mv .devcontainer .actual-devcontainer + else + rm -rf .devcontainer + fi + + cp -R ".actual-devcontainer/$DEVCONTAINER_NAME" .devcontainer/ + cp -R ".actual-devcontainer/$DEVCONTAINER_NAME" .devcontainer/ + cp .actual-devcontainer/{devcontainer,cmake-tools}-helper .devcontainer/ + ;; + + "--clean") + if [[ ! -d ".actual-devcontainer" ]]; then + echo "No singular devcontainer to clean" + exit 1 + fi + + rm -rf .devcontainer + mv .actual-devcontainer .devcontainer + ;; + + *) + print_help + exit 1 + ;; +esac diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml new file mode 100644 index 0000000..9320df3 --- /dev/null +++ b/.github/workflows/Build and Test.yml @@ -0,0 +1,97 @@ +# Build and Test + +name: Build and Test +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + build-and-test: + name: Build and Test for Apple Platforms + + strategy: + matrix: + xcode-version: + - "16" + xcode-configuration: + - destination: "platform=iOS Simulator,name=iPhone 16" + sdk: "iphonesimulator" + - destination: "platform=macOS" + sdk: "macosx" + swift-configuration: + - "debug" + - "release" + + runs-on: macos-latest + + steps: + - name: Select Xcode + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer + + - name: Build + run: | + xcrun xcodebuild clean build build-for-testing \ + -workspace Xcode/SwiftProjectTemplate.xcworkspace \ + -scheme SwiftProjectTemplate \ + -configuration ${{ matrix.swift-configuration }} \ + -sdk ${{ matrix.xcode-configuration.sdk }} \ + -destination ${{ matrix.xcode-configuration.destination }} + + - name: Test + run: | + xcrun xcodebuild test \ + -workspace Xcode/SwiftProjectTemplate.xcworkspace \ + -scheme SwiftProjectTemplate \ + -configuration ${{ matrix.swift-configuration }} \ + -sdk ${{ matrix.xcode-configuration.sdk }} \ + -destination ${{ matrix.xcode-configuration.destination }} + + - name: Check that repository is clean + run: + git diff --exit-code + + build-and-test-in-devcontainer: + name: Build and Test in Devcontainer + + strategy: + matrix: + devcontainer-name: ["default"] + swift-configuration: ["debug", "release"] + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Make devcontainer '${{ matrix.devcontainer-name }}' singular + run: .devcontainer/devcontainer-helper --make-singular ${{ matrix.devcontainer-name }} + + - name: Initialize devcontainer + uses: devcontainers/ci@v0.3 + with: + push: never + runCmd: | + echo "Devcontainer Initialized." + + - name: Build + uses: devcontainers/ci@v0.3 + with: + push: never + runCmd: | + swift build --build-tests --configuration ${{ matrix.swift-configuration }} + + - name: Test + uses: devcontainers/ci@v0.3 + with: + push: never + runCmd: | + swift test --skip-build + + - name: Check that repository is clean + run: + .devcontainer/devcontainer-helper --clean + git diff --exit-code \ No newline at end of file diff --git a/Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/App.swift b/Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/App.swift index 7292341..5b1dbc2 100644 --- a/Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/App.swift +++ b/Xcode/SwiftProjectTemplateAppPackage/Sources/SwiftProjectTemplateAppPackage/App.swift @@ -1,7 +1,7 @@ import SwiftUI @main -struct SwiftProjectTemplateAppApp: App { +struct App: SwiftUI.App { var body: some Scene { WindowGroup { ContentView() diff --git a/Xcode/SwiftProjectTemplateAppPackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift b/Xcode/SwiftProjectTemplateAppPackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift index de0c96b..51aae70 100644 --- a/Xcode/SwiftProjectTemplateAppPackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift +++ b/Xcode/SwiftProjectTemplateAppPackage/Tests/SwiftProjectTemplatePackageTests/SwiftProjectTemplatePackageTests.swift @@ -1,6 +1,6 @@ import Testing -@testable import SwiftProjectTemplatePackage +@testable import SwiftProjectTemplateAppPackage @Test func example() async throws { // Write your test here and use APIs like `#expect(...)` to check expected conditions. From 01e61e226254b83b307e69876bdb9cd4d8b34cc5 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 17:08:10 -0800 Subject: [PATCH 04/15] Fex stuff --- .devcontainer/devcontainer-helper | 2 +- .github/workflows/Build and Test.yml | 13 +- .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../project.pbxproj | 165 ++++++++++++++++-- .../SwiftProjectTemplateAppUITests.swift | 23 +++ ...ProjectTemplateAppUITestsLaunchTests.swift | 23 +++ 7 files changed, 202 insertions(+), 24 deletions(-) rename Xcode/{SwiftProjectTemplate.xcworkspace => SwiftProjectTemplateApp.xcworkspace}/contents.xcworkspacedata (100%) rename Xcode/{SwiftProjectTemplate.xcworkspace => SwiftProjectTemplateApp.xcworkspace}/xcshareddata/IDEWorkspaceChecks.plist (100%) create mode 100644 Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITests.swift create mode 100644 Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITestsLaunchTests.swift diff --git a/.devcontainer/devcontainer-helper b/.devcontainer/devcontainer-helper index c2779f4..b10b2c8 100755 --- a/.devcontainer/devcontainer-helper +++ b/.devcontainer/devcontainer-helper @@ -34,7 +34,7 @@ case "$1" in cp -R ".actual-devcontainer/$DEVCONTAINER_NAME" .devcontainer/ cp -R ".actual-devcontainer/$DEVCONTAINER_NAME" .devcontainer/ - cp .actual-devcontainer/{devcontainer,cmake-tools}-helper .devcontainer/ + cp .actual-devcontainer/devcontainer-helper .devcontainer/ ;; "--clean") diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index 9320df3..85cf117 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -28,23 +28,26 @@ jobs: runs-on: macos-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Select Xcode run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer - name: Build run: | xcrun xcodebuild clean build build-for-testing \ - -workspace Xcode/SwiftProjectTemplate.xcworkspace \ - -scheme SwiftProjectTemplate \ + -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ + -scheme SwiftProjectTemplateApp \ -configuration ${{ matrix.swift-configuration }} \ -sdk ${{ matrix.xcode-configuration.sdk }} \ -destination ${{ matrix.xcode-configuration.destination }} - name: Test run: | - xcrun xcodebuild test \ - -workspace Xcode/SwiftProjectTemplate.xcworkspace \ - -scheme SwiftProjectTemplate \ + xcrun xcodebuild test-without-building \ + -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ + -scheme SwiftProjectTemplateApp \ -configuration ${{ matrix.swift-configuration }} \ -sdk ${{ matrix.xcode-configuration.sdk }} \ -destination ${{ matrix.xcode-configuration.destination }} diff --git a/Xcode/SwiftProjectTemplate.xcworkspace/contents.xcworkspacedata b/Xcode/SwiftProjectTemplateApp.xcworkspace/contents.xcworkspacedata similarity index 100% rename from Xcode/SwiftProjectTemplate.xcworkspace/contents.xcworkspacedata rename to Xcode/SwiftProjectTemplateApp.xcworkspace/contents.xcworkspacedata diff --git a/Xcode/SwiftProjectTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Xcode/SwiftProjectTemplateApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from Xcode/SwiftProjectTemplate.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to Xcode/SwiftProjectTemplateApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj index 900d2e6..dd97da7 100644 --- a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj +++ b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateApp.xcodeproj/project.pbxproj @@ -7,14 +7,30 @@ objects = { /* Begin PBXBuildFile section */ - 5E28D4402CE02B9A00420ECE /* SwiftProjectTemplateAppPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 5E28D43F2CE02B9A00420ECE /* SwiftProjectTemplateAppPackage */; }; + 5E28D4792CE03E4900420ECE /* SwiftProjectTemplateAppPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 5E28D4782CE03E4900420ECE /* SwiftProjectTemplateAppPackage */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + 5E28D4572CE03A4E00420ECE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 5E2C49332CA4F8C9001FB83C /* Project object */; + proxyType = 1; + remoteGlobalIDString = 5E2C493A2CA4F8C9001FB83C; + remoteInfo = SwiftProjectTemplateApp; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXFileReference section */ + 5E28D4512CE03A4E00420ECE /* SwiftProjectTemplateAppUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftProjectTemplateAppUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5E2C493B2CA4F8C9001FB83C /* SwiftProjectTemplateApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftProjectTemplateApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ + 5E28D4522CE03A4E00420ECE /* SwiftProjectTemplateAppUITests */ = { + isa = PBXFileSystemSynchronizedRootGroup; + path = SwiftProjectTemplateAppUITests; + sourceTree = ""; + }; 5E2C493D2CA4F8C9001FB83C /* SwiftProjectTemplateApp */ = { isa = PBXFileSystemSynchronizedRootGroup; path = SwiftProjectTemplateApp; @@ -23,21 +39,37 @@ /* End PBXFileSystemSynchronizedRootGroup section */ /* Begin PBXFrameworksBuildPhase section */ + 5E28D44E2CE03A4E00420ECE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5E2C49382CA4F8C9001FB83C /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5E28D4402CE02B9A00420ECE /* SwiftProjectTemplateAppPackage in Frameworks */, + 5E28D4792CE03E4900420ECE /* SwiftProjectTemplateAppPackage in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 5E28D4772CE03E4900420ECE /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; 5E2C49322CA4F8C9001FB83C = { isa = PBXGroup; children = ( 5E2C493D2CA4F8C9001FB83C /* SwiftProjectTemplateApp */, + 5E28D4522CE03A4E00420ECE /* SwiftProjectTemplateAppUITests */, + 5E28D4772CE03E4900420ECE /* Frameworks */, 5E2C493C2CA4F8C9001FB83C /* Products */, ); sourceTree = ""; @@ -46,6 +78,7 @@ isa = PBXGroup; children = ( 5E2C493B2CA4F8C9001FB83C /* SwiftProjectTemplateApp.app */, + 5E28D4512CE03A4E00420ECE /* SwiftProjectTemplateAppUITests.xctest */, ); name = Products; sourceTree = ""; @@ -53,6 +86,29 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ + 5E28D4502CE03A4E00420ECE /* SwiftProjectTemplateAppUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 5E28D4592CE03A4E00420ECE /* Build configuration list for PBXNativeTarget "SwiftProjectTemplateAppUITests" */; + buildPhases = ( + 5E28D44D2CE03A4E00420ECE /* Sources */, + 5E28D44E2CE03A4E00420ECE /* Frameworks */, + 5E28D44F2CE03A4E00420ECE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 5E28D4582CE03A4E00420ECE /* PBXTargetDependency */, + ); + fileSystemSynchronizedGroups = ( + 5E28D4522CE03A4E00420ECE /* SwiftProjectTemplateAppUITests */, + ); + name = SwiftProjectTemplateAppUITests; + packageProductDependencies = ( + ); + productName = SwiftProjectTemplateAppUITests; + productReference = 5E28D4512CE03A4E00420ECE /* SwiftProjectTemplateAppUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; 5E2C493A2CA4F8C9001FB83C /* SwiftProjectTemplateApp */ = { isa = PBXNativeTarget; buildConfigurationList = 5E2C494A2CA4F8CA001FB83C /* Build configuration list for PBXNativeTarget "SwiftProjectTemplateApp" */; @@ -70,8 +126,7 @@ ); name = SwiftProjectTemplateApp; packageProductDependencies = ( - 5E7621B92CD7FA7900E5C4CA /* SwiftProjectTemplatePackage */, - 5E28D43F2CE02B9A00420ECE /* SwiftProjectTemplateAppPackage */, + 5E28D4782CE03E4900420ECE /* SwiftProjectTemplateAppPackage */, ); productName = SwiftProjectTemplateApp; productReference = 5E2C493B2CA4F8C9001FB83C /* SwiftProjectTemplateApp.app */; @@ -84,9 +139,13 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1610; + LastSwiftUpdateCheck = 1620; LastUpgradeCheck = 1620; TargetAttributes = { + 5E28D4502CE03A4E00420ECE = { + CreatedOnToolsVersion = 16.2; + TestTargetID = 5E2C493A2CA4F8C9001FB83C; + }; 5E2C493A2CA4F8C9001FB83C = { CreatedOnToolsVersion = 16.1; LastSwiftMigration = 1620; @@ -103,7 +162,7 @@ mainGroup = 5E2C49322CA4F8C9001FB83C; minimizedProjectReferenceProxies = 1; packageReferences = ( - 5E28D43E2CE02B9A00420ECE /* XCLocalSwiftPackageReference "../SwiftProjectTemplateAppPackage" */, + 5E28D45C2CE03D7200420ECE /* XCLocalSwiftPackageReference "../SwiftProjectTemplateAppPackage" */, ); preferredProjectObjectVersion = 77; productRefGroup = 5E2C493C2CA4F8C9001FB83C /* Products */; @@ -111,11 +170,19 @@ projectRoot = ""; targets = ( 5E2C493A2CA4F8C9001FB83C /* SwiftProjectTemplateApp */, + 5E28D4502CE03A4E00420ECE /* SwiftProjectTemplateAppUITests */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ + 5E28D44F2CE03A4E00420ECE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5E2C49392CA4F8C9001FB83C /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -126,6 +193,13 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ + 5E28D44D2CE03A4E00420ECE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 5E2C49372CA4F8C9001FB83C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -135,7 +209,57 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + 5E28D4582CE03A4E00420ECE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 5E2C493A2CA4F8C9001FB83C /* SwiftProjectTemplateApp */; + targetProxy = 5E28D4572CE03A4E00420ECE /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin XCBuildConfiguration section */ + 5E28D45A2CE03A4E00420ECE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + MACOSX_DEPLOYMENT_TARGET = 15.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.github.georgelyon.SwiftProjectTemplateApp.SwiftProjectTemplateAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + TEST_TARGET_NAME = SwiftProjectTemplateApp; + XROS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 5E28D45B2CE03A4E00420ECE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; + MACOSX_DEPLOYMENT_TARGET = 15.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.github.georgelyon.SwiftProjectTemplateApp.SwiftProjectTemplateAppUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = auto; + SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx xros xrsimulator"; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2,7"; + TEST_TARGET_NAME = SwiftProjectTemplateApp; + XROS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; 5E2C49482CA4F8CA001FB83C /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -277,10 +401,10 @@ "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 18.1; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 15.1; + MACOSX_DEPLOYMENT_TARGET = 15.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.github.georgelyon.SwiftProjectTemplateApp; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -290,7 +414,7 @@ SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; - XROS_DEPLOYMENT_TARGET = 2.1; + XROS_DEPLOYMENT_TARGET = 2.0; }; name = Debug; }; @@ -319,10 +443,10 @@ "INFOPLIST_KEY_UIStatusBarStyle[sdk=iphonesimulator*]" = UIStatusBarStyleDefault; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 18.1; + IPHONEOS_DEPLOYMENT_TARGET = 18.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 15.1; + MACOSX_DEPLOYMENT_TARGET = 15.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.github.georgelyon.SwiftProjectTemplateApp; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -331,13 +455,22 @@ SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2,7"; - XROS_DEPLOYMENT_TARGET = 2.1; + XROS_DEPLOYMENT_TARGET = 2.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 5E28D4592CE03A4E00420ECE /* Build configuration list for PBXNativeTarget "SwiftProjectTemplateAppUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5E28D45A2CE03A4E00420ECE /* Debug */, + 5E28D45B2CE03A4E00420ECE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 5E2C49362CA4F8C9001FB83C /* Build configuration list for PBXProject "SwiftProjectTemplateApp" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -359,21 +492,17 @@ /* End XCConfigurationList section */ /* Begin XCLocalSwiftPackageReference section */ - 5E28D43E2CE02B9A00420ECE /* XCLocalSwiftPackageReference "../SwiftProjectTemplateAppPackage" */ = { + 5E28D45C2CE03D7200420ECE /* XCLocalSwiftPackageReference "../SwiftProjectTemplateAppPackage" */ = { isa = XCLocalSwiftPackageReference; relativePath = ../SwiftProjectTemplateAppPackage; }; /* End XCLocalSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 5E28D43F2CE02B9A00420ECE /* SwiftProjectTemplateAppPackage */ = { + 5E28D4782CE03E4900420ECE /* SwiftProjectTemplateAppPackage */ = { isa = XCSwiftPackageProductDependency; productName = SwiftProjectTemplateAppPackage; }; - 5E7621B92CD7FA7900E5C4CA /* SwiftProjectTemplatePackage */ = { - isa = XCSwiftPackageProductDependency; - productName = SwiftProjectTemplatePackage; - }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 5E2C49332CA4F8C9001FB83C /* Project object */; diff --git a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITests.swift b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITests.swift new file mode 100644 index 0000000..ee57f23 --- /dev/null +++ b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITests.swift @@ -0,0 +1,23 @@ +import XCTest + +final class SwiftProjectTemplateAppUITests: XCTestCase { + + override func setUpWithError() throws { + continueAfterFailure = false + } + + @MainActor + func testExample() throws { + let app = XCUIApplication() + app.launch() + } + + @MainActor + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITestsLaunchTests.swift b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITestsLaunchTests.swift new file mode 100644 index 0000000..66637fd --- /dev/null +++ b/Xcode/SwiftProjectTemplateApp/SwiftProjectTemplateAppUITests/SwiftProjectTemplateAppUITestsLaunchTests.swift @@ -0,0 +1,23 @@ +import XCTest + +final class SwiftProjectTemplateAppUITestsLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + @MainActor + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +} From 1b29a4a0f1961c450cfdabf651d147d46bc7b6e6 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 17:09:40 -0800 Subject: [PATCH 05/15] Fix more --- .github/workflows/Build and Test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index 85cf117..0aaa37c 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -39,18 +39,18 @@ jobs: xcrun xcodebuild clean build build-for-testing \ -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ -scheme SwiftProjectTemplateApp \ - -configuration ${{ matrix.swift-configuration }} \ - -sdk ${{ matrix.xcode-configuration.sdk }} \ - -destination ${{ matrix.xcode-configuration.destination }} + -configuration "${{ matrix.swift-configuration }}" \ + -sdk "${{ matrix.xcode-configuration.sdk }}" \ + -destination "${{ matrix.xcode-configuration.destination }}" - name: Test run: | xcrun xcodebuild test-without-building \ -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ -scheme SwiftProjectTemplateApp \ - -configuration ${{ matrix.swift-configuration }} \ - -sdk ${{ matrix.xcode-configuration.sdk }} \ - -destination ${{ matrix.xcode-configuration.destination }} + -configuration "${{ matrix.swift-configuration }}" \ + -sdk "${{ matrix.xcode-configuration.sdk }}" \ + -destination "${{ matrix.xcode-configuration.destination }}" - name: Check that repository is clean run: From 1914e8a5b33e52db08fd190561769223cd28a258 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 17:12:16 -0800 Subject: [PATCH 06/15] Fix? --- .github/workflows/Build and Test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index 0aaa37c..adbe0e3 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -89,6 +89,7 @@ jobs: - name: Test uses: devcontainers/ci@v0.3 + if: matrix.swift-configuration != 'release' with: push: never runCmd: | From 70c6045cdf9371a710c7bedeb975b6687a5d8ac3 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 17:17:20 -0800 Subject: [PATCH 07/15] Update to macos 15 --- .github/workflows/Build and Test.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index adbe0e3..db2db08 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -25,7 +25,7 @@ jobs: - "debug" - "release" - runs-on: macos-latest + runs-on: macos-15 steps: - name: Checkout @@ -81,6 +81,14 @@ jobs: echo "Devcontainer Initialized." - name: Build + uses: devcontainers/ci@v0.3 + with: + push: never + runCmd: | + swift build --configuration ${{ matrix.swift-configuration }} + + - name: Build Tests + if: matrix.swift-configuration == 'debug' uses: devcontainers/ci@v0.3 with: push: never @@ -89,7 +97,7 @@ jobs: - name: Test uses: devcontainers/ci@v0.3 - if: matrix.swift-configuration != 'release' + if: matrix.swift-configuration == 'debug' with: push: never runCmd: | From c7f18afdc12d760b4af227c80c195b970f3c8ed8 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:08:04 -0800 Subject: [PATCH 08/15] Upload screenshots --- .github/workflows/Build and Test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index db2db08..694d0c5 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -39,6 +39,7 @@ jobs: xcrun xcodebuild clean build build-for-testing \ -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ -scheme SwiftProjectTemplateApp \ + -derivedDataPath ".build/Xcode.noindex/DerivedData" \ -configuration "${{ matrix.swift-configuration }}" \ -sdk "${{ matrix.xcode-configuration.sdk }}" \ -destination "${{ matrix.xcode-configuration.destination }}" @@ -48,9 +49,16 @@ jobs: xcrun xcodebuild test-without-building \ -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ -scheme SwiftProjectTemplateApp \ + -derivedDataPath ".build/Xcode.noindex/DerivedData" \ -configuration "${{ matrix.swift-configuration }}" \ -sdk "${{ matrix.xcode-configuration.sdk }}" \ -destination "${{ matrix.xcode-configuration.destination }}" + + - name: Upload Test Results + uses: actions/upload-artifact@v4 + with: + name: Test Results + path: .build/Xcode.noindex/DerivedData/Logs/Test - name: Check that repository is clean run: From 69c58ed7baf4c0d49da6bde2943bf9206327899b Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:12:37 -0800 Subject: [PATCH 09/15] Disambiguate results --- .github/workflows/Build and Test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index 694d0c5..4d84d9b 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -17,9 +17,11 @@ jobs: xcode-version: - "16" xcode-configuration: - - destination: "platform=iOS Simulator,name=iPhone 16" + - name: iOS Simulator + destination: "platform=iOS Simulator,name=iPhone 16" sdk: "iphonesimulator" - - destination: "platform=macOS" + - name: macOS + destination: "platform=macOS" sdk: "macosx" swift-configuration: - "debug" @@ -57,7 +59,7 @@ jobs: - name: Upload Test Results uses: actions/upload-artifact@v4 with: - name: Test Results + name: Test Results (${{ matrix.xcode-configuration.name }}) path: .build/Xcode.noindex/DerivedData/Logs/Test - name: Check that repository is clean From 0bd337c514205b57d4eb1423c103bf7c3cf13be0 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:18:28 -0800 Subject: [PATCH 10/15] Try again --- .github/workflows/Build and Test.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index 4d84d9b..5a96a56 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -17,11 +17,9 @@ jobs: xcode-version: - "16" xcode-configuration: - - name: iOS Simulator - destination: "platform=iOS Simulator,name=iPhone 16" + - destination: "platform=iOS Simulator,name=iPhone 16" sdk: "iphonesimulator" - - name: macOS - destination: "platform=macOS" + - destination: "platform=macOS" sdk: "macosx" swift-configuration: - "debug" @@ -59,7 +57,7 @@ jobs: - name: Upload Test Results uses: actions/upload-artifact@v4 with: - name: Test Results (${{ matrix.xcode-configuration.name }}) + name: Test Results (${{ matrix }}) path: .build/Xcode.noindex/DerivedData/Logs/Test - name: Check that repository is clean From 7d79da9c54490b194756644ca6d820d3b35cc71d Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:28:14 -0800 Subject: [PATCH 11/15] Disambiguate more --- .github/workflows/Build and Test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index 5a96a56..260d81c 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -36,7 +36,7 @@ jobs: - name: Build run: | - xcrun xcodebuild clean build build-for-testing \ + xcrun xcodebuild clean build \ -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ -scheme SwiftProjectTemplateApp \ -derivedDataPath ".build/Xcode.noindex/DerivedData" \ @@ -46,9 +46,9 @@ jobs: - name: Test run: | - xcrun xcodebuild test-without-building \ + xcrun xcodebuild test \ -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ - -scheme SwiftProjectTemplateApp \ + -scheme SwiftProjectTemplateAppUITests \ -derivedDataPath ".build/Xcode.noindex/DerivedData" \ -configuration "${{ matrix.swift-configuration }}" \ -sdk "${{ matrix.xcode-configuration.sdk }}" \ From 79351e8ac4461b4c4080ef739b74700ee6627f4f Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:30:51 -0800 Subject: [PATCH 12/15] More disambiguity --- .github/workflows/Build and Test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index 260d81c..bc42063 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -17,9 +17,11 @@ jobs: xcode-version: - "16" xcode-configuration: - - destination: "platform=iOS Simulator,name=iPhone 16" + - name: iOS Simulator + destination: "platform=iOS Simulator,name=iPhone 16" sdk: "iphonesimulator" - - destination: "platform=macOS" + - name: macOS + destination: "platform=macOS" sdk: "macosx" swift-configuration: - "debug" @@ -57,7 +59,7 @@ jobs: - name: Upload Test Results uses: actions/upload-artifact@v4 with: - name: Test Results (${{ matrix }}) + name: Test Results (${{ matrix.xcode-configuration.name }}, ${{ matrix.swift-configuration }}) path: .build/Xcode.noindex/DerivedData/Logs/Test - name: Check that repository is clean From 82e3874778600ce0f406a13da68d041ddb915beb Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:40:21 -0800 Subject: [PATCH 13/15] Validate formatting --- .github/workflows/Build and Test.yml | 11 +++--- .github/workflows/Validate Formatting.yml | 41 +++++++++++++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/Validate Formatting.yml diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test.yml index bc42063..9eaa277 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test.yml @@ -9,9 +9,7 @@ on: - main jobs: - build-and-test: - name: Build and Test for Apple Platforms - + build-and-test-xcode: strategy: matrix: xcode-version: @@ -28,6 +26,8 @@ jobs: - "release" runs-on: macos-15 + + name: Build and Test (${{ matrix.xcode-configuration.name}}, ${{ matrix.swift-configuration }}) steps: - name: Checkout @@ -66,14 +66,15 @@ jobs: run: git diff --exit-code - build-and-test-in-devcontainer: - name: Build and Test in Devcontainer + build-and-test-devcontainer: strategy: matrix: devcontainer-name: ["default"] swift-configuration: ["debug", "release"] + name: Build and Test (devcontainer/${{ matrix.devcontainer-name }}, ${{ matrix.swift-configuration }}) + runs-on: ubuntu-latest steps: diff --git a/.github/workflows/Validate Formatting.yml b/.github/workflows/Validate Formatting.yml new file mode 100644 index 0000000..0cc7c51 --- /dev/null +++ b/.github/workflows/Validate Formatting.yml @@ -0,0 +1,41 @@ +# Build and Test + +name: Validate Formatting +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + validate-formatting: + name: Validate Formatting + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Make devcontainer 'default' singular + run: .devcontainer/devcontainer-helper --make-singular default + + - name: Initialize devcontainer + uses: devcontainers/ci@v0.3 + with: + push: never + runCmd: | + echo "Devcontainer Initialized." + + - name: Build + uses: devcontainers/ci@v0.3 + with: + push: never + runCmd: | + swift format --recursive --in-place --parallel . + + - name: Check that repository is clean + run: + .devcontainer/devcontainer-helper --clean + git diff --exit-code \ No newline at end of file From ed7ab686bc7e81cdeb92cd5f1b1a214fd1e20d0e Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:45:28 -0800 Subject: [PATCH 14/15] Split up xcode and SwiftPM --- ... Test.yml => Build and Test (SwiftPM).yml} | 42 +++--------- .github/workflows/Build and Test (Xcode).yml | 67 +++++++++++++++++++ 2 files changed, 78 insertions(+), 31 deletions(-) rename .github/workflows/{Build and Test.yml => Build and Test (SwiftPM).yml} (59%) create mode 100644 .github/workflows/Build and Test (Xcode).yml diff --git a/.github/workflows/Build and Test.yml b/.github/workflows/Build and Test (SwiftPM).yml similarity index 59% rename from .github/workflows/Build and Test.yml rename to .github/workflows/Build and Test (SwiftPM).yml index 9eaa277..1c8ea72 100644 --- a/.github/workflows/Build and Test.yml +++ b/.github/workflows/Build and Test (SwiftPM).yml @@ -1,6 +1,6 @@ # Build and Test -name: Build and Test +name: Build and Test (SwiftPM) on: workflow_dispatch: pull_request: @@ -9,25 +9,18 @@ on: - main jobs: - build-and-test-xcode: + build-and-test-macOS: strategy: matrix: xcode-version: - "16" - xcode-configuration: - - name: iOS Simulator - destination: "platform=iOS Simulator,name=iPhone 16" - sdk: "iphonesimulator" - - name: macOS - destination: "platform=macOS" - sdk: "macosx" swift-configuration: - "debug" - "release" runs-on: macos-15 - name: Build and Test (${{ matrix.xcode-configuration.name}}, ${{ matrix.swift-configuration }}) + name: Build and Test (macOS, ${{ matrix.swift-configuration }}) steps: - name: Checkout @@ -35,32 +28,19 @@ jobs: - name: Select Xcode run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer - + - name: Build run: | - xcrun xcodebuild clean build \ - -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ - -scheme SwiftProjectTemplateApp \ - -derivedDataPath ".build/Xcode.noindex/DerivedData" \ - -configuration "${{ matrix.swift-configuration }}" \ - -sdk "${{ matrix.xcode-configuration.sdk }}" \ - -destination "${{ matrix.xcode-configuration.destination }}" + swift build --configuration ${{ matrix.swift-configuration }} - - name: Test + - name: Build Tests + if: matrix.swift-configuration == 'debug' run: | - xcrun xcodebuild test \ - -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ - -scheme SwiftProjectTemplateAppUITests \ - -derivedDataPath ".build/Xcode.noindex/DerivedData" \ - -configuration "${{ matrix.swift-configuration }}" \ - -sdk "${{ matrix.xcode-configuration.sdk }}" \ - -destination "${{ matrix.xcode-configuration.destination }}" + swift build --build-tests --configuration ${{ matrix.swift-configuration }} - - name: Upload Test Results - uses: actions/upload-artifact@v4 - with: - name: Test Results (${{ matrix.xcode-configuration.name }}, ${{ matrix.swift-configuration }}) - path: .build/Xcode.noindex/DerivedData/Logs/Test + - name: Test + run: | + swift test --skip-build - name: Check that repository is clean run: diff --git a/.github/workflows/Build and Test (Xcode).yml b/.github/workflows/Build and Test (Xcode).yml new file mode 100644 index 0000000..07a1f5b --- /dev/null +++ b/.github/workflows/Build and Test (Xcode).yml @@ -0,0 +1,67 @@ +# Build and Test + +name: Build and Test (Xcode) +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +jobs: + build-and-test-xcode: + strategy: + matrix: + xcode-version: + - "16" + xcode-configuration: + - name: iOS Simulator + destination: "platform=iOS Simulator,name=iPhone 16" + sdk: "iphonesimulator" + - name: macOS + destination: "platform=macOS" + sdk: "macosx" + swift-configuration: + - "debug" + - "release" + + runs-on: macos-15 + + name: Build and Test (${{ matrix.xcode-configuration.name }}, ${{ matrix.swift-configuration }}) + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Select Xcode + run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode-version }}.app/Contents/Developer + + - name: Build + run: | + xcrun xcodebuild clean build \ + -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ + -scheme SwiftProjectTemplateApp \ + -derivedDataPath ".build/Xcode.noindex/DerivedData" \ + -configuration "${{ matrix.swift-configuration }}" \ + -sdk "${{ matrix.xcode-configuration.sdk }}" \ + -destination "${{ matrix.xcode-configuration.destination }}" + + - name: Test + run: | + xcrun xcodebuild test \ + -workspace Xcode/SwiftProjectTemplateApp.xcworkspace \ + -scheme SwiftProjectTemplateAppUITests \ + -derivedDataPath ".build/Xcode.noindex/DerivedData" \ + -configuration "${{ matrix.swift-configuration }}" \ + -sdk "${{ matrix.xcode-configuration.sdk }}" \ + -destination "${{ matrix.xcode-configuration.destination }}" + + - name: Upload Test Results + uses: actions/upload-artifact@v4 + with: + name: Test Results (${{ matrix.xcode-configuration.name }}, ${{ matrix.swift-configuration }}) + path: .build/Xcode.noindex/DerivedData/Logs/Test + + - name: Check that repository is clean + run: + git diff --exit-code From b9082fea2527cc9a0de04dfd6d0580ee0ec7ce37 Mon Sep 17 00:00:00 2001 From: George Date: Sat, 9 Nov 2024 18:46:47 -0800 Subject: [PATCH 15/15] Re-add condition --- .github/workflows/Build and Test (SwiftPM).yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/Build and Test (SwiftPM).yml b/.github/workflows/Build and Test (SwiftPM).yml index 1c8ea72..04ee802 100644 --- a/.github/workflows/Build and Test (SwiftPM).yml +++ b/.github/workflows/Build and Test (SwiftPM).yml @@ -39,6 +39,7 @@ jobs: swift build --build-tests --configuration ${{ matrix.swift-configuration }} - name: Test + if: matrix.swift-configuration == 'debug' run: | swift test --skip-build