Skip to content

Commit a9e52e1

Browse files
kupriyanovNikStanislavMayorov
authored andcommitted
improved logging, updated README
1 parent 8fdc739 commit a9e52e1

8 files changed

Lines changed: 575 additions & 141 deletions

File tree

.github/ci/README.md

Lines changed: 158 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ Main files:
66

77
- Workflow: `.github/workflows/sdk-validation.yml`
88
- Config: `.github/ci/ci-run-config.json`
9-
- Helpers: `scripts/ci/sdk_validation/`
9+
- Config preparation: `scripts/ci/sdk_validation/prepare-config.js`
10+
- Shared shell logging: `scripts/ci/sdk_validation/lib/logging.sh`
11+
- Build/test helpers: `scripts/ci/sdk_validation/`
1012

1113
The workflow is manual-only (`workflow_dispatch`). There are no automatic triggers for pull requests or pushes.
1214

@@ -19,7 +21,12 @@ There is one workflow, `SDK Validation`, with four user-facing validation flows
1921
- `run_tests`
2022
- `lint_pods`
2123

22-
Internally, the workflow also has a technical `Prepare CI config` job that validates inputs and computes effective matrices before the validation jobs start.
24+
Internally, the workflow also has one technical job, `Prepare CI config`, that:
25+
26+
- validates workflow input defaults against `.github/ci/ci-run-config.json`
27+
- parses boolean and JSON overrides
28+
- validates matrix structure
29+
- derives the effective matrices used by downstream jobs
2330

2431
Default manual profile:
2532

@@ -28,15 +35,30 @@ Default manual profile:
2835
- `run_tests = true`
2936
- `lint_pods = false`
3037

38+
Concurrency behavior:
39+
40+
- manual runs are grouped by `workflow + ref`
41+
- starting a new `SDK Validation` run on the same branch cancels the previous in-progress run on that branch
42+
3143
## Validation Flows
3244

3345
### `build_sdk_targets`
3446

3547
What it does:
3648

37-
- runs SwiftPM SDK library target builds across `build_matrix`
38-
- builds the iOS package scheme `Adapty-Package` on the primary `sdk_tests` entry (`runner + xcode`)
39-
- runs a separate one-Xcode macOS SDK build on `sdk_tests.runner` + `sdk_tests.xcode`
49+
- runs `build_sdk_matrix` across `build_matrix`
50+
- for each matrix entry:
51+
- resolves SwiftPM dependencies inside the configured scratch path
52+
- discovers library products from `Package.swift`
53+
- builds each SwiftPM library target
54+
- on the primary `sdk_tests.runner + sdk_tests.xcode` entry, also builds the iOS package scheme `Adapty-Package`
55+
- runs a separate `macos_sdk_build` job on `sdk_tests.runner + sdk_tests.xcode`
56+
57+
Scripts involved:
58+
59+
- `scripts/ci/sdk_validation/build-spm-library-targets.sh`
60+
- `scripts/ci/sdk_validation/list-library-targets.js`
61+
- `scripts/ci/sdk_validation/lib/logging.sh`
4062

4163
Inputs that affect it:
4264

@@ -45,16 +67,29 @@ Inputs that affect it:
4567

4668
Behavior:
4769

48-
- strict failure
49-
- `build_matrix` must include the primary `sdk_tests` entry (`runner + xcode`)
70+
- default config is blocking
71+
- `build_matrix` entries may use `informational: true`; those entries run with `continue-on-error`
72+
- the primary `sdk_tests.runner + sdk_tests.xcode` entry must exist in `build_matrix`
73+
- the primary build entry must have `informational: false`
74+
75+
Artifacts:
76+
77+
- `swift-build-products-log-<runner>-xcode-<xcode>`
78+
- `swift-build-macos-log-xcode-<xcode>`
5079

5180
### `build_test_app`
5281

5382
What it does:
5483

55-
- builds `AdaptyRecipes-SwiftUI`
56-
- runs only on the primary `sdk_tests` entry (`runner + xcode`), even if `build_matrix` contains more entries
57-
- writes a CI-specific `AppConstants.swift` before `xcodebuild`
84+
- builds `Examples/AdaptyRecipes-SwiftUI/AdaptyRecipes-SwiftUI.xcodeproj`
85+
- writes CI-specific demo constants before the build
86+
- uploads `xcodebuild.log` even when `xcodebuild` returns non-zero
87+
88+
Scripts involved:
89+
90+
- `scripts/ci/sdk_validation/write-demo-constants.sh`
91+
- `scripts/ci/sdk_validation/build-demo-app.sh`
92+
- `scripts/ci/sdk_validation/lib/logging.sh`
5893

5994
Inputs that affect it:
6095

@@ -63,14 +98,29 @@ Inputs that affect it:
6398

6499
Behavior:
65100

66-
- uses the single primary `sdk_tests` entry filtered from `build_matrix`
67-
- strict failure
101+
- runs only on the single primary entry derived from `build_matrix`
102+
- the helper writes `exit_code` to `GITHUB_OUTPUT`
103+
- the workflow uploads the log first, then fails in a separate step if `exit_code != 0`
104+
- effectively blocking, because the derived primary entry must have `informational: false`
105+
106+
Artifact:
107+
108+
- `demo-build-log-<runner>-xcode-<xcode>`
68109

69110
### `run_tests`
70111

71112
What it does:
72113

73-
- runs `swift test` using `sdk_tests_matrix`
114+
- runs `sdk_tests` across `sdk_tests_matrix`
115+
- for each matrix entry:
116+
- resolves SwiftPM dependencies
117+
- runs `swift test`
118+
- uploads `swift-test.log` even when `swift test` returns non-zero
119+
120+
Scripts involved:
121+
122+
- `scripts/ci/sdk_validation/run-sdk-tests.sh`
123+
- `scripts/ci/sdk_validation/lib/logging.sh`
74124

75125
Inputs that affect it:
76126

@@ -79,58 +129,120 @@ Inputs that affect it:
79129

80130
Behavior:
81131

82-
- strict failure
83-
- no whitelist support
132+
- default config is blocking, because the default matrix contains one primary entry with `informational: false`
133+
- override entries may use `informational: true`; those entries run with `continue-on-error`
134+
- `sdk_tests_matrix_override_json` does not have to include the primary `sdk_tests` entry
135+
- there is no whitelist mechanism
136+
- the helper writes `exit_code` to `GITHUB_OUTPUT`
137+
- the workflow uploads the log first, then fails in a separate step if `exit_code != 0`
138+
139+
Artifact:
140+
141+
- `sdk-tests-log-<runner>-xcode-<xcode>`
84142

85143
### `lint_pods`
86144

87145
What it does:
88146

89-
- runs `pod lib lint` for published podspecs
147+
- runs `pod lib lint` for:
148+
- `Adapty.podspec`
149+
- `AdaptyUI.podspec`
150+
- `AdaptyPlugin.podspec`
151+
152+
Scripts involved:
153+
154+
- `scripts/ci/sdk_validation/run-pod-lib-lint.sh`
155+
- `scripts/ci/sdk_validation/lib/logging.sh`
90156

91157
Inputs that affect it:
92158

93159
- `lint_pods`
94160

95161
Behavior:
96162

97-
- strict failure
98-
- no whitelist support
99-
- runs on `sdk_tests.runner` + `sdk_tests.xcode`
163+
- blocking
164+
- runs only on `sdk_tests.runner + sdk_tests.xcode`
165+
- there is no whitelist mechanism
166+
167+
Artifact:
168+
169+
- `pod-lib-lint-log-xcode-<xcode>`
170+
171+
## Logging Model
172+
173+
All artifact-producing shell helpers use the same logging contract from `scripts/ci/sdk_validation/lib/logging.sh`.
174+
175+
After log initialization:
176+
177+
- stdout and stderr are mirrored to both live Actions output and the log file
178+
- early failures are written into the artifact log
179+
- helpers must not use extra `tee -a` logging on top of the shared logger
180+
181+
Current artifact-owning helpers:
182+
183+
- `build-spm-library-targets.sh`
184+
- `build-demo-app.sh`
185+
- `run-sdk-tests.sh`
186+
- `run-pod-lib-lint.sh`
187+
188+
Special cases:
189+
190+
- `build-demo-app.sh` and `run-sdk-tests.sh` intentionally do not fail their step on command non-zero
191+
- instead, they store `exit_code` in `GITHUB_OUTPUT`, so the workflow can upload the log artifact before failing
100192

101193
## Manual Run Inputs
102194

103195
### Boolean flags
104196

105-
- `build_sdk_targets`: enable the SDK build flow
106-
- `build_test_app`: enable the test app build flow
107-
- `run_tests`: enable the `swift test` flow
108-
- `lint_pods`: enable the CocoaPods lint flow
197+
- `build_sdk_targets`: enable SDK builds
198+
- `build_test_app`: enable demo app build
199+
- `run_tests`: enable `swift test`
200+
- `lint_pods`: enable CocoaPods lint
109201

110202
At least one of these flags must be `true`.
111203

112204
### JSON overrides
113205

114-
- `build_matrix_override_json`: optional override for SDK build flow and primary entry selection for the test app
115-
- `sdk_tests_matrix_override_json`: optional override for the `swift test` matrix; entries may use `informational: true` to make a test run non-blocking
206+
- `build_matrix_override_json`: override for SDK build matrix and primary build entry selection
207+
- `sdk_tests_matrix_override_json`: override for `swift test` matrix
208+
209+
Accepted formats:
210+
211+
- JSON array of matrix entries
212+
- JSON object with `include: [...]`
213+
214+
Matrix entry shape:
215+
216+
```json
217+
{
218+
"runner": "macos-15",
219+
"xcode": "26.2",
220+
"informational": false
221+
}
222+
```
223+
224+
Rules:
225+
226+
- `runner + xcode` pairs must be unique
227+
- `informational: true` means the matrix entry is advisory and uses `continue-on-error`
228+
- if `build_sdk_targets=true` or `build_test_app=true`, `build_matrix` must include the primary `sdk_tests` entry with `informational: false`
229+
- `sdk_tests_matrix_override_json` may omit the primary `sdk_tests` entry entirely for custom test-only runs
116230

117231
## Validation Rules
118232

119-
- Boolean defaults in `workflow_dispatch` must stay in sync with `.github/ci/ci-run-config.json`.
120-
- `Prepare CI config` fails if all four boolean flags are `false`.
121-
- Matrix override JSON must be a non-empty array or an object with `include[]`.
122-
- Matrix entries must be unique by `runner + xcode`.
123-
- If `build_sdk_targets=true` or `build_test_app=true`, `build_matrix` must include the primary `sdk_tests` entry (`runner + xcode`).
124-
- `sdk_tests_matrix_override_json` does not require the primary `sdk_tests` entry; it can be used for custom test-only runs.
233+
- `Prepare CI config` fails if all four boolean flags are `false`
234+
- workflow input defaults in `workflow_dispatch` must stay in sync with `.github/ci/ci-run-config.json`
235+
- matrix override JSON must be a non-empty array or an object with `include[]`
236+
- matrix entries must be unique by `runner + xcode`
237+
- `build_test_app` always derives a single-entry matrix from the primary build entry
125238

126239
## Xcode Selection Behavior
127240

128-
- Matrix jobs use `setup-xcode` for requested versions.
129-
- If a matrix entry is `informational: true` and Xcode is unavailable, that entry is skipped with a warning.
130-
- If a matrix entry is `informational: false` and Xcode is unavailable, that entry fails.
131-
- For matrix jobs, `informational: true` also means the entry uses `continue-on-error` and does not block the whole workflow if the build/test command fails.
132-
- One-Xcode jobs (`SDK macOS build`, `CocoaPods lint`) fail if the configured Xcode is unavailable.
133-
- iOS-specific steps (`Adapty-Package` and `AdaptyRecipes-SwiftUI`) run only on the primary `sdk_tests` entry (`runner + xcode`).
241+
- matrix jobs use `setup-xcode` for the requested version
242+
- if a matrix entry is `informational: true` and Xcode is unavailable, that entry is skipped with a warning
243+
- if a matrix entry is `informational: false` and Xcode is unavailable, that entry fails
244+
- `SDK macOS build` and `CocoaPods lint` are single-Xcode jobs and fail if the configured Xcode is unavailable
245+
- iOS-specific steps (`Adapty-Package` and `AdaptyRecipes-SwiftUI`) run only on the primary `sdk_tests.runner + sdk_tests.xcode`
134246

135247
## Manual Run Guide
136248

@@ -143,14 +255,6 @@ At least one of these flags must be `true`.
143255
5. Leave the default profile or override flags/JSON inputs.
144256
6. Click `Run workflow`.
145257

146-
Artifacts:
147-
148-
- `swift-build-products-log-...`
149-
- `demo-build-log-...`
150-
- `swift-build-macos-log-...`
151-
- `pod-lib-lint-log-...`
152-
- `sdk-tests-log-...`
153-
154258
### GitHub CLI (`gh`)
155259

156260
Run full default profile:
@@ -170,7 +274,7 @@ gh workflow run "SDK Validation" --ref master \
170274
-f build_matrix_override_json='[{"runner":"macos-15","xcode":"26.2","informational":false}]'
171275
```
172276

173-
Run only test app build:
277+
Run only demo app build:
174278

175279
```bash
176280
gh workflow run "SDK Validation" --ref master \
@@ -189,3 +293,11 @@ gh workflow run "SDK Validation" --ref master \
189293
-f run_tests=true \
190294
-f lint_pods=false
191295
```
296+
297+
Artifacts produced by the workflow:
298+
299+
- `swift-build-products-log-...`
300+
- `demo-build-log-...`
301+
- `swift-build-macos-log-...`
302+
- `pod-lib-lint-log-...`
303+
- `sdk-tests-log-...`

0 commit comments

Comments
 (0)