Skip to content

Commit 8f83db4

Browse files
kupriyanovNikStanislavMayorov
authored andcommitted
updated config for testing
1 parent a9e52e1 commit 8f83db4

3 files changed

Lines changed: 51 additions & 9 deletions

File tree

.github/ci/README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CI Configuration for SDK Validation
22

3-
This folder contains the source-of-truth config for the manual `SDK Validation` workflow.
3+
This folder contains the source-of-truth config for the `SDK Validation` workflow.
44

55
Main files:
66

@@ -10,7 +10,10 @@ Main files:
1010
- Shared shell logging: `scripts/ci/sdk_validation/lib/logging.sh`
1111
- Build/test helpers: `scripts/ci/sdk_validation/`
1212

13-
The workflow is manual-only (`workflow_dispatch`). There are no automatic triggers for pull requests or pushes.
13+
The workflow supports both:
14+
15+
- automatic runs on `pull_request`
16+
- manual runs via `workflow_dispatch`
1417

1518
## Workflow Shape
1619

@@ -28,7 +31,7 @@ Internally, the workflow also has one technical job, `Prepare CI config`, that:
2831
- validates matrix structure
2932
- derives the effective matrices used by downstream jobs
3033

31-
Default manual profile:
34+
Default validation profile from `.github/ci/ci-run-config.json`:
3235

3336
- `build_sdk_targets = true`
3437
- `build_test_app = true`
@@ -37,7 +40,7 @@ Default manual profile:
3740

3841
Concurrency behavior:
3942

40-
- manual runs are grouped by `workflow + ref`
43+
- runs are grouped by `workflow + ref`
4144
- starting a new `SDK Validation` run on the same branch cancels the previous in-progress run on that branch
4245

4346
## Validation Flows
@@ -190,6 +193,30 @@ Special cases:
190193
- `build-demo-app.sh` and `run-sdk-tests.sh` intentionally do not fail their step on command non-zero
191194
- instead, they store `exit_code` in `GITHUB_OUTPUT`, so the workflow can upload the log artifact before failing
192195

196+
## Trigger Modes
197+
198+
### `pull_request`
199+
200+
Automatic runs happen on:
201+
202+
- `opened`
203+
- `reopened`
204+
- `synchronize`
205+
- `ready_for_review`
206+
207+
For `pull_request`, the workflow does not use manual inputs. It derives the effective profile directly from `.github/ci/ci-run-config.json`.
208+
209+
With the current config this means:
210+
211+
- `build_sdk_targets = true`
212+
- `build_test_app = true`
213+
- `run_tests = true`
214+
- `lint_pods = false`
215+
216+
### `workflow_dispatch`
217+
218+
Manual runs use the workflow inputs shown in the GitHub UI. If an input is left empty, `Prepare CI config` falls back to `.github/ci/ci-run-config.json`.
219+
193220
## Manual Run Inputs
194221

195222
### Boolean flags

.github/workflows/sdk-validation.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: SDK Validation
22

33
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
- ready_for_review
410
workflow_dispatch:
511
inputs:
612
build_sdk_targets:
@@ -65,6 +71,7 @@ jobs:
6571
- name: Prepare effective config
6672
id: prepare
6773
env:
74+
EVENT_NAME: ${{ github.event_name }}
6875
INPUT_BUILD_SDK_TARGETS: ${{ github.event.inputs.build_sdk_targets }}
6976
INPUT_BUILD_TEST_APP: ${{ github.event.inputs.build_test_app }}
7077
INPUT_RUN_TESTS: ${{ github.event.inputs.run_tests }}

scripts/ci/sdk_validation/prepare-config.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,17 @@ const {
1616
const main = () => {
1717
const configPath = ".github/ci/ci-run-config.json";
1818
const workflowPath = ".github/workflows/sdk-validation.yml";
19+
const eventName = (process.env.EVENT_NAME || "workflow_dispatch").trim();
1920

2021
const config = parseJson(readRequiredFile(configPath), configPath);
2122
if (config.schema_version !== 2) {
2223
throw new Error(`Unsupported schema_version '${config.schema_version}' in ${configPath}. Expected 2.`);
2324
}
2425

26+
if (eventName !== "workflow_dispatch" && eventName !== "pull_request") {
27+
throw new Error(`Unsupported event '${eventName}'. Expected workflow_dispatch or pull_request.`);
28+
}
29+
2530
const defaultRunBuildSdkTargets = validateBoolean(config.build_sdk_targets, "build_sdk_targets");
2631
const defaultRunBuildTestApp = validateBoolean(config.build_test_app, "build_test_app");
2732
const defaultRunTests = validateBoolean(config.run_tests, "run_tests");
@@ -51,13 +56,16 @@ const main = () => {
5156
const defaultSdkTestsMatrix = validateMatrix(config.sdk_tests_matrix, "sdk_tests_matrix");
5257
const sdkTests = validateSdkTests(config.sdk_tests);
5358

54-
const runBuildSdkTargets = parseBool(process.env.INPUT_BUILD_SDK_TARGETS, defaultRunBuildSdkTargets, "build_sdk_targets");
55-
const runBuildTestApp = parseBool(process.env.INPUT_BUILD_TEST_APP, defaultRunBuildTestApp, "build_test_app");
56-
const runTests = parseBool(process.env.INPUT_RUN_TESTS, defaultRunTests, "run_tests");
57-
const runLintPods = parseBool(process.env.INPUT_LINT_PODS, defaultRunLintPods, "lint_pods");
59+
const parseEffectiveBool = (raw, defaultValue, label) =>
60+
eventName === "pull_request" ? defaultValue : parseBool(raw, defaultValue, label);
61+
62+
const runBuildSdkTargets = parseEffectiveBool(process.env.INPUT_BUILD_SDK_TARGETS, defaultRunBuildSdkTargets, "build_sdk_targets");
63+
const runBuildTestApp = parseEffectiveBool(process.env.INPUT_BUILD_TEST_APP, defaultRunBuildTestApp, "build_test_app");
64+
const runTests = parseEffectiveBool(process.env.INPUT_RUN_TESTS, defaultRunTests, "run_tests");
65+
const runLintPods = parseEffectiveBool(process.env.INPUT_LINT_PODS, defaultRunLintPods, "lint_pods");
5866

5967
if (!runBuildSdkTargets && !runBuildTestApp && !runTests && !runLintPods) {
60-
throw new Error("workflow_dispatch requires at least one enabled action (build_sdk_targets, build_test_app, run_tests, lint_pods).");
68+
throw new Error(`SDK Validation requires at least one enabled action (event: ${eventName}).`);
6169
}
6270

6371
let effectiveBuildMatrix = runBuildSdkTargets || runBuildTestApp ? defaultBuildMatrix : [];

0 commit comments

Comments
 (0)