From b1a998b9c8256269d62d4824a4795b5fcaa6f45b Mon Sep 17 00:00:00 2001 From: Brad Howes Date: Mon, 1 Jan 2024 21:32:35 +0100 Subject: [PATCH] Fixed CI --- .github/workflows/CI.yml | 11 ++++++++-- .gitignore | 5 ++--- Makefile | 47 ++++++++++++++++------------------------ 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f97bddc..843627c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: diff --git a/.gitignore b/.gitignore index f6d9d46..bfc6d9e 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile index 7fe4f71..774d7d4 100644 --- a/Makefile +++ b/Makefile @@ -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