Skip to content

Commit d2088e6

Browse files
committed
Fix GitHub Actions Gemini CLI workflows
1 parent 97b0272 commit d2088e6

File tree

5 files changed

+55
-29
lines changed

5 files changed

+55
-29
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020
runs-on: ${{ matrix.os }}
2121

2222
steps:
23+
- name: Enable Git long paths (Windows)
24+
if: runner.os == 'Windows'
25+
run: git config --global core.longpaths true
26+
2327
- name: Checkout
2428
uses: actions/checkout@v5
2529
with:
@@ -36,7 +40,10 @@ jobs:
3640
dotnet-version: ${{ env.DOTNET_VERSION }}
3741

3842
- name: Install Gemini CLI
39-
run: npm install --no-save @google/gemini-cli
43+
shell: bash
44+
run: |
45+
npm install --no-save @google/gemini-cli
46+
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH"
4047
4148
- name: Restore
4249
run: dotnet restore ManagedCode.GeminiSharpSDK.slnx

.github/workflows/gemini-cli-watch.yml

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,39 @@ jobs:
6161
6262
extract_model_snapshot() {
6363
local sha="$1"
64-
read_file_at_sha "$sha" "$MODELS_FILE" | python - "$MODELS_FILE" <<'PY'
65-
import re
66-
import sys
67-
68-
path = sys.argv[1]
69-
content = sys.stdin.read()
70-
71-
matches = []
72-
73-
if path.endswith('models.ts'):
74-
models_set_match = re.search(
75-
r'export\s+const\s+VALID_GEMINI_MODELS\s*=\s*new\s+Set\s*\(\s*\[(.*?)\]\s*\)',
76-
content,
77-
re.S,
78-
)
79-
if models_set_match:
80-
matches = re.findall(r"""["']([^"']+)["']""", models_set_match.group(1))
81-
82-
if not matches:
83-
matches = re.findall(r'export\s+const\s+[A-Z0-9_]*_MODEL[A-Z0-9_]*\s*=\s*["\']([^"\']+)["\']', content)
84-
else:
85-
matches = re.findall(r"export\s+const\s+[^\s]+\s*=\s*'([^']+)'", content)
86-
87-
for value in sorted(set(matches)):
88-
print(value)
89-
PY
64+
read_file_at_sha "$sha" "$MODELS_FILE" | python3 -c '
65+
import re
66+
import sys
67+
68+
path = sys.argv[1]
69+
content = sys.stdin.read()
70+
quote = chr(39)
71+
quoted_value_pattern = "[\"" + quote + "]([^\"" + quote + "]+)[\"" + quote + "]"
72+
matches = []
73+
74+
if path.endswith("models.ts"):
75+
models_set_match = re.search(
76+
r"export\s+const\s+VALID_GEMINI_MODELS\s*=\s*new\s+Set\s*\(\s*\[(.*?)\]\s*\)",
77+
content,
78+
re.S,
79+
)
80+
if models_set_match:
81+
matches = re.findall(quoted_value_pattern, models_set_match.group(1))
82+
83+
if not matches:
84+
matches = re.findall(
85+
r"export\s+const\s+[A-Z0-9_]*_MODEL[A-Z0-9_]*\s*=\s*" + quoted_value_pattern,
86+
content,
87+
)
88+
else:
89+
matches = re.findall(
90+
r"export\s+const\s+[^\s]+\s*=\s*" + quoted_value_pattern,
91+
content,
92+
)
93+
94+
for value in sorted(set(matches)):
95+
print(value)
96+
' "$MODELS_FILE"
9097
}
9198
9299
extract_feature_snapshot() {

.github/workflows/real-integration.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ jobs:
2222
runs-on: ${{ matrix.os }}
2323

2424
steps:
25+
- name: Enable Git long paths (Windows)
26+
if: runner.os == 'Windows'
27+
run: git config --global core.longpaths true
28+
2529
- name: Checkout
2630
uses: actions/checkout@v5
2731
with:
@@ -38,7 +42,10 @@ jobs:
3842
dotnet-version: ${{ env.DOTNET_VERSION }}
3943

4044
- name: Install Gemini CLI
41-
run: npm install --no-save @google/gemini-cli
45+
shell: bash
46+
run: |
47+
npm install --no-save @google/gemini-cli
48+
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH"
4249
4350
- name: Restore
4451
run: dotnet restore ManagedCode.GeminiSharpSDK.slnx

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ jobs:
3535
node-version: ${{ env.NODE_VERSION }}
3636

3737
- name: Install Gemini CLI
38-
run: npm install --no-save @google/gemini-cli
38+
shell: bash
39+
run: |
40+
npm install --no-save @google/gemini-cli
41+
echo "$GITHUB_WORKSPACE/node_modules/.bin" >> "$GITHUB_PATH"
3942
4043
- name: Extract version from Directory.Build.props
4144
id: version

docs/Features/release-and-sync-automation.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ Keep package quality and upstream Gemini CLI parity automatically verified throu
3434

3535
- CI must run build and tests on every push/PR.
3636
- CI and Release workflows must execute full solution tests before smoke subsets, excluding auth-required tests with `-- --treenode-filter "/*/*/*/*[RequiresGeminiAuth!=true]"`.
37+
- CI, Release, and scheduled smoke workflows must install Gemini CLI in a way that remains resolvable by later `dotnet test` steps (for example by adding local `node_modules/.bin` to `PATH`).
38+
- Windows workflows that checkout recursive submodules must enable Git long paths before `actions/checkout`, otherwise upstream Gemini snapshot files can break checkout.
3739
- Gemini CLI smoke test workflow steps must run `GeminiCli_Smoke_*` via `GeminiSharpSDK.Tests` project scope to avoid false `zero tests ran` failures in non-smoke test assemblies.
3840
- Gemini CLI smoke validation must cover both `gemini --help` and headless `gemini --prompt ... --output-format stream-json`, proving root and non-interactive surfaces stay discoverable.
3941
- Release workflow must build/test before pack/publish.

0 commit comments

Comments
 (0)