diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e3557fd..6fe5436 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,8 +19,6 @@ jobs: run: | swift test --enable-code-coverage -v xcrun llvm-cov export -format="lcov" .build/debug/PaystackSDKPackageTests.xctest/Contents/MacOS/PaystackSDKPackageTests -instr-profile .build/debug/codecov/default.profdata > info.lcov - - name: SonarCloud Scan - uses: SonarSource/sonarcloud-github-action@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/primary.yml b/.github/workflows/primary.yml index 9a5ba18..c2b25be 100644 --- a/.github/workflows/primary.yml +++ b/.github/workflows/primary.yml @@ -30,10 +30,22 @@ jobs: uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable + + - name: Setup environment + run: | + bundle install + - name: Build run: swift build -v - name: Run tests - run: swift test -v + run: | + swift test --enable-code-coverage -v + xcrun llvm-cov show -instr-profile=.build/debug/codecov/default.profdata .build/debug/PaystackSDKPackageTests.xctest/Contents/MacOS/PaystackSDKPackageTests > coverage.report + brew install sonar-scanner + bundle exec fastlane sonar_scan + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} PodLinting: runs-on: macos-12 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..cdd3a6b --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "fastlane" + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..d2ccafb --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,34 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:ios) + +platform :ios do + + desc "Run Sonar Scan" + lane :sonar_scan do + + sonar( + project_key: "PaystackHQ_paystack-sdk-ios", + project_version: "1.0", + project_name: "paystack-sdk-ios", + sources_path: File.expand_path("../Sources/"), + sonar_organization: "paystackhq", + sonar_login: ENV["SONAR_TOKEN"], + sonar_url: "https://sonarcloud.io" + ) + end + +end diff --git a/sonar-project.properties b/sonar-project.properties index a1c36a2..b9b5b01 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,3 +1,3 @@ sonar.projectKey=PaystackHQ_paystack-sdk-ios sonar.organization=paystackhq -sonar.javascript.lcov.reportPaths=./lcov.info +sonar.swift.coverage.reportPaths=coverage.report