Skip to content

Commit b025184

Browse files
committed
added CI
1 parent 81e96c6 commit b025184

3 files changed

Lines changed: 136 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: macos-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Show Xcode version
17+
run: |
18+
xcodebuild -version
19+
xcode-select -p
20+
21+
- name: Run unit tests (with coverage)
22+
env:
23+
SCHEME: interview_coder-CI
24+
run: |
25+
chmod +x ./ci-run-tests.sh
26+
./ci-run-tests.sh
27+
28+
- name: Upload xcresult bundle
29+
if: always()
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: xcresult
33+
path: build/TestResults.xcresult
34+
35+
- name: Upload JUnit report
36+
if: always()
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: junit
40+
path: build/junit.xml

ci-run-tests.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Simple CI runner for macOS unit tests
5+
# - Uses the CI scheme with code coverage enabled
6+
# - Emits an .xcresult bundle and optional JUnit via xcpretty
7+
8+
SCHEME=${SCHEME:-interview_coder-CI}
9+
DEST=${DEST:-"platform=macOS"}
10+
RESULT_BUNDLE_PATH=${RESULT_BUNDLE_PATH:-"build/TestResults.xcresult"}
11+
DERIVED_DATA_PATH=${DERIVED_DATA_PATH:-"build/DerivedData"}
12+
13+
mkdir -p "$(dirname "$RESULT_BUNDLE_PATH")" "$DERIVED_DATA_PATH"
14+
15+
if command -v xcpretty >/dev/null 2>&1; then
16+
set -o pipefail
17+
xcodebuild \
18+
-scheme "$SCHEME" \
19+
-destination "$DEST" \
20+
-derivedDataPath "$DERIVED_DATA_PATH" \
21+
-resultBundlePath "$RESULT_BUNDLE_PATH" \
22+
test | xcpretty -r junit -o build/junit.xml
23+
else
24+
xcodebuild \
25+
-scheme "$SCHEME" \
26+
-destination "$DEST" \
27+
-derivedDataPath "$DERIVED_DATA_PATH" \
28+
-resultBundlePath "$RESULT_BUNDLE_PATH" \
29+
test
30+
fi
31+
32+
echo "Tests finished. Result bundle: $RESULT_BUNDLE_PATH"
33+
if [[ -f build/junit.xml ]]; then echo "JUnit report: build/junit.xml"; fi
34+
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1620"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "NO"
13+
buildForProfiling = "NO"
14+
buildForArchiving = "NO"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "7B2430AA2E96436300E3DDE4"
19+
BuildableName = "Codex++.app"
20+
BlueprintName = "interview_coder"
21+
ReferencedContainer = "container:interview_coder.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
</BuildActionEntries>
25+
</BuildAction>
26+
<TestAction
27+
buildConfiguration = "Debug"
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
shouldUseLaunchSchemeArgsEnv = "YES"
31+
shouldAutocreateTestPlan = "NO"
32+
codeCoverageEnabled = "YES">
33+
<Testables>
34+
<TestableReference
35+
skipped = "NO">
36+
<BuildableReference
37+
BuildableIdentifier = "primary"
38+
BlueprintIdentifier = "7B2430BD2E96436500E3DDE4"
39+
BuildableName = "interview_coderTests.xctest"
40+
BlueprintName = "interview_coderTests"
41+
ReferencedContainer = "container:interview_coder.xcodeproj">
42+
</BuildableReference>
43+
</TestableReference>
44+
</Testables>
45+
<CodeCoverageTargets>
46+
<BuildableReference
47+
BuildableIdentifier = "primary"
48+
BlueprintIdentifier = "7B2430AA2E96436300E3DDE4"
49+
BuildableName = "Codex++.app"
50+
BlueprintName = "interview_coder"
51+
ReferencedContainer = "container:interview_coder.xcodeproj">
52+
</BuildableReference>
53+
</CodeCoverageTargets>
54+
</TestAction>
55+
<AnalyzeAction
56+
buildConfiguration = "Debug">
57+
</AnalyzeAction>
58+
<ArchiveAction
59+
buildConfiguration = "Release"
60+
revealArchiveInOrganizer = "YES">
61+
</ArchiveAction>
62+
</Scheme>

0 commit comments

Comments
 (0)