From 5ec025d8d0ca94d2510bcdc2e1d707a40ea6690a Mon Sep 17 00:00:00 2001 From: Nindi Gill <nindi@ninxsoft.com> Date: Thu, 8 Dec 2022 14:30:00 +1100 Subject: [PATCH] Update GitHub workflows --- .github/workflows/build_app.yml | 36 ++++++ ...ll_of_the_things.yml => lint_codebase.yml} | 13 +-- .github/workflows/run_unit_tests.yml | 10 ++ Mist.xcodeproj/project.pbxproj | 107 +++++++++++++++++- .../xcschemes/MistHelperTool.xcscheme | 3 +- .../xcshareddata/xcschemes/MistTests.xcscheme | 78 +++++++++++++ MistTests/MistTests.swift | 15 +++ 7 files changed, 250 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/build_app.yml rename .github/workflows/{do_all_of_the_things.yml => lint_codebase.yml} (63%) create mode 100644 .github/workflows/run_unit_tests.yml create mode 100644 Mist.xcodeproj/xcshareddata/xcschemes/MistTests.xcscheme create mode 100644 MistTests/MistTests.swift diff --git a/.github/workflows/build_app.yml b/.github/workflows/build_app.yml new file mode 100644 index 0000000..f258963 --- /dev/null +++ b/.github/workflows/build_app.yml @@ -0,0 +1,36 @@ +name: Build Mist +on: [push, pull_request] +jobs: + build-app: + name: Build Mist + runs-on: macos-12 + steps: + - uses: actions/checkout@v3 + - uses: swift-actions/setup-swift@v1 + - name: Install Apple Developer Application Certificate + env: + APPLE_DEVELOPER_CERTIFICATE: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE }} + APPLE_DEVELOPER_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_PASSWORD }} + APPLE_DEVELOPER_CERTIFICATE_AUTHORITY: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_AUTHORITY }} + APPLE_DEVELOPER_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_DEVELOPER_KEYCHAIN_PASSWORD }} + run: | + CERTIFICATE_PATH="$RUNNER_TEMP/apple-developer-application-certificate.p12" + CERTIFICATE_AUTHORITY_PATH="$RUNNER_TEMP/apple-developer-certificate-authority.cer" + KEYCHAIN_PATH="$RUNNER_TEMP/apple-developer.keychain-db" + echo -n "$APPLE_DEVELOPER_CERTIFICATE" | base64 --decode --output "$CERTIFICATE_PATH" + echo -n "$APPLE_DEVELOPER_CERTIFICATE_AUTHORITY" | base64 --decode --output "$CERTIFICATE_AUTHORITY_PATH" + security create-keychain -p "$APPLE_DEVELOPER_KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" + security unlock-keychain -p "$APPLE_DEVELOPER_KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH" + security import "$CERTIFICATE_PATH" -P "$APPLE_DEVELOPER_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" + security import "$CERTIFICATE_AUTHORITY_PATH" -P "$APPLE_DEVELOPER_CERTIFICATE_PASSWORD" -A -t cert -f pkcs7 -k "$KEYCHAIN_PATH" + security list-keychain -d user -s "$KEYCHAIN_PATH" + - name: Archive Mist + run: xcodebuild -scheme Mist clean archive -configuration release -archivePath Mist -quiet + - name: Export Mist + run: xcodebuild -exportArchive -archivePath Mist.xcarchive -exportPath Export -exportOptionsPlist ExportOptions.plist + - name: Print Mist version + run: defaults read Export/Mist.app CFBundleShortVersionString + - name: Remove Apple Developer Keychain + if: ${{ always() }} + run: security delete-keychain $RUNNER_TEMP/apple-developer.keychain-db diff --git a/.github/workflows/do_all_of_the_things.yml b/.github/workflows/lint_codebase.yml similarity index 63% rename from .github/workflows/do_all_of_the_things.yml rename to .github/workflows/lint_codebase.yml index 651ebf4..d92f7f4 100644 --- a/.github/workflows/do_all_of_the_things.yml +++ b/.github/workflows/lint_codebase.yml @@ -1,12 +1,11 @@ -name: Do all of the things! +name: Lint Codebase on: [push, pull_request] jobs: - do-all-of-the-things: - name: Do all of the things! + lint-codebase: + name: Lint Codebase runs-on: macos-12 steps: - uses: actions/checkout@v3 - - uses: swift-actions/setup-swift@v1 - name: Print SwiftLint version run: swiftlint --version - name: Run SwiftLint @@ -23,9 +22,3 @@ jobs: run: drstring --version - name: Run DrString run: drstring check --config-file .drstring.toml - - name: Archive Mist - run: xcodebuild -scheme Mist clean archive -configuration release -archivePath Mist - - name: Export Mist - run: xcodebuild -exportArchive -archivePath Mist.xcarchive -exportPath Export -exportOptionsPlist ExportOptions.plist - - name: Print Mist version - run: defaults read Export/Mist.app CFBundleShortVersionString diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml new file mode 100644 index 0000000..d4dd265 --- /dev/null +++ b/.github/workflows/run_unit_tests.yml @@ -0,0 +1,10 @@ +name: Run Unit Tests +on: [push, pull_request] +jobs: + run_unit_tests: + name: Run Unit Tests + runs-on: macos-12 + steps: + - uses: actions/checkout@v3 + - name: Run Unit Tests + run: xcodebuild -scheme MistTests clean test -quiet diff --git a/Mist.xcodeproj/project.pbxproj b/Mist.xcodeproj/project.pbxproj index 0f42490..342ee08 100644 --- a/Mist.xcodeproj/project.pbxproj +++ b/Mist.xcodeproj/project.pbxproj @@ -96,6 +96,7 @@ 398734D4286046B000B4C357 /* UInt32+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 398734D3286046B000B4C357 /* UInt32+Extension.swift */; }; 39CB5E3D293F5C2E00CFDBB8 /* Catalog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CB5E3C293F5C2E00CFDBB8 /* Catalog.swift */; }; 39CB5E3F2941486D00CFDBB8 /* CatalogSeedType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CB5E3E2941486D00CFDBB8 /* CatalogSeedType.swift */; }; + 39CB5E5429418A2900CFDBB8 /* MistTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CB5E5329418A2900CFDBB8 /* MistTests.swift */; }; 39CF55A028614DD8006FB5D2 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 39CF559F28614DD8006FB5D2 /* main.swift */; }; 39CF55AA286154A5006FB5D2 /* Blessed in Frameworks */ = {isa = PBXBuildFile; productRef = 39CF55A9286154A5006FB5D2 /* Blessed */; }; 39CF55AB286154D1006FB5D2 /* com.ninxsoft.mist.helper in CopyFiles */ = {isa = PBXBuildFile; fileRef = 39CF559D28614DD8006FB5D2 /* com.ninxsoft.mist.helper */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; @@ -240,6 +241,8 @@ 398734D3286046B000B4C357 /* UInt32+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UInt32+Extension.swift"; sourceTree = "<group>"; }; 39CB5E3C293F5C2E00CFDBB8 /* Catalog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Catalog.swift; sourceTree = "<group>"; }; 39CB5E3E2941486D00CFDBB8 /* CatalogSeedType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CatalogSeedType.swift; sourceTree = "<group>"; }; + 39CB5E5129418A2900CFDBB8 /* MistTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MistTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 39CB5E5329418A2900CFDBB8 /* MistTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MistTests.swift; sourceTree = "<group>"; }; 39CF559D28614DD8006FB5D2 /* com.ninxsoft.mist.helper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = com.ninxsoft.mist.helper; sourceTree = BUILT_PRODUCTS_DIR; }; 39CF559F28614DD8006FB5D2 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; }; 39CF55A528614E66006FB5D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; @@ -283,6 +286,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 39CB5E4E29418A2900CFDBB8 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; 39CF559A28614DD8006FB5D2 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -301,6 +311,7 @@ 390451A82856E1D900E0B563 /* Mist */, 39CF559E28614DD8006FB5D2 /* MistHelperTool */, 39CF55D4286162DC006FB5D2 /* Shared */, + 39CB5E5229418A2900CFDBB8 /* MistTests */, 390451A72856E1D900E0B563 /* Products */, ); sourceTree = "<group>"; @@ -310,6 +321,7 @@ children = ( 390451A62856E1D900E0B563 /* Mist.app */, 39CF559D28614DD8006FB5D2 /* com.ninxsoft.mist.helper */, + 39CB5E5129418A2900CFDBB8 /* MistTests.xctest */, ); name = Products; sourceTree = "<group>"; @@ -455,6 +467,14 @@ path = Refresh; sourceTree = "<group>"; }; + 39CB5E5229418A2900CFDBB8 /* MistTests */ = { + isa = PBXGroup; + children = ( + 39CB5E5329418A2900CFDBB8 /* MistTests.swift */, + ); + path = MistTests; + sourceTree = "<group>"; + }; 39CF559E28614DD8006FB5D2 /* MistHelperTool */ = { isa = PBXGroup; children = ( @@ -548,6 +568,23 @@ productReference = 390451A62856E1D900E0B563 /* Mist.app */; productType = "com.apple.product-type.application"; }; + 39CB5E5029418A2900CFDBB8 /* MistTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 39CB5E5529418A2900CFDBB8 /* Build configuration list for PBXNativeTarget "MistTests" */; + buildPhases = ( + 39CB5E4D29418A2900CFDBB8 /* Sources */, + 39CB5E4E29418A2900CFDBB8 /* Frameworks */, + 39CB5E4F29418A2900CFDBB8 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MistTests; + productName = MistTests; + productReference = 39CB5E5129418A2900CFDBB8 /* MistTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; 39CF559C28614DD8006FB5D2 /* MistHelperTool */ = { isa = PBXNativeTarget; buildConfigurationList = 39CF55A128614DD8006FB5D2 /* Build configuration list for PBXNativeTarget "MistHelperTool" */; @@ -577,12 +614,15 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1400; + LastSwiftUpdateCheck = 1410; LastUpgradeCheck = 1410; TargetAttributes = { 390451A52856E1D900E0B563 = { CreatedOnToolsVersion = 14.0; }; + 39CB5E5029418A2900CFDBB8 = { + CreatedOnToolsVersion = 14.1; + }; 39CF559C28614DD8006FB5D2 = { CreatedOnToolsVersion = 14.0; }; @@ -609,6 +649,7 @@ targets = ( 390451A52856E1D900E0B563 /* Mist */, 39CF559C28614DD8006FB5D2 /* MistHelperTool */, + 39CB5E5029418A2900CFDBB8 /* MistTests */, ); }; /* End PBXProject section */ @@ -622,6 +663,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 39CB5E4F29418A2900CFDBB8 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -799,6 +847,14 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 39CB5E4D29418A2900CFDBB8 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 39CB5E5429418A2900CFDBB8 /* MistTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; 39CF559928614DD8006FB5D2 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1000,6 +1056,46 @@ }; name = Release; }; + 39CB5E5629418A2900CFDBB8 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application"; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = 7K3HVCLV7Z; + GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 13.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.ninxsoft.mist.tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 39CB5E5729418A2900CFDBB8 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application"; + CODE_SIGN_STYLE = Manual; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=macosx*]" = 7K3HVCLV7Z; + GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 13.0; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.ninxsoft.mist.tests; + PRODUCT_NAME = "$(TARGET_NAME)"; + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; 39CF55A228614DD8006FB5D2 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1089,6 +1185,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 39CB5E5529418A2900CFDBB8 /* Build configuration list for PBXNativeTarget "MistTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 39CB5E5629418A2900CFDBB8 /* Debug */, + 39CB5E5729418A2900CFDBB8 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 39CF55A128614DD8006FB5D2 /* Build configuration list for PBXNativeTarget "MistHelperTool" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Mist.xcodeproj/xcshareddata/xcschemes/MistHelperTool.xcscheme b/Mist.xcodeproj/xcshareddata/xcschemes/MistHelperTool.xcscheme index 89fe2b4..6e14a6f 100644 --- a/Mist.xcodeproj/xcshareddata/xcschemes/MistHelperTool.xcscheme +++ b/Mist.xcodeproj/xcshareddata/xcschemes/MistHelperTool.xcscheme @@ -39,7 +39,8 @@ ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" debugServiceExtension = "internal" - allowLocationSimulation = "YES"> + allowLocationSimulation = "YES" + viewDebuggingEnabled = "No"> <BuildableProductRunnable runnableDebuggingMode = "0"> <BuildableReference diff --git a/Mist.xcodeproj/xcshareddata/xcschemes/MistTests.xcscheme b/Mist.xcodeproj/xcshareddata/xcschemes/MistTests.xcscheme new file mode 100644 index 0000000..f56565a --- /dev/null +++ b/Mist.xcodeproj/xcshareddata/xcschemes/MistTests.xcscheme @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Scheme + LastUpgradeVersion = "1410" + version = "1.3"> + <BuildAction + parallelizeBuildables = "YES" + buildImplicitDependencies = "YES"> + <BuildActionEntries> + <BuildActionEntry + buildForTesting = "YES" + buildForRunning = "YES" + buildForProfiling = "NO" + buildForArchiving = "NO" + buildForAnalyzing = "NO"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "39CB5E5029418A2900CFDBB8" + BuildableName = "MistTests.xctest" + BlueprintName = "MistTests" + ReferencedContainer = "container:Mist.xcodeproj"> + </BuildableReference> + </BuildActionEntry> + </BuildActionEntries> + </BuildAction> + <TestAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + shouldUseLaunchSchemeArgsEnv = "YES"> + <Testables> + <TestableReference + skipped = "NO" + parallelizable = "YES"> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "39CB5E5029418A2900CFDBB8" + BuildableName = "MistTests.xctest" + BlueprintName = "MistTests" + ReferencedContainer = "container:Mist.xcodeproj"> + </BuildableReference> + </TestableReference> + </Testables> + </TestAction> + <LaunchAction + buildConfiguration = "Debug" + selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" + selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + launchStyle = "0" + useCustomWorkingDirectory = "NO" + ignoresPersistentStateOnLaunch = "NO" + debugDocumentVersioning = "YES" + debugServiceExtension = "internal" + allowLocationSimulation = "YES"> + </LaunchAction> + <ProfileAction + buildConfiguration = "Release" + shouldUseLaunchSchemeArgsEnv = "YES" + savedToolIdentifier = "" + useCustomWorkingDirectory = "NO" + debugDocumentVersioning = "YES"> + <MacroExpansion> + <BuildableReference + BuildableIdentifier = "primary" + BlueprintIdentifier = "39CB5E5029418A2900CFDBB8" + BuildableName = "MistTests.xctest" + BlueprintName = "MistTests" + ReferencedContainer = "container:Mist.xcodeproj"> + </BuildableReference> + </MacroExpansion> + </ProfileAction> + <AnalyzeAction + buildConfiguration = "Debug"> + </AnalyzeAction> + <ArchiveAction + buildConfiguration = "Release" + revealArchiveInOrganizer = "YES"> + </ArchiveAction> +</Scheme> diff --git a/MistTests/MistTests.swift b/MistTests/MistTests.swift new file mode 100644 index 0000000..bfca38d --- /dev/null +++ b/MistTests/MistTests.swift @@ -0,0 +1,15 @@ +// +// MistTests.swift +// MistTests +// +// Created by Nindi Gill on 8/12/2022. +// + +import XCTest + +final class MistTests: XCTestCase { + + func test() throws { + XCTAssertTrue(true) + } +}