Skip to content

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 8, 2025

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 the Guide/ folder. The file includes:

1. Rust Installation with Required Targets

  • Installs Rust stable toolchain (as the project tracks latest stable)
  • Adds all cross-compilation targets needed for OpenVMM:
    • 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

  • Installs Ubuntu packages required for building OpenVMM:
    • binutils
    • build-essential
    • gcc-aarch64-linux-gnu
    • libssl-dev
    • pkg-config

3. OpenVMM Build Dependencies

  • Runs cargo xflowey restore-packages to fetch external dependencies like:
    • Protocol Buffers compiler (protoc)
    • mu_msvm UEFI firmware
    • Test Linux kernels
    • Other build artifacts

4. Development Tools Setup

  • Installs git hooks for automatic formatting using cargo xtask install-git-hooks --pre-push --with-fmt=yes

5. Installation Verification

  • Verifies Rust and cargo versions
  • Checks installed targets
  • Runs formatting checks with cargo xtask fmt
  • Performs basic workspace check with cargo check --workspace

Testing

  • ✅ YAML syntax validation passes
  • ✅ All repository formatting checks pass (cargo xtask fmt)
  • ✅ File structure matches expected format
  • ✅ Based on official devcontainer configuration
  • ✅ Follows OpenVMM development best practices

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.

Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] Add a 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 ... Add copilot-setup-steps.yml for GitHub Copilot Coding Agent Jul 8, 2025
@Copilot Copilot AI requested a review from mattkur July 8, 2025 18:23
Copilot finished work on behalf of mattkur July 8, 2025 18:23
Comment on lines 39 to 42
- name: Set up development tools
run: |
# Install git hooks for automatic formatting (recommended)
cargo xtask install-git-hooks --pre-push --with-fmt=yes
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines 44 to 57
- 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
Copy link
Contributor

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.

Copy link
Contributor Author

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 Copilot AI requested a review from mattkur July 8, 2025 18:47
Copilot finished work on behalf of mattkur July 8, 2025 18:47
@mattkur mattkur marked this pull request as ready for review July 8, 2025 18:47
@mattkur mattkur requested a review from a team as a code owner July 8, 2025 18:47
Comment on lines 14 to 20
# 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
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines 37 to 40
# 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
Copy link
Contributor

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.

Copy link
Contributor Author

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>
@Copilot Copilot AI requested a review from mattkur July 8, 2025 19:51
Copilot finished work on behalf of mattkur July 8, 2025 19:51
Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
Copilot finished work on behalf of mattkur July 8, 2025 19:59
@benhillis
Copy link
Member

@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.

@mattkur
Copy link
Contributor

mattkur commented Jul 8, 2025

@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 flowey generate this yaml, just like it generates other pipeline yaml files. Is that correct?

CoPilot: give that suggestion a try.

…ement

Co-authored-by: mattkur <13772048+mattkur@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jul 8, 2025

@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.

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 cargo xflowey regen and is clearly marked as autogenerated. Fixed in commit c194e8e.

...

Yes, exactly! I implemented flowey generation of the YAML file. Created a new copilot-setup-generator command that generates the file using flowey's version constants and integrated it into the regen process. The file now uses precise versions (Rust 1.88.0, cargo-nextest 0.9.96) managed by flowey rather than generic "stable" versions. Fixed in commit c194e8e.

Copilot finished work on behalf of mattkur July 8, 2025 21:20
}
}

fn generate_copilot_setup_steps() -> String {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines 50 to 61
- 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
Copy link
Contributor

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.

Copy link
Contributor Author

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!(
Copy link
Contributor

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

Copy link
Contributor Author

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>
@Copilot Copilot AI requested a review from a team as a code owner July 8, 2025 21:39
@Copilot Copilot AI requested a review from mattkur July 8, 2025 21:40
Copilot finished work on behalf of mattkur July 8, 2025 21:40
Comment on lines 29 to 36
let header = r#"##############################
# THIS FILE IS AUTOGENERATED #
# DO NOT MANUALLY EDIT #
##############################
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

"#;
Copy link
Contributor

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

Copy link
Contributor Author

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.

Comment on lines 103 to 113
// 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
);
}

Copy link
Contributor

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.

Copy link
Contributor Author

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:

  1. Generate a GitHub workflow that creates the copilot setup file elsewhere?
  2. Modify the github backend to handle non-workflow files?
  3. 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>
@Copilot Copilot AI requested a review from mattkur July 8, 2025 22:49
Copilot finished work on behalf of mattkur July 8, 2025 22:49
@mattkur
Copy link
Contributor

mattkur commented Jul 8, 2025

@benhillis , is this the direction you were thinking?

Comment on lines 8 to 11
# GitHub Copilot setup steps for OpenVMM development environment
# Generated by flowey_hvlite - DO NOT EDIT MANUALLY

steps:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# 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

Copy link
Contributor Author

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>
@Copilot Copilot AI requested a review from mattkur July 15, 2025 21:15
Copilot finished work on behalf of mattkur July 15, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants