Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/actions/build-data-workspace/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Build Data Workspace Extension
description: Builds the Data Workspace VS Code extension.
runs:
using: "composite"
steps:
- name: DataWorkspace - Install tools
shell: bash
run: |
echo "Installing Yarn"
npm install --global [email protected]
echo "Installing VSCE"
npm install --global [email protected]
- name: DataWorkspace - Install extension dependencies
shell: bash
run: |
cd ${{ inputs.source-dir }}
yarn --frozen-lockfile
- name: DataWorkspace - Build extension
shell: bash
run: |
cd ${{ inputs.source-dir }}
yarn build
inputs:
source-dir:
description: "The source directory to build"
required: false
default: "."
2 changes: 1 addition & 1 deletion .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Creates baseline artifacts (VSIX packages size metrics) that PRs can compare aga
### How it works
1. **Triggered automatically** on push to `main` or `release/*` branches
2. **Can be triggered manually** via workflow_dispatch for testing without pushing code
3. **Builds both extensions**: `mssql` and `sql-database-projects`
3. **Builds all extensions**: `mssql`, `sql-database-projects`, and `data-workspace`
4. **Packages them into VSIX files** and records their sizes in KB
5. **Uploads artifact** with 90-day retention:
- `baseline-sizes`: JSON file containing size metadata for comparisons (VSIX files themselves are not stored to save space)
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ jobs:
with:
source-dir: "./extensions/sql-database-projects"

- name: DataWorkspace - Install dependencies and build
uses: ./.github/actions/build-data-workspace
with:
source-dir: "./extensions/data-workspace"

- name: MSSQL - Run lint
run: |
cd ./extensions/mssql
Expand All @@ -97,6 +102,11 @@ jobs:
cd ./extensions/sql-database-projects
yarn lint src/ test/

- name: DataWorkspace - Run lint
run: |
cd ./extensions/data-workspace
yarn lint

# Calculate sizes and package before testing;
# Testing generates sourcemaps and instrumented code
# that increase size
Expand All @@ -112,6 +122,12 @@ jobs:
cd extensions/sql-database-projects
vsce package

- name: DataWorkspace - Package extension
continue-on-error: true
run: |
cd extensions/data-workspace
vsce package

- name: MSSQL - Upload VSIX files
uses: actions/upload-artifact@v4
with:
Expand All @@ -124,6 +140,12 @@ jobs:
name: sql-database-projects-vsix
path: ./extensions/sql-database-projects/*.vsix

- name: DataWorkspace - Upload VSIX files
uses: actions/upload-artifact@v4
with:
name: data-workspace-vsix
path: ./extensions/data-workspace/*.vsix

- name: Setting up change icons
if: env.should_compare_baseline == 'true'
run: |
Expand Down Expand Up @@ -211,6 +233,46 @@ jobs:
echo "sqlproj_vsix_change_icon=$no_change_icon" >> $GITHUB_ENV
fi

- name: Calculate data-workspace vsix file sizes
if: env.should_compare_baseline == 'true'
run: |
# Get baseline size from downloaded artifact or default to 0
if [ -f ./baseline/baseline-sizes.json ]; then
target_size=$(jq -r '.data_workspace.vsix_kb' ./baseline/baseline-sizes.json)
else
echo "⚠️ No baseline found, using 0 for comparison"
target_size=0
fi

pr_vsix=$(find ./extensions/data-workspace -name "*.vsix")
pr_size=$(stat -c%s "$pr_vsix")
pr_size=$((pr_size / 1024))

size_diff=$((pr_size - target_size))

if [ "$target_size" -gt 0 ]; then
percentage_change=$((100 * size_diff / target_size))
else
percentage_change=0
fi

echo "Baseline data-workspace VSIX size: $target_size KB"
echo "PR branch data-workspace VSIX size: $pr_size KB"
echo "Size difference: $size_diff KB"
echo "Percentage change: $percentage_change%"
echo "dataworkspace_target_vsix_size=$target_size" >> $GITHUB_ENV
echo "dataworkspace_pr_vsix_size=$pr_size" >> $GITHUB_ENV
echo "dataworkspace_vsix_size_diff=$size_diff" >> $GITHUB_ENV
echo "dataworkspace_vsix_percentage_change=$percentage_change" >> $GITHUB_ENV

if [ "$percentage_change" -gt 0 ]; then
echo "dataworkspace_vsix_change_icon=$worse_change_icon" >> $GITHUB_ENV
elif [ "$percentage_change" -lt 0 ]; then
echo "dataworkspace_vsix_change_icon=$better_change_icon" >> $GITHUB_ENV
else
echo "dataworkspace_vsix_change_icon=$no_change_icon" >> $GITHUB_ENV
fi

- name: MSSQL - Run unit tests
continue-on-error: true
run: |
Expand Down Expand Up @@ -333,6 +395,7 @@ jobs:
echo "|------------------------------|--------------------|-------------------|----------------------|" >> results.md
echo "| vscode-mssql VSIX | ${{ env.mssql_target_vsix_size }} KB | ${{ env.mssql_pr_vsix_size }} KB | ${{ env.mssql_vsix_change_icon }} ${{ env.mssql_vsix_size_diff }} KB ( ${{ env.mssql_vsix_percentage_change }}% ) |" >> results.md
echo "| sql-database-projects VSIX | ${{ env.sqlproj_target_vsix_size }} KB | ${{ env.sqlproj_pr_vsix_size }} KB | ${{ env.sqlproj_vsix_change_icon }} ${{ env.sqlproj_vsix_size_diff }} KB ( ${{ env.sqlproj_vsix_percentage_change }}% ) |" >> results.md
echo "| data-workspace VSIX | ${{ env.dataworkspace_target_vsix_size }} KB | ${{ env.dataworkspace_pr_vsix_size }} KB | ${{ env.dataworkspace_vsix_change_icon }} ${{ env.dataworkspace_vsix_size_diff }} KB ( ${{ env.dataworkspace_vsix_percentage_change }}% ) |" >> results.md

- name: Find comment
uses: peter-evans/find-comment@v3
Expand Down Expand Up @@ -363,6 +426,15 @@ jobs:
UNIT_EXIT_CODE=$?
echo "sqlproj_unit_tests_pr_exit_code=$UNIT_EXIT_CODE" >> $GITHUB_ENV

- name: DataWorkspace - Run unit tests
continue-on-error: true
run: |
set +e # Don't exit on errors
cd extensions/data-workspace
DISPLAY=:10 yarn test
UNIT_EXIT_CODE=$?
echo "dataworkspace_unit_tests_pr_exit_code=$UNIT_EXIT_CODE" >> $GITHUB_ENV

- name: Generate xliff files
run: |
yarn localization
Expand Down Expand Up @@ -392,6 +464,16 @@ jobs:
CHANGES_FOUND=true
fi

if ! git diff --quiet --exit-code ./localization/xliff/data-workspace.xlf; then
echo "Changes found in data-workspace.xlf"
CHANGES_FOUND=true
fi

if ! git diff --quiet --exit-code ./extensions/data-workspace/l10n/bundle.l10n.json; then
echo "Changes found in data-workspace bundle.l10n.json"
CHANGES_FOUND=true
fi

if [ "$CHANGES_FOUND" = "true" ]; then
echo "loc_update_required=true" >> $GITHUB_ENV
else
Expand Down Expand Up @@ -455,6 +537,12 @@ jobs:
# PIPELINE_FAILED=true # Don't fail for sqlproj unit tests yet; they aren't stable
fi

# Check DataWorkspace unit tests
if [ "${{ env.dataworkspace_unit_tests_pr_exit_code }}" != "0" ] && [ "${{ env.dataworkspace_unit_tests_pr_exit_code }}" != "" ]; then
echo " ⚠️ DataWorkspace unit tests failed with exit code ${{ env.dataworkspace_unit_tests_pr_exit_code }} (warning because tests not yet stablized)"
# PIPELINE_FAILED=true # Don't fail for dataworkspace unit tests yet; they aren't stable
fi

# Check MSSQL smoke tests
if [ "${{ env.mssql_smoke_tests_pr_exit_code }}" != "0" ] && [ "${{ env.mssql_smoke_tests_pr_exit_code }}" != "" ]; then
echo " ❌ MSSQL smoke tests failed with exit code ${{ env.mssql_smoke_tests_pr_exit_code }}"
Expand All @@ -473,6 +561,12 @@ jobs:
PIPELINE_FAILED=true
fi

# Check DataWorkspace VSIX percentage change (if variables exist)
if [ "${{ env.dataworkspace_vsix_percentage_change }}" != "" ] && [ $(echo "${{ env.dataworkspace_vsix_percentage_change }} > 5" | bc -l) -eq 1 ]; then
echo " ❌ DataWorkspace VSIX size increased by more than 5% (${{ env.dataworkspace_vsix_percentage_change }}%)"
PIPELINE_FAILED=true
fi

# Check localization
if [ "${{ env.loc_update_required }}" = "true" ]; then
echo " ❌ Updates to localized strings are required"
Expand Down
9 changes: 6 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/extensions/mssql",
"--extensionDevelopmentPath=${workspaceFolder}/extensions/sql-database-projects"
"--extensionDevelopmentPath=${workspaceFolder}/extensions/sql-database-projects",
"--extensionDevelopmentPath=${workspaceFolder}/extensions/data-workspace"
],
"outFiles": [
"${workspaceFolder}/extensions/mssql/out/**/*.js",
"${workspaceFolder}/extensions/sql-database-projects/out/**/*.js"
"${workspaceFolder}/extensions/sql-database-projects/out/**/*.js",
"${workspaceFolder}/extensions/data-workspace/out/**/*.js"
],
"sourceMaps": true,
"resolveSourceMapLocations": [
"${workspaceFolder}/extensions/mssql/dist/**",
"${workspaceFolder}/extensions/sql-database-projects/out/**"
"${workspaceFolder}/extensions/sql-database-projects/out/**",
"${workspaceFolder}/extensions/data-workspace/out/**"
],
"env": {
// Uncomment this to use a specified version of STS, see
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ See the [developer documentation](https://github.com/Microsoft/vscode-mssql/wiki
- `extensions/` - all of the individual VS Code extensions
- `extensions/mssql/` - Primary MSSQL extension that provides connection management, editors, and Copilot integration
- `extensions/sql-database-projects/` - SQL Database Projects extension focused on SQL project authoring, build, and publish experiences
- `extensions/data-workspace/` - Data Workspace extension providing project workspace management and coordination
- `typings/` - Shared `.d.ts` shims for first-party dependencies (azdata, dataworkspace, mssql, vscode-mssql)

## Prerequisites
Expand Down Expand Up @@ -369,6 +370,21 @@ yarn package # produces VSIX
yarn test # run unit tests; NOT CURRENTLY WORKING
```

### Data Workspace Extension (`extensions/data-workspace/`)

```bash
cd extensions/data-workspace

# Development
yarn # install extension dependencies
yarn watch # continuous build
yarn build # one-off full build
yarn package # produces VSIX

# Testing
yarn test # run unit tests
```

## Debugging From The Root Workspace

1. Open the repository root in VS Code.
Expand Down
4 changes: 3 additions & 1 deletion build/PullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ steps:

- template: ./templates/build-sql-database-projects.yml@self

- template: ./templates/build-data-workspace.yml@self

- task: PublishPipelineArtifact@1
displayName: Publish artifacts
inputs:
targetPath: "$(Build.ArtifactStagingDirectory)/vsix"
artifact: drop
artifact: drop
59 changes: 59 additions & 0 deletions build/templates/build-data-workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
steps:
- task: UseNode@1
displayName: "Use Node 22.x"
inputs:
version: 22.x

- pwsh: |
Write-Host "Installing Yarn"
npm install --global [email protected]
Write-Host "Installing VSCE"
npm install --global [email protected]
displayName: Install toolchain

- pwsh: |
yarn --frozen-lockfile
displayName: DataWorkspace - Install extension depedencies
workingDirectory: "$(Build.SourcesDirectory)/extensions/data-workspace"

- pwsh: |
yarn run build
displayName: DataWorkspace - Build extension
workingDirectory: "$(Build.SourcesDirectory)/extensions/data-workspace"

- pwsh: |
yarn lint
displayName: DataWorkspace - Lint code
workingDirectory: "$(Build.SourcesDirectory)/extensions/data-workspace"

- pwsh: |
yarn test
displayName: DataWorkspace - Run tests
workingDirectory: "$(Build.SourcesDirectory)/extensions/data-workspace"
continueOnError: true

- task: PublishTestResults@2
displayName: DataWorkspace - Publish test results
inputs:
testResultsFormat: "JUnit"
testResultsFiles: "$(Build.SourcesDirectory)/extensions/data-workspace/test-reports/test-results-ext.xml"
condition: succeededOrFailed()

- task: PublishCodeCoverageResults@2
displayName: DataWorkspace - Publish code coverage
inputs:
summaryFileLocation: "$(Build.SourcesDirectory)/extensions/data-workspace/coverage/cobertura-coverage.xml"
condition: succeededOrFailed()

- pwsh: |
yarn package
displayName: DataWorkspace - Package extension
workingDirectory: "$(Build.SourcesDirectory)/extensions/data-workspace"

# using CopyFiles to isolate all .vsix packages because PublishPipelineArtifact can't use wildcards
- task: CopyFiles@2
displayName: DataWorkspace - Copy VSIXs to clean folder
inputs:
SourceFolder: "$(Build.SourcesDirectory)/extensions/data-workspace"
Contents: "*.vsix"
TargetFolder: "$(Build.ArtifactStagingDirectory)/vsix"
17 changes: 17 additions & 0 deletions extensions/data-workspace/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"parserOptions": {
"project": "./extensions/data-workspace/tsconfig.json",
"createDefaultProgram": true
},
"rules": {
"@typescript-eslint/no-floating-promises": [
"error",
{
"ignoreVoid": true
}
],
// Disabled until the issues can be fixed
"@typescript-eslint/explicit-function-return-type": ["off"],
"@typescript-eslint/no-unsafe-assignment": "off"
}
}
20 changes: 20 additions & 0 deletions extensions/data-workspace/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// A launch configuration that compiles the extension and then opens it inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
]
}
]
}
9 changes: 9 additions & 0 deletions extensions/data-workspace/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
src
#out
tsconfig.json
.gitignore
coverage
coverConfig.json
extension.webpack.config.js
*.vsix
yarn.lock
Loading
Loading