-
Notifications
You must be signed in to change notification settings - Fork 319
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 all commits
1f28f4a
0185e31
28d6d8a
431170c
85c529c
9b0c1fa
da5f65d
a92ad2f
0d561f7
1d0a994
0baa882
7589aab
cefa915
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 Setup Steps | ||
|
|
||
| # This workflow sets up the development environment for GitHub Copilot coding agent | ||
| # It uses a pre-built container image with all the necessary tools already installed | ||
| # | ||
| # The workflow: | ||
| # - Uses the heaths/azure-sdk-for-rust:latest container image with all dependencies | ||
| # - Maps the repository into the standard devcontainer workspace location | ||
| # - Caches Cargo dependencies for improved performance | ||
| # - Runs comprehensive workspace verification (check, clippy, fmt) | ||
| # - Tests basic functionality to ensure the environment is ready | ||
| # | ||
| # This approach leverages a pre-built image that contains all the tools from | ||
| # the devcontainer configuration, avoiding the need to install tools at runtime | ||
| # | ||
| # 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' | ||
| pull_request: | ||
| paths: | ||
| - 'rust-toolchain.toml' | ||
| - 'Cargo.toml' | ||
| - '.devcontainer/**' | ||
| - '.github/workflows/copilot-setup-steps.yml' | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
|
|
||
| jobs: | ||
| copilot-setup-steps: | ||
| name: Setup Copilot Coding Agent Environment | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| contents: read | ||
| environment: Copilot | ||
| container: | ||
| image: heaths/azure-sdk-for-rust:latest | ||
|
Member
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. @heaths I assume this was only for testing? We shouldn't depend on images from forks.
Member
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. @RickWinter @weshaggard That's an image name i.e., on Docker Hub. If you want to build and publish a docker image fine, but I'm not aware of any capabilities we have atm.
Member
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. Or we can skip building an image and let copilot spend a long time installing tools every time you ask it to do something. The base images I looked at are lacking a lot.
Member
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. So, did you publish that image on DockerHub? If we end up needing an image we will likely need to use one from MCR, so we will likely need to publish one there.
Member
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. Yes, it's at https://hub.docker.com/r/heaths/azure-sdk-for-rust. I didn't expect we'd use this long-term, but I'm also not sure on the procedure for building our own team images. The problem I was trying to solve is not having duplicate container definitions for Codespaces and GitHub Copilot. They practically need the same things. It's bad enough I already have to duplicate recommended extensions and never figured out a great way to solve that problem so that the container is built with recommended extensions. Even if we assume the agent doesn't need any current recommended extensions (none of them currently install MCPs), having a consistent base image and other tools that both devs and automation need is a burden if duplicated. |
||
| volumes: | ||
| - ${{ github.workspace }}:/workspaces/azure-sdk-for-rust | ||
| options: --workdir /workspaces/azure-sdk-for-rust | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - 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-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 ===" | ||
Uh oh!
There was an error while loading. Please reload this page.