-
Notifications
You must be signed in to change notification settings - Fork 133
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?
Changes from 6 commits
31c3c96
97e11e2
9c25f10
22b8382
d2abb45
c194e8e
68b67a0
8fae204
fedeea8
790779a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
############################## | ||
# THIS FILE IS AUTOGENERATED # | ||
# DO NOT MANUALLY EDIT # | ||
############################## | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# GitHub Copilot setup steps for OpenVMM development environment | ||
# Generated by flowey_hvlite - DO NOT EDIT MANUALLY | ||
|
||
steps: | ||
- name: Install Rust with required targets | ||
run: | | ||
# Install Rust using rustup (version managed by flowey) | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.88.0 | ||
source ~/.cargo/env | ||
|
||
# Install targets for the host architecture | ||
ARCH=$(uname -m) | ||
if [ "$ARCH" = "x86_64" ]; then | ||
rustup target add x86_64-unknown-linux-musl | ||
elif [ "$ARCH" = "aarch64" ]; then | ||
rustup target add aarch64-unknown-linux-musl | ||
fi | ||
|
||
- 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 | ||
|
||
- name: Restore OpenVMM build dependencies | ||
run: | | ||
# 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 | ||
|
||
# Install cargo-nextest for running unit tests (version managed by flowey) | ||
cargo install cargo-nextest --version 0.9.96 --locked |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,6 +100,17 @@ impl Regen { | |
} | ||
} | ||
|
||
// 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 commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
The current file format is just a YAML with |
||
if error { | ||
anyhow::bail!("encountered one or more errors") | ||
} | ||
|
@@ -197,3 +208,18 @@ fn install_flowey_merge_driver() -> anyhow::Result<()> { | |
|
||
Ok(()) | ||
} | ||
|
||
fn generate_copilot_setup_steps_file(repo_root: &Path) -> anyhow::Result<()> { | ||
// Run the copilot setup generator command | ||
let sh = xshell::Shell::new()?; | ||
sh.change_dir(repo_root); | ||
xshell::cmd!( | ||
sh, | ||
"cargo run -p flowey_hvlite -- pipeline run copilot-setup-generator" | ||
) | ||
.quiet() | ||
.run()?; | ||
|
||
log::info!("Generated copilot-setup-steps.yml"); | ||
Ok(()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
use anyhow::Result; | ||
|
||
/// Generate copilot-setup-steps.yml for GitHub Copilot Coding Agent | ||
#[derive(clap::Args)] | ||
pub struct CopilotSetupGeneratorCli {} | ||
|
||
impl CopilotSetupGeneratorCli { | ||
pub fn run(self, repo_root: &std::path::Path) -> Result<()> { | ||
let output_file = repo_root.join("copilot-setup-steps.yml"); | ||
|
||
let content = generate_copilot_setup_steps(); | ||
|
||
std::fs::write(&output_file, content)?; | ||
|
||
println!("Generated copilot-setup-steps.yml"); | ||
Ok(()) | ||
} | ||
} | ||
|
||
fn generate_copilot_setup_steps() -> String { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should be generated at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! The file is now generated at |
||
format!( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a template There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! Created |
||
r#"############################## | ||
# THIS FILE IS AUTOGENERATED # | ||
# DO NOT MANUALLY EDIT # | ||
############################## | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
|
||
# GitHub Copilot setup steps for OpenVMM development environment | ||
# Generated by flowey_hvlite - DO NOT EDIT MANUALLY | ||
|
||
steps: | ||
- name: Install Rust with required targets | ||
run: | | ||
# Install Rust using rustup (version managed by flowey) | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain {rust_version} | ||
source ~/.cargo/env | ||
|
||
# Install targets for the host architecture | ||
ARCH=$(uname -m) | ||
if [ "$ARCH" = "x86_64" ]; then | ||
rustup target add x86_64-unknown-linux-musl | ||
elif [ "$ARCH" = "aarch64" ]; then | ||
rustup target add aarch64-unknown-linux-musl | ||
fi | ||
|
||
- 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 commentThe 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 commentThe 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. |
||
|
||
- name: Restore OpenVMM build dependencies | ||
run: | | ||
# 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 | ||
|
||
# Install cargo-nextest for running unit tests (version managed by flowey) | ||
cargo install cargo-nextest --version {nextest_version} --locked | ||
"#, | ||
rust_version = flowey_lib_hvlite::_jobs::cfg_versions::RUSTUP_TOOLCHAIN, | ||
nextest_version = flowey_lib_hvlite::_jobs::cfg_versions::NEXTEST | ||
) | ||
} |
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.