-
Notifications
You must be signed in to change notification settings - Fork 132
Add copilot-setup-steps.yml for GitHub Copilot Coding Agent #1662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
copilot-setup-steps.yml
file to the repo.
* The documentation for this file is located at https://docs.github.com/en/copilot/how-tos/agents/copilot-coding-agent/customizing-the-development-environment-for-copilot-coding-agent .
* Base the setup ...
copilot-setup-steps.yml
Outdated
- name: Set up development tools | ||
run: | | ||
# Install git hooks for automatic formatting (recommended) | ||
cargo xtask install-git-hooks --pre-push --with-fmt=yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not required, as long as the agent runs cargo xtask fmt --fix
before pushing changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the development tools setup step since the agent will run cargo xtask fmt --fix
before pushing changes. Fixed in commit 9c25f10.
copilot-setup-steps.yml
Outdated
- name: Verify installation | ||
run: | | ||
# Verify that Rust and required tools are installed | ||
rustc --version | ||
cargo --version | ||
|
||
# Check that required targets are installed | ||
rustup target list --installed | ||
|
||
# Run formatting checks to ensure environment is set up correctly | ||
cargo xtask fmt | ||
|
||
# Test that basic workspace check works | ||
cargo check --workspace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't particularly see the value in this. The agent will find that things fail if the environment is not set up correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the verification section as the agent will discover failures naturally if the environment isn't set up correctly. Fixed in commit 9c25f10.
…ication steps Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
copilot-setup-steps.yml
Outdated
# Install all required targets for OpenVMM cross-compilation | ||
rustup target add aarch64-apple-darwin | ||
rustup target add aarch64-unknown-linux-musl | ||
rustup target add x86_64-pc-windows-msvc | ||
rustup target add x86_64-unknown-linux-gnu | ||
rustup target add x86_64-unknown-linux-musl | ||
rustup target add x86_64-unknown-none |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep it simple. Don't cross compile, just add targets for the architecture that matches the cpu environment where the agent runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified the target installation to dynamically detect host architecture and only install the matching musl target. Fixed in commit 19b2ceb.
copilot-setup-steps.yml
Outdated
# Restore external dependencies required for building OpenVMM | ||
# This includes protoc (Protocol Buffers compiler), mu_msvm UEFI firmware, | ||
# test Linux kernels, and other build artifacts | ||
cargo xflowey restore-packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also install cargo-nextest
so that you can run unit tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added cargo-nextest installation step as requested. Fixed in commit d2abb45.
Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
@mattkur - I wonder if this should be a flowey pipeline, that way at least we could make sure we are installing the correct version of rust, for example. |
I think you mean: have CoPilot: give that suggestion a try. |
…ement Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
Implemented your suggestion! The copilot-setup-steps.yml file is now generated by flowey, ensuring it uses the correct Rust version (1.88.0) and cargo-nextest version (0.9.96) from flowey's version management system. The file is automatically regenerated during ... Yes, exactly! I implemented flowey generation of the YAML file. Created a new |
} | ||
} | ||
|
||
fn generate_copilot_setup_steps() -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be generated at .github/workflows/copilot-setup-steps.yml
, relative to the repo root.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed! The file is now generated at .github/workflows/copilot-setup-steps.yml
as requested. Changes in commit 68b67a0.
- name: Install system dependencies | ||
run: | | ||
# Update package lists | ||
sudo apt-get update | ||
|
||
# Install build dependencies required for OpenVMM | ||
sudo apt-get install -y \ | ||
binutils \ | ||
build-essential \ | ||
gcc-aarch64-linux-gnu \ | ||
libssl-dev \ | ||
pkg-config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Examine the existing CI pipelines for ways that they install dependencies. Update this pipeline to emit those steps instead of hard coding it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented! Extracted dependency installation patterns from existing CI pipelines including retry logic for apt-get commands, timeout handling, and proper package installation. The template now uses the same patterns as the bootstrap template. Changes in commit 68b67a0.
} | ||
|
||
fn generate_copilot_setup_steps() -> String { | ||
format!( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a template yml
file that sits in the repo, like gh_flowey_bootstrap_template.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Created copilot_setup_steps_template.yml
following the same pattern as gh_flowey_bootstrap_template.yml
with proper template processing and version replacement. Changes in commit 68b67a0.
…h, extract CI patterns Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
let header = r#"############################## | ||
# THIS FILE IS AUTOGENERATED # | ||
# DO NOT MANUALLY EDIT # | ||
############################## | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
"#; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Header should just be part of the template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Moved the copyright header from the Rust code into the template file itself. The header is now part of the template and gets included automatically.
flowey/flowey_cli/src/cli/regen.rs
Outdated
// Generate copilot-setup-steps.yml using flowey's version management | ||
// This ensures the file uses the correct Rust and tool versions | ||
let copilot_result = generate_copilot_setup_steps_file(repo_root); | ||
if copilot_result.is_err() { | ||
error = true; | ||
log::error!( | ||
"Failed to generate copilot-setup-steps.yml: {:?}", | ||
copilot_result | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than special casing this, make a few changes:
Modify .flowey.toml and add an [[pipeline.flowey_hvlite.github]]
entry. File should be ".github/workflows/copilot-setup-steps.yaml". Then, make sure you create the correct code such that the loop that starts at:
let mut error = false;
for ResolvedFloweyToml {
working_dir,
pipelines,
} in data
{
```
does not need modification, yet this new file is generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having trouble understanding how to implement this request. The github backend generates GitHub Actions workflows, but the copilot-setup-steps.yml file is not a workflow - it's a special format for GitHub Copilot's coding agent.
Could you clarify what you'd like me to do? Are you suggesting:
- Generate a GitHub workflow that creates the copilot setup file elsewhere?
- Modify the github backend to handle non-workflow files?
- Create a different approach entirely?
The current file format is just a YAML with steps:
for the Copilot agent, not a GitHub Actions workflow with jobs:
and runs-on:
etc.
Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
@benhillis , is this the direction you were thinking? |
# GitHub Copilot setup steps for OpenVMM development environment | ||
# Generated by flowey_hvlite - DO NOT EDIT MANUALLY | ||
|
||
steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# GitHub Copilot setup steps for OpenVMM development environment | |
# Generated by flowey_hvlite - DO NOT EDIT MANUALLY | |
steps: | |
# GitHub Copilot setup steps for OpenVMM development environment | |
# Generated by flowey_hvlite - DO NOT EDIT MANUALLY | |
name: "Copilot Setup Steps" | |
# Automatically run the setup steps when they are changed to allow for easy validation, and | |
# allow manual testing through the repository's "Actions" tab | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- .github/workflows/copilot-setup-steps.yml | |
pull_request: | |
paths: | |
- .github/workflows/copilot-setup-steps.yml | |
jobs: | |
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. | |
copilot-setup-steps: | |
runs-on: ubuntu-latest | |
# Set the permissions to the lowest permissions possible needed for your steps. | |
# Copilot will be given its own token for its operations. | |
permissions: | |
# If you want to clone the repository as part of your setup steps, for example to install dependencies, you'll need the `contents: read` permission. If you don't clone the repository in your setup steps, Copilot will do this for you automatically after the steps complete. | |
contents: read | |
steps: |
Also, fixup any indents below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transformed the copilot-setup-steps.yml file to proper GitHub Actions workflow format as requested. Added workflow structure with name, on triggers, jobs section, permissions, and proper indentation. The job is named "copilot-setup-steps" as required by Copilot. Fixed in commit 8ac4b9b.
…ormat Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
This PR adds a
copilot-setup-steps.yml
file to the repository root to help GitHub Copilot's Coding Agent understand how to set up the OpenVMM development environment.Background
As per the GitHub documentation, the
copilot-setup-steps.yml
file allows repositories to customize the development environment for GitHub Copilot's Coding Agent.Implementation
The setup steps are based on the existing
.devcontainer/devcontainer.json
configuration and the getting started documentation in theGuide/
folder. The file includes:1. Rust Installation with Required Targets
aarch64-apple-darwin
aarch64-unknown-linux-musl
x86_64-pc-windows-msvc
x86_64-unknown-linux-gnu
x86_64-unknown-linux-musl
x86_64-unknown-none
2. System Dependencies
binutils
build-essential
gcc-aarch64-linux-gnu
libssl-dev
pkg-config
3. OpenVMM Build Dependencies
cargo xflowey restore-packages
to fetch external dependencies like:4. Development Tools Setup
cargo xtask install-git-hooks --pre-push --with-fmt=yes
5. Installation Verification
cargo xtask fmt
cargo check --workspace
Testing
cargo xtask fmt
)The implementation is minimal and focused, directly addressing the requirements to provide GitHub Copilot's Coding Agent with the necessary setup instructions for OpenVMM development.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.