Run some extra bots on GH using Antigravity#5924
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #5924 +/- ##
==========================================
+ Coverage 67.60% 67.62% +0.02%
==========================================
Files 169 169
Lines 12980 12980
Branches 2567 2567
==========================================
+ Hits 8775 8778 +3
+ Misses 3750 3745 -5
- Partials 455 457 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2de85f5 to
6ed6082
Compare
|
@codex review /gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces the ability to run tests against a pre-installed IDE by specifying it in the BOT environment variable. This is achieved by adding the which package to find the IDE executable and modifying the test runner script. The logic for selecting which test bots to run has also been refactored into a helper function for improved readability and to support the new environment variable format. My feedback includes a minor suggestion to improve code clarity.
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
Pull request overview
This pull request adds support for running tests with alternative IDEs (specifically "Antigravity") on GitHub Actions. The implementation allows specifying a bot name with a suffix (e.g., "dart-antigravity") to run tests against a different IDE instead of the default VS Code.
Changes:
- Added logic to parse IDE override from bot names with hyphen suffixes
- Added
whichpackage dependency to locate IDE executables in PATH - Added new bot configurations for
dart-antigravityanddart_debug-antigravity - Added GitHub Actions workflow steps to install Antigravity on Linux, macOS, and Windows
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
| src/test/test_all.ts | Added IDE override logic to parse bot names, resolve executable paths using which, and pass custom IDE executables to test runner; refactored bot filtering into shouldRunBot helper function |
| package.json | Added which@^6.0.1 and @types/which@^3.0.4 as dev dependencies |
| package-lock.json | Updated lock file with [email protected], @types/[email protected], and [email protected] dependencies |
| .github/workflows/build-and-test.yml | Added dart-antigravity and dart_debug-antigravity to bot matrix; added platform-specific Antigravity installation steps; updated step names from "Setup" to "Set up" |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # HACK: We can use: | ||
| # Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | ||
| # refreshenv | ||
| # To update PATH, but it goes to the `bin` folder and we want the .exe, so we just | ||
| # hard-code it for now. |
There was a problem hiding this comment.
The comment on line 100-104 mentions using Import-Module and refreshenv as a potential alternative, but notes it goes to the bin folder and "we want the .exe". However, this comment is somewhat unclear - it doesn't explain why going to the bin folder is a problem, or why the hardcoded path is preferred. Consider clarifying this comment to explain that refreshenv updates PATH to include the bin directory, but the actual executable is in a different location (the hardcoded path), which is why the hardcoded approach is necessary.
| # HACK: We can use: | |
| # Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
| # refreshenv | |
| # To update PATH, but it goes to the `bin` folder and we want the .exe, so we just | |
| # hard-code it for now. | |
| # HACK: We could instead do: | |
| # Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
| # refreshenv | |
| # which refreshes PATH so that the Chocolatey "bin" directory (with shims) is used. | |
| # However, here we need a stable, direct path to the actual Antigravity .exe for | |
| # ANTIGRAVITY_EXE, which is installed under Programs on the GitHub runner. For that | |
| # reason we hard-code the full .exe path instead of relying on the bin shim. |
| # HACK: We can use: | ||
| # Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | ||
| # refreshenv | ||
| # To update PATH, but it goes to the `bin` folder and we want the .exe, so we just | ||
| # hard-code it for now. | ||
| run: | | ||
| choco install antigravity --yes | ||
| "ANTIGRAVITY_EXE=C:\Users\runneradmin\AppData\Local\Programs\Antigravity\Antigravity.exe" >> $env:GITHUB_ENV |
There was a problem hiding this comment.
The hardcoded path C:\Users\runneradmin\AppData\Local\Programs\Antigravity\Antigravity.exe assumes a specific installation location that may not be stable across different Chocolatey versions or Antigravity package updates. If the installation path changes, the tests will fail. Consider using a more robust approach such as:
- Using PowerShell to query the actual installation path from the registry or Chocolatey
- Using
Get-Commandor similar to locate the executable - At minimum, add a validation step to verify the file exists before setting the environment variable
| # HACK: We can use: | |
| # Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | |
| # refreshenv | |
| # To update PATH, but it goes to the `bin` folder and we want the .exe, so we just | |
| # hard-code it for now. | |
| run: | | |
| choco install antigravity --yes | |
| "ANTIGRAVITY_EXE=C:\Users\runneradmin\AppData\Local\Programs\Antigravity\Antigravity.exe" >> $env:GITHUB_ENV | |
| # Install Antigravity and locate the actual executable path dynamically. | |
| run: | | |
| choco install antigravity --yes | |
| # Try to locate the Antigravity executable using PATH. | |
| $agyPath = Get-Command -Name Antigravity -CommandType Application -ErrorAction SilentlyContinue | | |
| Select-Object -First 1 -ExpandProperty Source | |
| # Fallback to the previous default path if Get-Command did not find anything. | |
| if (-not $agyPath) { | |
| $defaultPath = 'C:\Users\runneradmin\AppData\Local\Programs\Antigravity\Antigravity.exe' | |
| if (Test-Path $defaultPath) { | |
| $agyPath = $defaultPath | |
| } else { | |
| Write-Error "Could not locate Antigravity executable. Checked PATH and default location '$defaultPath'." | |
| exit 1 | |
| } | |
| } | |
| "ANTIGRAVITY_EXE=$agyPath" >> $env:GITHUB_ENV |
|
|
||
| try { | ||
| const res = await vstest.runTests({ | ||
| vscodeExecutablePath: ideOverride, |
There was a problem hiding this comment.
When ideOverride is undefined (i.e., when not using an IDE override), the code passes vscodeExecutablePath: undefined to vstest.runTests(). While this may be intentional and likely works correctly, it would be more explicit and maintainable to only include the vscodeExecutablePath property when it has a defined value. Consider using a conditional property assignment or object spread to only include this property when ideOverride is not undefined.
| if: matrix.bot != 'flutter_snap' && !startsWith(matrix.bot, 'dart') | ||
| uses: DanTup/gh-actions/setup-flutter@ca35b836161b1f7f8659345bad839ede5f4e3b94 | ||
| with: | ||
| channel: ${{ matrix.build-version }} | ||
|
|
||
| - name: Setup Dart ${{ matrix.build-version }} | ||
| - name: Set up Dart ${{ matrix.build-version }} | ||
| if: startsWith(matrix.bot, 'dart') || matrix.bot == 'misc' |
There was a problem hiding this comment.
The condition !startsWith(matrix.bot, 'dart') on line 112 will exclude dart-antigravity and dart_debug-antigravity from Flutter setup, which appears to be correct since these are Dart-only bots. However, the condition on line 118 startsWith(matrix.bot, 'dart') will include these bots for Dart setup, which is also correct. While the logic appears to work correctly, it would be clearer to document this behavior or add a comment explaining that bots starting with 'dart' (including 'dart-antigravity' and 'dart_debug-antigravity') should only use Dart, not Flutter. This is particularly important because the bot naming convention has changed to include hyphens, which might be confusing.
| function shouldRunBot(name: string) { | ||
| return !process.env.BOT || process.env.BOT === name || process.env.BOT.startsWith(`${name}-`); | ||
| } |
There was a problem hiding this comment.
The shouldRunBot function on line 128-130 is defined inside runAllTests(). Since this function is only used within runAllTests(), this is acceptable. However, for better testability and reusability, consider extracting this function to the module level. This would make it easier to test the bot filtering logic independently and potentially reuse it in other contexts.
| run: | | ||
| sudo mkdir -p /etc/apt/keyrings | ||
| curl -fsSL https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo gpg --dearmor --yes -o /etc/apt/keyrings/antigravity-repo-key.gpg | ||
| echo "deb [signed-by=/etc/apt/keyrings/antigravity-repo-key.gpg] https://us-central1-apt.pkg.dev/projects/antigravity-auto-updater-dev antigravity-debian main" | sudo tee /etc/apt/sources.list.d/antigravity.list | ||
| sudo apt-get update && sudo apt-get install antigravity -y |
There was a problem hiding this comment.
The Linux installation step uses us-central1-apt.pkg.dev without any error handling or verification. If the package repository is unavailable or if the antigravity package doesn't exist in the repository, the installation will fail. Consider adding verification steps after installation to ensure the package was installed successfully and that the antigravity executable is available in the PATH.
| run: | | |
| sudo mkdir -p /etc/apt/keyrings | |
| curl -fsSL https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo gpg --dearmor --yes -o /etc/apt/keyrings/antigravity-repo-key.gpg | |
| echo "deb [signed-by=/etc/apt/keyrings/antigravity-repo-key.gpg] https://us-central1-apt.pkg.dev/projects/antigravity-auto-updater-dev antigravity-debian main" | sudo tee /etc/apt/sources.list.d/antigravity.list | |
| sudo apt-get update && sudo apt-get install antigravity -y | |
| run: | | |
| set -euo pipefail | |
| sudo mkdir -p /etc/apt/keyrings | |
| curl -fsSL https://us-central1-apt.pkg.dev/doc/repo-signing-key.gpg | sudo gpg --dearmor --yes -o /etc/apt/keyrings/antigravity-repo-key.gpg | |
| echo "deb [signed-by=/etc/apt/keyrings/antigravity-repo-key.gpg] https://us-central1-apt.pkg.dev/projects/antigravity-auto-updater-dev antigravity-debian main" | sudo tee /etc/apt/sources.list.d/antigravity.list | |
| sudo apt-get update && sudo apt-get install antigravity -y | |
| if ! dpkg -s antigravity >/dev/null 2>&1; then | |
| echo "Error: 'antigravity' package does not appear to be installed after apt-get install." >&2 | |
| exit 1 | |
| fi | |
| if ! command -v agy >/dev/null 2>&1; then | |
| echo "Error: Antigravity executable 'agy' is not available on PATH after installation." >&2 | |
| exit 1 | |
| fi |
| run: | | ||
| brew install --cask antigravity | ||
| echo "$(dirname "$(command -v agy)")" >> "$GITHUB_PATH" | ||
| echo "ANTIGRAVITY_EXE=agy" >> "$GITHUB_ENV" |
There was a problem hiding this comment.
On line 94, the script adds the directory containing agy to the PATH, but on line 95 it sets ANTIGRAVITY_EXE=agy. This appears inconsistent with the logic in test_all.ts line 68, which expects ANTIGRAVITY_EXE to be either a full path or executable name. If agy is added to PATH on line 94, then the ANTIGRAVITY_EXE environment variable should be set to the full path to the executable (similar to Windows), or the executable name should match what's expected by the test code. The current implementation may work but creates an inconsistency between platforms where Windows uses a full path and macOS uses just the command name.
| echo "ANTIGRAVITY_EXE=agy" >> "$GITHUB_ENV" | |
| echo "ANTIGRAVITY_EXE=$(command -v agy)" >> "$GITHUB_ENV" |
6ed6082 to
f6b1289
Compare
f6b1289 to
b1b7dfb
Compare
No description provided.