Skip to content

Commit

Permalink
MOB-838 Updating Primary build for Code Coverage (#98)
Browse files Browse the repository at this point in the history
* MOB-838 Updating Primary build for Code Coverage

	- Removed Sonar Action is Build workflow as it was only avaiable on linux
	- Updated Primary workflow to generate code coverage and update report to Sonarcloud
	- Added Fastlane to do the sonar scanning.

* Update primary.yml

Fixed Syntax error in yml file

* Updates to code coverage generation

* Updates to code coverage generation

* Updates to code coverage generation

* Updates to code coverage generation
  • Loading branch information
Peter-John-paystack authored Oct 23, 2023
1 parent 32bc9f9 commit 9bf8e69
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -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)
34 changes: 34 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9bf8e69

Please sign in to comment.