-
Notifications
You must be signed in to change notification settings - Fork 298
Add GitHub workflow for Copilot coding agent environment setup using pre-built container #2832
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 8 commits
0bda399
506092f
26824d5
dd05c69
b5d21e4
db114c1
0655f09
7b5fd4c
bd9b965
111d910
b81f597
93ea99c
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,115 @@ | ||
name: Copilot Environment Setup | ||
|
||
# This workflow sets up the development environment for GitHub Copilot coding agent | ||
# It leverages the existing devcontainer configuration to ensure consistency | ||
# with the development environment and avoid duplication of tooling setup | ||
# | ||
# The workflow: | ||
# - Uses the same base container image as the devcontainer (mcr.microsoft.com/devcontainers/rust) | ||
# - Runs the devcontainer post-create script for environment setup | ||
# - Installs the same development tools specified in the devcontainer | ||
# - Caches Cargo dependencies for improved performance | ||
# - Runs comprehensive workspace verification (check, clippy, fmt) | ||
# - Tests basic functionality to ensure the environment is ready | ||
# | ||
# This approach maintains consistency with the existing devcontainer setup | ||
# and avoids maintaining duplicate tool installation logic | ||
# | ||
# Triggers: | ||
# - Manual execution via workflow_dispatch | ||
# - Weekly scheduled runs to keep environment fresh | ||
# - Automatic runs when key configuration files change | ||
|
||
on: | ||
workflow_dispatch: # Allow manual triggering | ||
schedule: | ||
# Run weekly to keep the environment fresh | ||
- cron: '0 2 * * 1' # Monday at 2 AM UTC | ||
push: | ||
branches: [main] | ||
paths: | ||
- 'rust-toolchain.toml' | ||
- 'Cargo.toml' | ||
- '.devcontainer/**' | ||
- '.github/workflows/copilot-setup-steps.yml' | ||
|
||
jobs: | ||
setup-environment: | ||
name: Setup Copilot Coding Agent Environment | ||
runs-on: ubuntu-latest | ||
container: | ||
image: mcr.microsoft.com/devcontainers/rust:1-1-bullseye | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup development environment using devcontainer configuration | ||
run: | | ||
# Run the devcontainer post-create script to set up additional toolchains | ||
chmod +x .devcontainer/oncreate | ||
./.devcontainer/oncreate | ||
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. @copilot because the devcontainer image has everything we need already, you don't need this step. 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. Removed the devcontainer setup step as the pre-built image already contains all necessary dependencies. (93ea99c) |
||
|
||
- name: Install additional tools for Azure SDK development | ||
run: | | ||
# Install tools commonly needed for Rust development and Azure SDK | ||
# Note: cargo-watch and http-server are already installed in the container | ||
cargo install cargo-audit || echo "cargo-audit already installed or failed to install" | ||
cargo install cargo-outdated || echo "cargo-outdated already installed or failed to install" | ||
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. @copilot don't install these tools. We'll install them in the base image if needed. Suitably, don't verify them below. 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. Removed cargo-audit and cargo-outdated installation and their verification from the environment summary. The workflow now relies entirely on tools pre-installed in the base image. (93ea99c) |
||
|
||
- name: Cache Cargo dependencies | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
|
||
- name: Verify workspace setup | ||
run: | | ||
# Verify the workspace can be built | ||
cargo check --workspace --all-targets | ||
|
||
# Run basic linting | ||
cargo clippy --workspace --all-targets -- -D warnings | ||
|
||
# Check formatting | ||
cargo fmt --all -- --check | ||
|
||
- name: Setup environment variables | ||
run: | | ||
echo "RUST_BACKTRACE=1" >> $GITHUB_ENV | ||
echo "CARGO_TERM_COLOR=always" >> $GITHUB_ENV | ||
echo "RUSTFLAGS=-D warnings" >> $GITHUB_ENV | ||
|
||
- name: Test basic functionality | ||
run: | | ||
# Test that we can run basic cargo commands | ||
cargo --version | ||
cargo tree --workspace | head -20 | ||
|
||
# Verify that tests can be discovered | ||
cargo test --workspace --no-run | ||
|
||
- name: Environment summary | ||
run: | | ||
echo "=== Rust Environment Summary ===" | ||
rustc --version | ||
cargo --version | ||
echo "=== Installed Components ===" | ||
rustup component list --installed | ||
echo "=== Available Tools ===" | ||
which cargo-audit && cargo-audit --version || echo "cargo-audit not available" | ||
which cargo-outdated && cargo-outdated --version || echo "cargo-outdated not available" | ||
which cargo-watch && cargo-watch --version || echo "cargo-watch not available" | ||
which http-server && http-server --version || echo "http-server not available" | ||
echo "=== System Dependencies ===" | ||
openssl version | ||
pkg-config --exists openssl && echo "OpenSSL pkg-config: OK" || echo "OpenSSL pkg-config: NOT FOUND" | ||
echo "=== Workspace Structure ===" | ||
find . -name "Cargo.toml" | head -10 | ||
echo "=== Environment Ready for Copilot Coding Agent ===" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
"cppvsdbg", | ||
"datalake", | ||
"datetime", | ||
"devcontainers", | ||
"devicecode", | ||
"docsrs", | ||
"doctest", | ||
|
@@ -59,6 +60,7 @@ | |
"msrv", | ||
"newtonsoft", | ||
"oidc", | ||
"oncreate", | ||
"otel", | ||
"opentelemetry", | ||
"pageable", | ||
|
@@ -153,6 +155,12 @@ | |
"rust-custom" | ||
] | ||
}, | ||
{ | ||
"filename": ".github/workflows/*.yml", | ||
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. @copilot, just ignore this path instead. Remove this block and add the path to 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. Moved GitHub workflow files to |
||
"dictionaries": [ | ||
"rust-custom" | ||
] | ||
}, | ||
{ | ||
"filename": "sdk/core/azure_core_amqp/**", | ||
"dictionaries": [ | ||
|
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.
@copilot use the image heaths/azure-sdk-for-rust:latest from Docker Hub instead. This will have all the dependencies needed already installed, built from the devcontainer CLI.
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.
@copilot you should also add a volume mapping for the current repo into /workspaces/azure-sdk-for-rust in the container, and make sure all subsequent commands and work happen within that folder in the container.
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.
Updated the workflow to use
heaths/azure-sdk-for-rust:latest
container with volume mapping to/workspaces/azure-sdk-for-rust
and working directory set correctly. All subsequent commands now run in the proper workspace location as requested. (93ea99c)