Skip to content
Draft

Eval1 #790

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e3c54df
-
polina-c Mar 2, 2026
65c6189
Update smoke_test.dart
polina-c Mar 2, 2026
9f7343b
-
polina-c Mar 2, 2026
a9f861f
Create eval.yaml
polina-c Mar 2, 2026
3b678ac
-
polina-c Mar 2, 2026
fe8a7ff
Update pubspec.yaml
polina-c Mar 2, 2026
33c1b58
Update eval.yaml
polina-c Mar 2, 2026
12d791b
Update eval.yaml
polina-c Mar 2, 2026
2fa640f
Update eval.yaml
polina-c Mar 2, 2026
68caeed
Update eval.yaml
polina-c Mar 2, 2026
e0c5cab
Update eval.yaml
polina-c Mar 2, 2026
c2d1a21
Update eval.yaml
polina-c Mar 2, 2026
c61ac64
Merge branch 'eval' into eval1
polina-c Mar 10, 2026
b2ea20e
-
polina-c Mar 10, 2026
a3b6f01
-
polina-c Mar 10, 2026
389d904
Update eval.yaml
polina-c Mar 10, 2026
903aacb
Update eval.yaml
polina-c Mar 10, 2026
793dceb
Update eval.yaml
polina-c Mar 10, 2026
dfeaf6e
Update eval.yaml
polina-c Mar 11, 2026
1fd2c43
Update eval.yaml
polina-c Mar 11, 2026
339047a
Revert "Update eval.yaml"
polina-c Mar 11, 2026
820c52d
Update eval.yaml
polina-c Mar 11, 2026
6a638b1
Update eval.yaml
polina-c Mar 11, 2026
7e4ba7c
Update api_key.dart
polina-c Mar 11, 2026
f8a455c
Update eval.yaml
polina-c Mar 11, 2026
f3a8e83
Update eval.yaml
polina-c Mar 11, 2026
08e8e81
Create test.yaml
polina-c Mar 11, 2026
4fff8cf
Update test.yaml
polina-c Mar 11, 2026
7684b2f
Update test.yaml
polina-c Mar 11, 2026
0b58dd9
Update test.yaml
polina-c Mar 11, 2026
d4e230b
Update test.yaml
polina-c Mar 11, 2026
dff869c
Update test.yaml
polina-c Mar 11, 2026
ed589fa
Update test.yaml
polina-c Mar 11, 2026
b019d88
Update test.yaml
polina-c Mar 11, 2026
c1e0944
Update test.yaml
polina-c Mar 11, 2026
7717039
Update test.yaml
polina-c Mar 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions .github/workflows/eval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright 2025 The Flutter Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json

name: Eval CI

on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Tests may fail due to new dependency releases.
# Regular execution provides early detection of such regressions.
- cron: '0 * * * *' # hourly

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
# Prevents the job from running on forks or fork PRs (which don't have access to secrets).
# if: github.repository == 'flutter/genui' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
name: examples/eval (${{ matrix.flutter_version }})
environment: eval
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
flutter_version: [beta, stable]
os: [ubuntu-latest]
steps:
- name: Check API key 1
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
if [ -n "$GEMINI_API_KEY" ]; then
echo "GEMINI_API_KEY is set (${#GEMINI_API_KEY} chars)"
else
echo "GEMINI_API_KEY is NOT set"
fi
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
- uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046
with:
channel: ${{ matrix.flutter_version }}
cache: true
- name: Print Flutter version
run: flutter --version
- name: Cache Pub dependencies
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306
with:
path: ${{ env.PUB_CACHE }}
key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }}
restore-keys: ${{ runner.os }}-pub-
- name: Install dependencies
working-directory: examples/eval
run: dart pub get
- name: Check API key
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
if [ -n "$GEMINI_API_KEY" ]; then
echo "GEMINI_API_KEY is set (${#GEMINI_API_KEY} chars)"
else
echo "GEMINI_API_KEY is NOT set"
fi
- name: Run tests
working-directory: examples/eval
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: flutter test --dart-define=GEMINI_API_KEY=$GEMINI_API_KEY

2 changes: 1 addition & 1 deletion .github/workflows/flutter_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
# Find all directories containing pubspec.yaml in packages, tools, and examples.
ALL_DIRS=$(find packages examples tool -name pubspec.yaml -not -path "*/.dart_tool/*" -exec dirname {} \;)
ALL_DIRS=$(find packages examples tool -name pubspec.yaml -not -path "*/.dart_tool/*" -not -path "examples/eval/*" -exec dirname {} \;)

# Get the list of changed files. The method depends on the event type.
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI/CD Pipeline

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
environment: my-test-env
steps:
- uses: actions/checkout@v2

- name: secret
env:
MY_TEST_VAR: ${{ secrets.MY_TEST_VAR }}
MY_VAR_NAME: ${{ vars.MY_VAR_NAME }}
run: |
echo "MY_TEST_VAR has ${#MY_TEST_VAR} chars"
echo 'Hi ${{ vars.MY_VAR_NAME }}'
echo "Hi $MY_VAR_NAME"
3 changes: 3 additions & 0 deletions examples/eval/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Eval

Project for tests that evaluate genui against real AI models.
24 changes: 24 additions & 0 deletions examples/eval/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2025 The Flutter Authors.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

name: eval
publish_to: "none"

environment:
sdk: ">=3.10.0 <4.0.0"
flutter: ">=3.35.7 <4.0.0"

resolution: workspace

dependencies:
flutter:
sdk: flutter
genui: ^0.7.0

dev_dependencies:
flutter_test:
sdk: flutter

flutter:
uses-material-design: true
16 changes: 16 additions & 0 deletions examples/eval/test/smoke_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2025 The Flutter Authors.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter_test/flutter_test.dart';

import 'test_infra/api_key.dart';

void main() {
test('test can read api key "$geminiApiKeyName"', () {
final String key = apiKeyForEval();
expect(key, isNotEmpty);
// ignore: avoid_print
print('API Key: ${key.substring(0, 2)}...${key.substring(key.length - 2)}');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Printing parts of an API key to the console, even if redacted, is a security risk. This information could be captured in logs, especially in CI/CD environments, potentially exposing sensitive data. The expect(key, isNotEmpty) check on the previous line is sufficient to validate that a key has been provided.

});
}
20 changes: 20 additions & 0 deletions examples/eval/test/test_infra/api_key.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2025 The Flutter Authors.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io';

const geminiApiKeyName = 'GEMINI_API_KEY';

/// API key for Google Generative AI (only needed if using google backend).
/// Get an API key from https://aistudio.google.com/app/apikey
/// Specify this when running the app with "-D GEMINI_API_KEY=$GEMINI_API_KEY"
const String geminiApiKey = String.fromEnvironment(geminiApiKeyName);

String apiKeyForEval() {
String apiKey = geminiApiKey.isEmpty
? Platform.environment[geminiApiKeyName] ?? ''
: geminiApiKey;
if (apiKey.isEmpty) throw Exception('$geminiApiKeyName is not configured.');
return apiKey;
}
5 changes: 3 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ environment:

workspace:
- examples/catalog_gallery
- examples/eval
- examples/simple_chat

- examples/travel_app
- examples/verdure/client

- packages/genui
- packages/genui_a2a

- packages/json_schema_builder

- tool/fix_copyright
- tool/release
- tool/test_and_fix
Expand Down
Loading