Skip to content

Commit 122683e

Browse files
authored
chore: add github actions for unit test and build scheme (#4)
* chore: add github actions for unit test and build scheme * add changes for test run * update runner versions * update code * address review comments
1 parent 2c6079e commit 122683e

File tree

6 files changed

+205
-2
lines changed

6 files changed

+205
-2
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build on minimum supported platforms
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
inputs:
7+
identifier:
8+
required: true
9+
type: string
10+
push:
11+
branches: [ main ]
12+
pull_request:
13+
branches: [ main ]
14+
15+
permissions: {}
16+
17+
concurrency:
18+
group: ${{ inputs.identifier || github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build-on-minimum-supported-platforms:
23+
name: ${{ matrix.os }}
24+
environment: unit-test # TODO: remove this
25+
strategy:
26+
fail-fast: true
27+
matrix:
28+
include:
29+
- scheme: AWSAppSyncEvents
30+
os: iOS # Swift 5.9 (Xcode 15.0), iOS v13
31+
sdk: iphonesimulator17.0
32+
destination: platform=iOS Simulator,name=iPhone 14,OS=17.0
33+
runner: macos-13
34+
xcode_version: Xcode_15.0.1
35+
- scheme: AWSAppSyncEvents
36+
os: macOS # Swift 5.9 (Xcode 15.0), macOS v10_15
37+
sdk: macosx14.0
38+
destination: platform=OS X,arch=x86_64
39+
runner: macos-13
40+
xcode_version: Xcode_15.0.1
41+
- scheme: AWSAppSyncEvents
42+
os: tvOS # Swift 5.9 (Xcode 15.0), tvOS v13
43+
sdk: appletvsimulator17.0
44+
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=17.0
45+
runner: macos-13
46+
xcode_version: Xcode_15.0.1
47+
48+
runs-on: ${{ matrix.runner }}
49+
steps:
50+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
51+
with:
52+
persist-credentials: false
53+
token: ${{ secrets.PAT }} # TODO: remove this
54+
55+
- name: ${{ matrix.os }}
56+
run: |
57+
sudo xcode-select -s "/Applications/${{ matrix.xcode_version }}.app"
58+
xcodebuild build \
59+
-scheme ${{ matrix.scheme }} \
60+
-destination "${{ matrix.destination }}" \
61+
-sdk ${{ matrix.sdk }} \
62+
| xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}

.github/workflows/unit-test.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Unit Test
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
inputs:
7+
identifier:
8+
required: true
9+
type: string
10+
push:
11+
branches: [ main ]
12+
pull_request:
13+
branches: [ main ]
14+
15+
permissions: {}
16+
17+
concurrency:
18+
group: ${{ inputs.identifier || github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
unit-test:
23+
name: "[${{ matrix.os }}] Unit Tests"
24+
environment: unit-test # TODO: remove this
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- scheme: AWSAppSyncEvents
30+
os: iOS
31+
sdk: iphonesimulator
32+
destination: platform=iOS Simulator,name=iPhone 15,OS=latest
33+
- scheme: AWSAppSyncEvents
34+
os: macOS
35+
sdk: macosx
36+
destination: platform=OS X,arch=x86_64
37+
- scheme: AWSAppSyncEvents
38+
os: tvOS
39+
sdk: appletvsimulator
40+
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
41+
42+
runs-on: macos-14
43+
steps:
44+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
45+
with:
46+
persist-credentials: false
47+
token: ${{ secrets.PAT }} # TODO: remove this
48+
49+
- name: ${{ matrix.os }}
50+
run: |
51+
xcodebuild test \
52+
-scheme ${{ matrix.scheme }} \
53+
-destination "${{ matrix.destination }}" \
54+
-sdk ${{ matrix.sdk }} \
55+
-only-testing:"${{ matrix.scheme }}Tests" | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}

Sources/AWSAppSyncEvents/WebSocket/AppSyncWebSocketClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ final class AppSyncWebSocketClient: NSObject, URLSessionDelegate {
330330
.first()
331331
.sink { [weak self] _ in
332332
self?.logger?.verbose("[AppSyncWebSocketClient] Keep alive timed out, disconnecting...")
333-
Task {
333+
Task { [weak self] in
334334
try await self?.disconnect()
335335
}
336336
}

Tests/IntegrationTestApp/IntegrationTestApp.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
/* Begin PBXFileReference section */
2727
97098DB32DE76A2E00EED720 /* IntegrationTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = IntegrationTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
2828
97098DD12DE76AFC00EED720 /* IntegrationTestAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = IntegrationTestAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
29+
97585EAF2E2AE271003A15E4 /* IntegrationTestApp.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = IntegrationTestApp.xctestplan; sourceTree = "<group>"; };
2930
/* End PBXFileReference section */
3031

3132
/* Begin PBXFileSystemSynchronizedRootGroup section */
@@ -66,6 +67,7 @@
6667
97098DAA2DE76A2E00EED720 = {
6768
isa = PBXGroup;
6869
children = (
70+
97585EAF2E2AE271003A15E4 /* IntegrationTestApp.xctestplan */,
6971
97098DB52DE76A2E00EED720 /* IntegrationTestApp */,
7072
97098DD22DE76AFC00EED720 /* IntegrationTestAppTests */,
7173
97098DB42DE76A2E00EED720 /* Products */,
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1630"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "97098DB22DE76A2E00EED720"
19+
BuildableName = "IntegrationTestApp.app"
20+
BlueprintName = "IntegrationTestApp"
21+
ReferencedContainer = "container:IntegrationTestApp.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+
<TestPlans>
32+
<TestPlanReference
33+
reference = "container:IntegrationTestApp.xctestplan"
34+
default = "YES">
35+
</TestPlanReference>
36+
</TestPlans>
37+
</TestAction>
38+
<LaunchAction
39+
buildConfiguration = "Debug"
40+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42+
launchStyle = "0"
43+
useCustomWorkingDirectory = "NO"
44+
ignoresPersistentStateOnLaunch = "NO"
45+
debugDocumentVersioning = "YES"
46+
debugServiceExtension = "internal"
47+
allowLocationSimulation = "YES">
48+
<BuildableProductRunnable
49+
runnableDebuggingMode = "0">
50+
<BuildableReference
51+
BuildableIdentifier = "primary"
52+
BlueprintIdentifier = "97098DB22DE76A2E00EED720"
53+
BuildableName = "IntegrationTestApp.app"
54+
BlueprintName = "IntegrationTestApp"
55+
ReferencedContainer = "container:IntegrationTestApp.xcodeproj">
56+
</BuildableReference>
57+
</BuildableProductRunnable>
58+
</LaunchAction>
59+
<ProfileAction
60+
buildConfiguration = "Release"
61+
shouldUseLaunchSchemeArgsEnv = "YES"
62+
savedToolIdentifier = ""
63+
useCustomWorkingDirectory = "NO"
64+
debugDocumentVersioning = "YES">
65+
<BuildableProductRunnable
66+
runnableDebuggingMode = "0">
67+
<BuildableReference
68+
BuildableIdentifier = "primary"
69+
BlueprintIdentifier = "97098DB22DE76A2E00EED720"
70+
BuildableName = "IntegrationTestApp.app"
71+
BlueprintName = "IntegrationTestApp"
72+
ReferencedContainer = "container:IntegrationTestApp.xcodeproj">
73+
</BuildableReference>
74+
</BuildableProductRunnable>
75+
</ProfileAction>
76+
<AnalyzeAction
77+
buildConfiguration = "Debug">
78+
</AnalyzeAction>
79+
<ArchiveAction
80+
buildConfiguration = "Release"
81+
revealArchiveInOrganizer = "YES">
82+
</ArchiveAction>
83+
</Scheme>

Tests/IntegrationTestApp/IntegrationTestApp.xctestplan

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
{
22
"configurations" : [
33
{
4-
"id" : "681B8494-DF7F-4834-897B-8FC896226120",
4+
"id" : "C0161A8F-47D3-44A8-A218-DADA7B9EAC80",
55
"name" : "Test Scheme Action",
66
"options" : {
77

88
}
99
}
1010
],
1111
"defaultOptions" : {
12+
"codeCoverage" : false,
1213
"targetForVariableExpansion" : {
1314
"containerPath" : "container:IntegrationTestApp.xcodeproj",
1415
"identifier" : "97098DB22DE76A2E00EED720",

0 commit comments

Comments
 (0)