Skip to content

uv servicetools cmd install #3

uv servicetools cmd install

uv servicetools cmd install #3

Workflow file for this run

# Main workflow name displayed in the Actions tab
name: "CI/CD: Build and Package Standalone Binaries"
on:
push:
branches:
- py311-fix # Runs test builds on this branch
tags:
- 'v*' # Triggers official release creation on version tags
workflow_dispatch: # Allows manual trigger from the GitHub Actions UI
jobs:
build:
# Dynamic job name to differentiate runners (Windows, Linux, macOS)
name: Build for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifact_name: mssql-cli-windows.exe
path_sep: ";"
- os: ubuntu-latest
artifact_name: mssql-cli-linux
path_sep: ":"
- os: macos-latest # macOS Sonoma (Apple Silicon ARM64)
artifact_name: mssql-cli-macos
path_sep: ":"
steps:
- uses: actions/checkout@v4
- name: Setup uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
uv pip install .
uv pip install pyinstaller requests future
- name: Install System Dependencies (macOS)
# Required for pyodbc to find unixodbc libraries on Apple Silicon
if: matrix.os == 'macos-latest'
run: brew install unixodbc
- name: Download binaries
# Executes the platform-specific logic to fetch .NET 8 binaries
run: uv run dev_setup.py
- name: PyInstaller Build
shell: bash
run: |
uv run pyinstaller --onefile --name "${{ matrix.artifact_name }}" \
--collect-all "mssqlcli" \
--add-data "mssqlcli/mssqltoolsservice/bin${{ matrix.path_sep }}mssqlcli/mssqltoolsservice/bin" \
--add-data "mssqlcli/packages/mssqlliterals/*.json${{ matrix.path_sep }}mssqlcli/packages/mssqlliterals" \
--hidden-import "pyodbc" \
mssqlcli/main.py
- name: Validate Binary Execution (${{ matrix.os }})
shell: bash
run: |
EXE_PATH="dist/${{ matrix.artifact_name }}"
chmod +x "$EXE_PATH"
echo "Testing binary version and engine initialization..."
"$EXE_PATH" --version
echo "Binary validation successful on ${{ matrix.os }}!"
- name: Create GitHub Release
# Only creates a public release if the push is a version tag (e.g., v1.1.0)
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: dist/${{ matrix.artifact_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}