Skip to content

Commit

Permalink
ci: Fix Slather for Codecov (#2494)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphofmann authored Dec 6, 2022
1 parent 4180ade commit a064b3e
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 12 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ jobs:
sudo ln -s /Applications/Xcode_12.5.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS\ 14.5.simruntime
xcrun simctl create custom-test-device "iPhone 8" "com.apple.CoreSimulator.SimRuntime.iOS-14-5"
- name: Install Slather
run: gem install slather

- name: Running tests
# We call a script with the platform so the destination
# passed to xcodebuild doesn't end up in the job name,
Expand All @@ -206,13 +209,6 @@ jobs:
path: |
raw-test-output.log
# Some tests run only on iOS so we only collect code coverage there.
- name: Run Slather
if: success() && ${{ contains(matrix.platform, 'iOS') }}
run: |
gem install slather
slather coverage -x --output-directory slather/ --scheme Sentry --workspace Sentry.xcworkspace Sentry.xcodeproj
# We can upload all coverage reports, because codecov merges them.
# See https://docs.codecov.io/docs/merging-reports
# Checkout .codecov.yml to see the config of Codecov
Expand Down
8 changes: 8 additions & 0 deletions .slather.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# .slather.yml

coverage_service: cobertura_xml
xcodeproj: Sentry.xcodeproj
workspace: Sentry.xcworkspace
scheme: Sentry
source_directory: Sources
output_directory: slather
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ gem "cocoapods", ">= 1.9.1"
gem "fastlane"
gem "rest-client"
gem "xcpretty"
gem "slather"

eval_gemfile("fastlane/Pluginfile")
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
clamp (1.3.2)
cocoapods (1.11.3)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
Expand Down Expand Up @@ -215,6 +216,7 @@ GEM
mime-types-data (3.2022.0105)
mini_magick (4.11.0)
mini_mime (1.1.2)
mini_portile2 (2.8.0)
minitest (5.16.3)
molinillo (0.8.0)
multi_json (1.15.0)
Expand All @@ -223,10 +225,14 @@ GEM
nap (1.1.0)
naturally (2.2.1)
netrc (0.11.0)
nokogiri (1.13.9)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
optparse (0.1.1)
os (1.1.4)
plist (3.6.0)
public_suffix (4.0.7)
racc (1.6.1)
rake (13.0.6)
representable (3.2.0)
declarative (< 0.1.0)
Expand All @@ -252,6 +258,12 @@ GEM
simctl (1.6.8)
CFPropertyList
naturally
slather (2.7.3)
CFPropertyList (>= 2.2, < 4)
activesupport
clamp (~> 1.3)
nokogiri (>= 1.13.9)
xcodeproj (~> 1.21)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
Expand Down Expand Up @@ -293,6 +305,7 @@ DEPENDENCIES
fastlane
fastlane-plugin-sentry
rest-client
slather
xcpretty

BUNDLED WITH
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ format-clang:
format-swift:
swiftlint --fix


## Current git reference name
GIT-REF := $(shell git rev-parse --abbrev-ref HEAD)

test:
@echo "--> Running all tests"
xcodebuild -workspace Sentry.xcworkspace -scheme Sentry -configuration Test GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES -enableCodeCoverage YES -destination "platform=macOS" test | rbenv exec bundle exec xcpretty -t
./scripts/xcode-test.sh iOS latest $(GIT-REF) YES
.PHONY: test

run-test-server:
Expand Down
8 changes: 4 additions & 4 deletions scripts/xcode-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ if [ $PLATFORM == "iOS" -a $OS == "12.4" ]; then
# Skip some tests that fail on iOS 12.4.
env NSUnbufferedIO=YES xcodebuild -workspace Sentry.xcworkspace \
-scheme Sentry -configuration $CONFIGURATION \
GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES -enableCodeCoverage YES -destination "$DESTINATION" \
-destination "$DESTINATION" \
-skip-testing:"SentryTests/SentrySDKTests/testMemoryFootprintOfAddingBreadcrumbs" \
-skip-testing:"SentryTests/SentrySDKTests/testMemoryFootprintOfTransactions" \
test | tee raw-test-output.log | $RUBY_ENV_ARGS xcpretty -t && exit ${PIPESTATUS[0]}
test | tee raw-test-output.log | $RUBY_ENV_ARGS xcpretty -t && slather coverage --configuration $CONFIGURATION && exit ${PIPESTATUS[0]}
else
env NSUnbufferedIO=YES xcodebuild -workspace Sentry.xcworkspace \
-scheme Sentry -configuration $CONFIGURATION \
GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES -enableCodeCoverage YES -destination "$DESTINATION" \
test | tee raw-test-output.log | $RUBY_ENV_ARGS xcpretty -t && exit ${PIPESTATUS[0]}
-destination "$DESTINATION" \
test | tee raw-test-output.log | $RUBY_ENV_ARGS xcpretty -t && slather coverage --configuration $CONFIGURATION && exit ${PIPESTATUS[0]}
fi

0 comments on commit a064b3e

Please sign in to comment.