Skip to content

Commit 3995591

Browse files
Add CI
1 parent cc9beab commit 3995591

5 files changed

Lines changed: 362 additions & 18 deletions

File tree

.github/pull_request_template.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## Description
2+
<!-- Provide a brief description of the changes in this PR -->
3+
4+
## Type of Change
5+
- [ ] Bug fix (non-breaking change which fixes an issue)
6+
- [ ] New feature (non-breaking change which adds functionality)
7+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8+
- [ ] Documentation update
9+
- [ ] Test improvement
10+
11+
## Testing
12+
- [ ] Unit tests pass locally
13+
- [ ] New tests have been added for new functionality
14+
- [ ] Existing tests have been updated if needed
15+
16+
## Checklist
17+
- [ ] I have performed a self-review of my own code
18+
- [ ] I have commented my code where necessary (following the no-comments rule)
19+
- [ ] My changes generate no new warnings
20+
- [ ] Any dependent changes have been merged and published
21+
22+
## Screenshots (if applicable)
23+
<!-- Add screenshots to help explain your changes -->
24+
25+
## Additional Notes
26+
<!-- Add any additional notes or context about the PR here -->

.github/workflows/ci.yml

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
env:
11+
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
12+
13+
jobs:
14+
lint:
15+
name: SwiftLint
16+
runs-on: macos-15
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Install SwiftLint
23+
run: brew install swiftlint
24+
25+
- name: Run SwiftLint
26+
run: |
27+
cd Recap
28+
swiftlint --strict --reporter github-actions-logging
29+
30+
build:
31+
name: Build
32+
runs-on: macos-15
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Xcode
39+
uses: maxim-lobanov/setup-xcode@v1
40+
with:
41+
xcode-version: '16.0'
42+
43+
- name: Cache Swift Package Manager
44+
uses: actions/cache@v4
45+
with:
46+
path: |
47+
~/Library/Developer/Xcode/DerivedData
48+
.build
49+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
50+
restore-keys: |
51+
${{ runner.os }}-spm-
52+
53+
- name: Resolve Dependencies
54+
run: |
55+
cd Recap
56+
swift package resolve
57+
58+
- name: Build Debug
59+
run: |
60+
cd Recap
61+
swift build -c debug
62+
63+
- name: Build Release
64+
run: |
65+
cd Recap
66+
swift build -c release
67+
68+
test:
69+
name: Test
70+
runs-on: macos-15
71+
needs: build
72+
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@v4
76+
77+
- name: Setup Xcode
78+
uses: maxim-lobanov/setup-xcode@v1
79+
with:
80+
xcode-version: '16.0'
81+
82+
- name: Cache Swift Package Manager
83+
uses: actions/cache@v4
84+
with:
85+
path: |
86+
~/Library/Developer/Xcode/DerivedData
87+
.build
88+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
89+
restore-keys: |
90+
${{ runner.os }}-spm-
91+
92+
- name: Run Tests with Coverage
93+
run: |
94+
cd Recap
95+
swift test --enable-code-coverage --parallel
96+
97+
- name: Generate Test Report
98+
run: |
99+
cd Recap
100+
swift test --parallel --xunit-output=test-results.xml || true
101+
102+
- name: Generate Coverage Report
103+
run: |
104+
cd Recap
105+
xcrun llvm-cov export \
106+
.build/debug/RecapPackageTests.xctest/Contents/MacOS/RecapPackageTests \
107+
-instr-profile .build/debug/codecov/default.profdata \
108+
-format=lcov \
109+
-ignore-filename-regex=".build|Tests|Mocks" \
110+
> coverage.lcov || true
111+
112+
- name: Upload Test Results
113+
uses: actions/upload-artifact@v4
114+
if: always()
115+
with:
116+
name: test-results
117+
path: test-results.xml
118+
119+
- name: Upload Coverage Reports
120+
uses: codecov/codecov-action@v5
121+
with:
122+
file: ./coverage.lcov
123+
flags: unittests
124+
name: recap-coverage
125+
fail_ci_if_error: false
126+
127+
- name: Publish Test Report
128+
uses: mikepenz/action-junit-report@v4
129+
if: always()
130+
with:
131+
report_paths: 'test-results.xml'
132+
check_name: 'Test Results'
133+
fail_on_failure: true
134+
135+
check-generated-mocks:
136+
name: Check Generated Mocks
137+
runs-on: macos-15
138+
139+
steps:
140+
- name: Checkout code
141+
uses: actions/checkout@v4
142+
143+
- name: Setup Xcode
144+
uses: maxim-lobanov/setup-xcode@v1
145+
with:
146+
xcode-version: '16.0'
147+
148+
- name: Build to Generate Mocks
149+
run: |
150+
cd Recap
151+
swift build
152+
153+
- name: Check for Uncommitted Mock Changes
154+
run: |
155+
if [[ -n $(git status --porcelain) ]]; then
156+
echo "Generated mocks are not committed. Please build locally and commit the generated mock files."
157+
git status --porcelain
158+
exit 1
159+
fi

.github/workflows/pr-tests.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
test-matrix:
9+
name: Test on macOS ${{ matrix.macos }}
10+
runs-on: ${{ matrix.macos }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
macos: [macos-14, macos-15]
15+
xcode: ['15.4', '16.0']
16+
exclude:
17+
- macos: macos-14
18+
xcode: '16.0'
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup Xcode
25+
uses: maxim-lobanov/setup-xcode@v1
26+
with:
27+
xcode-version: ${{ matrix.xcode }}
28+
29+
- name: Cache Dependencies
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
~/Library/Developer/Xcode/DerivedData
34+
.build
35+
key: ${{ runner.os }}-${{ matrix.macos }}-spm-${{ hashFiles('**/Package.resolved') }}
36+
37+
- name: Build and Test
38+
run: |
39+
cd Recap
40+
swift test --parallel
41+
42+
- name: Comment PR on Failure
43+
if: failure()
44+
uses: actions/github-script@v7
45+
with:
46+
script: |
47+
github.rest.issues.createComment({
48+
issue_number: context.issue.number,
49+
owner: context.repo.owner,
50+
repo: context.repo.repo,
51+
body: '❌ Tests failed on ${{ matrix.macos }} with Xcode ${{ matrix.xcode }}. Please check the workflow logs.'
52+
})
53+
54+
- name: Comment PR on Success
55+
if: success() && matrix.macos == 'macos-15' && matrix.xcode == '16.0'
56+
uses: actions/github-script@v7
57+
with:
58+
script: |
59+
github.rest.issues.createComment({
60+
issue_number: context.issue.number,
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
body: '✅ All tests passed!'
64+
})

.github/workflows/test.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Test Suite
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
name: Run Tests
13+
runs-on: macos-15
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Xcode
20+
uses: maxim-lobanov/setup-xcode@v1
21+
with:
22+
xcode-version: '16.0'
23+
24+
- name: Cache Swift Package Manager
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/Library/Developer/Xcode/DerivedData
29+
.build
30+
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
31+
restore-keys: |
32+
${{ runner.os }}-spm-
33+
34+
- name: Resolve Dependencies
35+
run: |
36+
cd Recap
37+
swift package resolve
38+
39+
- name: Build for Testing
40+
run: |
41+
cd Recap
42+
swift build --build-tests
43+
44+
- name: Run Tests
45+
run: |
46+
cd Recap
47+
swift test --parallel --xunit-output=test-results.xml
48+
49+
- name: Upload Test Results
50+
uses: actions/upload-artifact@v4
51+
if: always()
52+
with:
53+
name: test-results
54+
path: Recap/test-results.xml
55+
56+
- name: Publish Test Report
57+
uses: mikepenz/action-junit-report@v4
58+
if: always()
59+
with:
60+
report_paths: 'Recap/test-results.xml'
61+
check_name: 'Test Results'
62+
fail_on_failure: true
63+
64+
code-coverage:
65+
name: Code Coverage
66+
runs-on: macos-15
67+
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v4
71+
72+
- name: Setup Xcode
73+
uses: maxim-lobanov/setup-xcode@v1
74+
with:
75+
xcode-version: '16.0'
76+
77+
- name: Generate Coverage Report
78+
run: |
79+
cd Recap
80+
swift test --enable-code-coverage
81+
82+
- name: Convert Coverage to LCOV
83+
run: |
84+
cd Recap
85+
xcrun llvm-cov export \
86+
.build/debug/RecapPackageTests.xctest/Contents/MacOS/RecapPackageTests \
87+
-instr-profile .build/debug/codecov/default.profdata \
88+
-format=lcov \
89+
-ignore-filename-regex=".build|Tests" \
90+
> coverage.lcov
91+
92+
- name: Upload Coverage to Codecov
93+
uses: codecov/codecov-action@v5
94+
with:
95+
file: ./Recap/coverage.lcov
96+
flags: unittests
97+
name: recap-coverage
98+
fail_ci_if_error: false

Recap/UseCases/Settings/ViewModels/MeetingDetection/MeetingDetectionSettingsViewModel.swift

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,25 @@ final class MeetingDetectionSettingsViewModel: MeetingDetectionSettingsViewModel
3030
}
3131

3232
func handleAutoDetectToggle(_ enabled: Bool) async {
33-
do {
34-
try await userPreferencesRepository.updateAutoDetectMeetings(enabled)
35-
36-
withAnimation(.easeInOut(duration: 0.2)) {
37-
autoDetectMeetings = enabled
38-
}
33+
try? await userPreferencesRepository.updateAutoDetectMeetings(enabled)
34+
35+
withAnimation(.easeInOut(duration: 0.2)) {
36+
autoDetectMeetings = enabled
37+
}
38+
39+
if enabled {
40+
let hasPermission = await detectionService.checkPermission()
41+
hasScreenRecordingPermission = hasPermission
3942

40-
if enabled {
41-
let hasPermission = await detectionService.checkPermission()
42-
hasScreenRecordingPermission = hasPermission
43-
44-
if hasPermission {
45-
detectionService.startMonitoring()
46-
} else {
47-
openScreenRecordingPreferences()
48-
}
43+
if hasPermission {
44+
detectionService.startMonitoring()
4945
} else {
50-
detectionService.stopMonitoring()
46+
openScreenRecordingPreferences()
5147
}
52-
} catch {
53-
print("Failed to update auto detect meetings setting: \(error)")
48+
} else {
49+
detectionService.stopMonitoring()
5450
}
51+
5552
}
5653

5754
func checkPermissionStatus() async {

0 commit comments

Comments
 (0)