Skip to content

Commit

Permalink
Fixed CI
Browse files Browse the repository at this point in the history
  • Loading branch information
bradhowes committed Jan 1, 2024
1 parent bd7d35e commit b1a998b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 33 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Build, test, and code coverage
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v3
- name: Build and test
run: make
- name: Get Test Coverage
run: |
set -- $(< percentage.txt)
echo "PERCENTAGE=${1}" >> ${GITHUB_ENV}
- name: Create Coverage Badge
uses: schneegans/dynamic-badges-action@v1.1.0
with:
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ fastlane/test_output
# Ignore the *big* Fluid soundfont file
FluidR3_GM.sf2

WD
WD.xcresult
cov.txt
.DerivedData-*
percentage.txt
coverage.txt
47 changes: 19 additions & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
PLATFORM_IOS = iOS Simulator,name=iPhone SE (2nd generation)
PLATFORM_IOS = iOS Simulator,name=iPhone SE (3rd generation)

DEST = -scheme MotionCollector -destination platform="$(PLATFORM_IOS)"
default: percentage

default: coverage

build: clean
xcodebuild build $(DEST)

test: build
xcodebuild test $(DEST) -enableCodeCoverage YES ENABLE_TESTING_SEARCH_PATHS=YES -resultBundlePath $PWD
test-ios:
xcodebuild clean \
-scheme MotionCollector \
-derivedDataPath ".DerivedData-ios" \
-destination platform="$(PLATFORM_IOS)"
xcodebuild test \
-scheme MotionCollector \
-derivedDataPath ".DerivedData-ios" \
-destination platform="$(PLATFORM_IOS)" \
-enableCodeCoverage YES

# Extract coverage info for SoundFonts -- expects defintion of env variable GITHUB_ENV
COV = xcrun xccov view --report --only-targets

cov.txt: test
xcrun xccov view --report --only-targets WD.xcresult > cov.txt
@cat cov.txt
coverage: test-ios
$(COV) .DerivedData-ios/Logs/Test/*.xcresult > coverage.txt
@cat coverage.txt

PATTERN = MotionCollector.app

percentage.txt: cov.txt
awk '/$(PATTERN)/ {s+=$$4;++c} END {print s/c;}' < cov.txt > percentage.txt
percentage: coverage
awk '/$(PATTERN)/ {s+=$$4;++c} END {print s/c;}' < coverage.txt > percentage.txt
@cat percentage.txt

coverage: percentage.txt
@if [[ -n "$$GITHUB_ENV" ]]; then \
echo "PERCENTAGE=$$(< percentage.txt)" >> $$GITHUB_ENV; \
fi

clean:
@echo "-- removing cov.txt percentage.txt"
@-rm -rf cov.txt percentage.txt WD WD.xcresult
xcodebuild clean \
-scheme MotionCollector \
-destination platform="$(PLATFORM_IOS)"

.PHONY: build test coverage clean
.PHONY: build test coverage percentage clean

0 comments on commit b1a998b

Please sign in to comment.