diff --git a/.github/workflows/ringpublishingtracking_ci.yml b/.github/workflows/ringpublishingtracking_ci.yml new file mode 100644 index 0000000..71bba4f --- /dev/null +++ b/.github/workflows/ringpublishingtracking_ci.yml @@ -0,0 +1,94 @@ +# The name of the workflow +name: RingPublishingTracking - Continous Integration + +# When workflow should start +on: + workflow_dispatch: + branches: + - master + push: + branches: + - master + - 'feature/**' + - 'bugfix/**' + +# If workflow is already running - cancel it +concurrency: + cancel-in-progress: true + group: RingPublishingTracking-CI-${{ github.ref }} + +# Global environment variables +env: + is_ci: true + ci_planRepository_branch: ${{ github.ref_name }} + CI_MATCH_KEYCHAIN_PASSWORD: ${{ secrets.NATIVE_MOBILE_CI_MATCH_KEYCHAIN_PASSWORD }} + CI_MATCH_KEYCHAIN_NAME: ${{ secrets.NATIVE_MOBILE_CI_MATCH_KEYCHAIN_NAME }} + DL_GITHUB_PERSONAL_TOKEN: ${{ secrets.DL_GITHUB_PERSONAL_TOKEN }} + +# Jobs to run +jobs: + + # Swiftlint job + swiftlint: + name: Swift Lint + runs-on: ["self-hosted", "macOS", "Xcode-16"] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run Swiftlint + run: | + fastlane init_env + fastlane strict_lint --env alpha + + # Build demo app + build_app: + name: Build iOS app + runs-on: ["self-hosted", "macOS", "Xcode-16"] + needs: + - swiftlint + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build iOS app + run: | + fastlane init_env + fastlane build_ipa skip_cocoapods:false build_number:${{ github.run_number }} --env alpha + + # Summary job + sdk_summary: + name: RingPublishingTracking build summary + runs-on: ["self-hosted", "macOS", "Xcode-16"] + needs: + - swiftlint + - build_app + if: always() + steps: + - name: Set exit code based on job statuses + run: | + # When none of the needed jobs fail or are cancelled (skipped or successful jobs are ok) + if ${{ !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} ; then + echo "RingPublishingTracking - build successful" + exit 0 + else + echo "RingPublishingTracking - build failed" + exit 1 + fi + + # Deployment + sdk_deployment: + name: 'RingPublishingTracking deployment' + runs-on: ["self-hosted", "macOS", "Xcode-16"] + needs: + - sdk_summary + if: github.ref_name == 'master' + environment: production + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Deploy .podspec to repository + run: | + fastlane init_env + fastlane publish_open_source_sdk --env alpha diff --git a/.gitignore b/.gitignore index 2ecdcbf..e8a10d0 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,5 @@ Example/Pods ## SPM .swiftpm -fastlane/* -!fastlane/.env tests-build/* test-reports/* diff --git a/Changelogs/1.8.5 b/Changelogs/1.8.5 new file mode 100644 index 0000000..07854bf --- /dev/null +++ b/Changelogs/1.8.5 @@ -0,0 +1,6 @@ +1.8.5 Release notes (2025-05-05) +================================ + +### Changes + +* Added support for CI/CD on GitHub platform diff --git a/Example/RingPublishingTracking.xcodeproj/project.pbxproj b/Example/RingPublishingTracking.xcodeproj/project.pbxproj index 5c6fb42..3b4c816 100644 --- a/Example/RingPublishingTracking.xcodeproj/project.pbxproj +++ b/Example/RingPublishingTracking.xcodeproj/project.pbxproj @@ -1423,18 +1423,14 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 97W46277W4; INFOPLIST_FILE = RingPublishingTracking/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.8.4; + MARKETING_VERSION = 1.8.5; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.RingPublishingTracking-Example.RingPublishingTracking"; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -1447,18 +1443,14 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 97W46277W4; INFOPLIST_FILE = RingPublishingTracking/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.8.4; + MARKETING_VERSION = 1.8.5; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.RingPublishingTracking-Example.RingPublishingTracking"; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/Example/RingPublishingTracking/Info.plist b/Example/RingPublishingTracking/Info.plist index 4e77d99..df3a944 100644 --- a/Example/RingPublishingTracking/Info.plist +++ b/Example/RingPublishingTracking/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString - 1.8.4 + 1.8.5 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/RingPublishingTracking.podspec b/RingPublishingTracking.podspec index feefdfa..72bc13d 100644 --- a/RingPublishingTracking.podspec +++ b/RingPublishingTracking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "RingPublishingTracking" - s.version = "1.8.4" + s.version = "1.8.5" s.summary = "SDK used to report events from mobile application" s.license = { :type => 'Copyright. Ringier Axel Springer Polska', :file => 'LICENSE' } diff --git a/Sources/RingPublishingTracking/Private/Decorator/Generic/StructureInfoDecorator.swift b/Sources/RingPublishingTracking/Private/Decorator/Generic/StructureInfoDecorator.swift index 4db3186..71adaf9 100644 --- a/Sources/RingPublishingTracking/Private/Decorator/Generic/StructureInfoDecorator.swift +++ b/Sources/RingPublishingTracking/Private/Decorator/Generic/StructureInfoDecorator.swift @@ -50,7 +50,8 @@ final class StructureInfoDecorator: Decorator { return [:] } - let resolved = structureType.parametersResolved(applicationRootPath: applicationRootPath, applicationAdvertisementSite: applicationAdvertisementSite) + let resolved = structureType.parametersResolved(applicationRootPath: applicationRootPath, + applicationAdvertisementSite: applicationAdvertisementSite) var params = [ "DV": resolved.dv, "DU": resolved.du + contentPageViewSource.utmMedium @@ -58,7 +59,9 @@ final class StructureInfoDecorator: Decorator { if let previousStructureType = previousInfo.structureType { let source = previousInfo.contentPageViewSource - params["DR"] = previousStructureType.parametersResolved(applicationRootPath: applicationRootPath, applicationAdvertisementSite: applicationAdvertisementSite).du + source.utmMedium + let resolvedDU = previousStructureType.parametersResolved(applicationRootPath: applicationRootPath, + applicationAdvertisementSite: applicationAdvertisementSite).du + params["DR"] = resolvedDU + source.utmMedium } return params @@ -76,7 +79,7 @@ extension StructureInfoDecorator { func updateApplicationRootPath(applicationRootPath: String) { self.applicationRootPath = applicationRootPath } - + func updateApplicationAdvertisementSite(applicationAdvertisementSite: String?) { self.applicationAdvertisementSite = applicationAdvertisementSite } diff --git a/Sources/RingPublishingTracking/Public/RingPublishingTracking+CurrentState.swift b/Sources/RingPublishingTracking/Public/RingPublishingTracking+CurrentState.swift index 5ebc728..0b4a045 100644 --- a/Sources/RingPublishingTracking/Public/RingPublishingTracking+CurrentState.swift +++ b/Sources/RingPublishingTracking/Public/RingPublishingTracking+CurrentState.swift @@ -47,7 +47,7 @@ public extension RingPublishingTracking { /// /// - Parameter currentAdvertisementArea: String func updateApplicationAdvertisementArea(currentAdvertisementArea: String?) { - Logger.log("Updating application advertisement area to: '\(currentAdvertisementArea)'") + Logger.log("Updating application advertisement area to: '\(String(describing: currentAdvertisementArea))'") eventsService?.updateApplicationAdvertisementArea(currentAdvertisementArea) } diff --git a/Tests/RingPublishingTrackingTests/EndpointTests.swift b/Tests/RingPublishingTrackingTests/EndpointTests.swift index b02987f..0511ff4 100644 --- a/Tests/RingPublishingTrackingTests/EndpointTests.swift +++ b/Tests/RingPublishingTrackingTests/EndpointTests.swift @@ -30,8 +30,6 @@ class EndpointTests: XCTestCase { XCTAssertNotNil(encoded) } - // swiftlint:disable non_optional_string_data_conversion - func testIdentifyRequestDecoding_sampleIdentifyResponseDataCreated_decodedResponseIsReturned() { // Given let data = """ @@ -62,8 +60,6 @@ class EndpointTests: XCTestCase { XCTAssertEqual(decoded?.postInterval, 30000, "postInterval of decoded response should match") } - // swiftlint:enable non_optional_string_data_conversion - func testEventRequestEncoding_sampleSendEventEnpointCreated_encodedBodyIsReturned() { // Given let eventRequest = EventRequest(ids: [ @@ -80,8 +76,6 @@ class EndpointTests: XCTestCase { XCTAssertNotNil(encoded) } - // swiftlint:disable non_optional_string_data_conversion - func testEventRequestDecoding_sampleSendEventResponseDataCreated_decodedResponseIsReturned() { // Given let data = """ @@ -97,6 +91,4 @@ class EndpointTests: XCTestCase { // Then XCTAssertEqual(decoded?.postInterval, 30000, "postInterval of decoded response should match") } - - // swiftlint:enable non_optional_string_data_conversion } diff --git a/fastlane/.env b/fastlane/.env index 9da43ee..f1eae33 100644 --- a/fastlane/.env +++ b/fastlane/.env @@ -10,4 +10,5 @@ DL_UNIT_TESTS_SCHEME = "RingPublishingTracking-Example" DL_PODSPEC_FILENAME = "RingPublishingTracking.podspec" -DL_GITHUB_REPO_NAME = "ringpublishing/RingPublishingTracking-iOS" \ No newline at end of file +DL_GITHUB_REPO_NAME = "ringpublishing/RingPublishingTracking-iOS" +DL_OUTPUT_SPEC_REPOSITORY="private" \ No newline at end of file diff --git a/fastlane/.env.alpha b/fastlane/.env.alpha new file mode 100644 index 0000000..a63b206 --- /dev/null +++ b/fastlane/.env.alpha @@ -0,0 +1,7 @@ +DL_BUILD_CONFIGURATION="Release" +DL_BUILD_EXPORT_METHOD="development" + +DL_SKIP_CODESIGNING=true +DL_SKIP_ARCHIVE=true +DL_DISABLE_AUTOMATIC_SIGNING_MANAGEMENT=true +DL_INSTALL_CERTIFICATES_AUTOMATICALLY=false diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..de4700f --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1 @@ +import_from_git(url: 'git@github.com:Ringier-Axel-Springer-PL/native-mobile-fastlane.git') \ No newline at end of file