Skip to content
Merged

CI #183

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Code Coverage

# Only run on pushes to main branch
on:
push:
branches: [ main ]

# Cancel any in-progress workflow runs for the same branch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
DEVELOPER_DIR: /Applications/Xcode.app/Contents/Developer

jobs:
# Test Coverage
test-coverage:
name: Test Coverage
runs-on: macos-latest
strategy:
matrix:
platform:
- { name: "iOS", scheme: "iOS Example", destination: "platform=iOS Simulator,name=iPhone 15,OS=latest" }
- { name: "macOS", scheme: "macOS Example", destination: "platform=macOS" }
- { name: "tvOS", scheme: "tvOS Example", destination: "platform=tvOS Simulator,name=Apple TV,OS=latest" }

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest

- name: Run Tests with Coverage
run: |
xcodebuild test \
-workspace EFQRCode.xcworkspace \
-scheme "${{ matrix.platform.scheme }}" \
-destination "${{ matrix.platform.destination }}" \
-enableCodeCoverage YES \
-derivedDataPath ./DerivedData-${{ matrix.platform.name }} \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO

- name: Generate Coverage Report
run: |
xcrun xccov view --report --json ./DerivedData-${{ matrix.platform.name }}/Logs/Test/*.xcresult > coverage-${{ matrix.platform.name }}.json

- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage-${{ matrix.platform.name }}.json
flags: unittests,${{ matrix.platform.name }}
name: codecov-${{ matrix.platform.name }}
fail_ci_if_error: true

# Status Check
status-check:
name: Coverage Status Check
runs-on: macos-latest
needs: [test-coverage]
if: always()

steps:
- name: Check Results
run: |
if [[ "${{ needs.test-coverage.result }}" != "success" ]]; then
echo "❌ Code coverage collection failed"
exit 1
fi

echo "✅ Code coverage successfully uploaded to Codecov!"
6 changes: 6 additions & 0 deletions EFQRCode.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 13;
};
name = Debug;
};
Expand All @@ -1019,6 +1020,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 13;
};
name = Release;
};
Expand Down Expand Up @@ -1348,6 +1350,7 @@
"$(inherited)",
);
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1367,6 +1370,7 @@
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -1401,6 +1405,7 @@
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "org.eyrefree.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -1429,6 +1434,7 @@
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
PRODUCT_BUNDLE_IDENTIFIER = "org.eyrefree.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
8 changes: 4 additions & 4 deletions Tests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Tests: XCTestCase {
// This is an example of EFQRCodeGenerator test case.
let content = "https://github.com/EFPrefix/EFQRCode"
let generator = try? EFQRCode.Generator(content, style: .basic(params: .init()))
let testResult = try? generator?.toImage(width: 256).cgImage
let testResult = try? generator?.toImage(width: 256).cgImage()
XCTAssertNotNil(testResult, "testResult is nil!")

// This is an example of EFQRCodeRecognizer test case.
Expand All @@ -65,7 +65,7 @@ class Tests: XCTestCase {
// This is an example of EFQRCodeGenerator test case.
let content = ""
let generator = try? EFQRCode.Generator(content, style: .bubble(params: .init()))
let testResult = try? generator?.toImage(width: 180).cgImage
let testResult = try? generator?.toImage(width: 180).cgImage()
XCTAssertNotNil(testResult, "testResult is nil!")

// This is an example of EFQRCodeRecognizer test case.
Expand All @@ -78,7 +78,7 @@ class Tests: XCTestCase {
// This is an example of EFQRCodeGenerator test case.
let content = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989"
let generator = try? EFQRCode.Generator(content, style: .bubble(params: .init()))
let testResult = try? generator?.toImage(width: 180).cgImage
let testResult = try? generator?.toImage(width: 1200).cgImage()
XCTAssertNotNil(testResult, "testResult is nil!")

// This is an example of EFQRCodeRecognizer test case.
Expand All @@ -96,7 +96,7 @@ class Tests: XCTestCase {
image: .init(image: .static(image: getImage()), allowTransparent: true))
)
)
let testResult = try? generator?.toImage(width: 180).cgImage
let testResult = try? generator?.toImage(width: 180).cgImage()
XCTAssertNotNil(testResult, "testResult is nil!")
}

Expand Down
Loading