Skip to content

Commit c03c7ea

Browse files
authored
Add Github Copilot setup steps for SQL Server (#37496)
1 parent d52eb38 commit c03c7ea

2 files changed

Lines changed: 60 additions & 1 deletion

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Based on https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment
4+
5+
# Automatically run the setup steps when they are changed to allow for easy validation, and
6+
# allow manual testing through the repository's "Actions" tab
7+
on:
8+
workflow_dispatch:
9+
push:
10+
paths:
11+
- .github/workflows/copilot-setup-steps.yml
12+
pull_request:
13+
paths:
14+
- .github/workflows/copilot-setup-steps.yml
15+
16+
jobs:
17+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
18+
copilot-setup-steps:
19+
runs-on: ubuntu-latest
20+
21+
# Install SQL Server via a docker container.
22+
# It's better to do this rather than e.g. use a testcontainer, because then the agent can reuse the same container
23+
# and instance of SQL Server rather than have to start it up each time it needs to iterate and run a test.
24+
services:
25+
mssql:
26+
image: mcr.microsoft.com/mssql/server:2025-latest
27+
env:
28+
ACCEPT_EULA: "Y"
29+
SA_PASSWORD: ${{ secrets.MSSQL_SA_PASSWORD }}
30+
ports:
31+
- 1433:1433
32+
options: >-
33+
--health-cmd="/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P \$SA_PASSWORD -Q \"SELECT 1\" -C"
34+
--health-start-period=20s
35+
--health-interval=2s
36+
--health-retries=30
37+
--health-timeout=5s
38+
39+
permissions:
40+
contents: read
41+
42+
# You can define any steps you want, and they will run before the agent starts.
43+
# If you do not check out your code, Copilot will do this for you.
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v5
47+
48+
- name: Restore
49+
run: ./restore.sh
50+
51+
- name: Export SQL Server connection string for the agent's session
52+
run: echo "Test__SqlServer__DefaultConnection=Server=localhost;Database=master;User=SA;Password=${{ secrets.MSSQL_SA_PASSWORD }};Connect Timeout=60;ConnectRetryCount=0;Trust Server Certificate=true" >> "$GITHUB_ENV"

EFCore.slnx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Solution>
22
<Folder Name="/Solution Items/">
33
<File Path=".editorconfig" />
4-
<File Path=".github/copilot-instructions.md" />
54
<File Path="azure-pipelines-internal-tests.yml" />
65
<File Path="azure-pipelines-public.yml" />
76
<File Path="azure-pipelines.yml" />
@@ -13,6 +12,14 @@
1312
<File Path="NuGet.config" />
1413
<File Path="tools/Resources.tt" />
1514
</Folder>
15+
<Folder Name="/.github/">
16+
<File Path=".github/copilot-instructions.md" />
17+
</Folder>
18+
<Folder Name="/.github/workflows/">
19+
<File Path=".github/workflows/copilot-setup-steps.yml" />
20+
<File Path=".github/workflows/inter-branch-merge-flow.yml" />
21+
<File Path=".github/workflows/TestCosmos.yaml" />
22+
</Folder>
1623
<Folder Name="/src/">
1724
<File Path="src/Directory.Build.props" />
1825
<Project Path="src/dotnet-ef/dotnet-ef.csproj" />

0 commit comments

Comments
 (0)