Add build-tests and create-samples subcommands to azpysdk CLI
#1463
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Azure SDK Tools | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - "eng/tools/azure-sdk-tools/**" | |
| - ".github/workflows/azure-sdk-tools.yml" | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.13 | |
| - name: Install azure-sdk-tools | |
| run: | | |
| python -m pip install -e eng/tools/azure-sdk-tools[ghtools,conda] | |
| python -m pip freeze | |
| shell: bash | |
| - name: Run tests | |
| run: | | |
| pytest ./tests | |
| shell: bash | |
| working-directory: eng/tools/azure-sdk-tools | |
| static-analysis: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.13 | |
| - name: Install azure-sdk-tools | |
| run: | | |
| python -m pip install -e eng/tools/azure-sdk-tools[ghtools,conda] | |
| python -m pip install black==24.4.0 | |
| python -m pip freeze | |
| shell: bash | |
| - name: Run black | |
| run: | | |
| black --check --config eng/black-pyproject.toml eng/tools/azure-sdk-tools --exclude 'templates' | |
| shell: bash | |
| verify-azpysdk-checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: 3.13 | |
| - name: Install uv | |
| run: | | |
| curl -LsSf https://astral.sh/uv/install.sh | sh | |
| shell: bash | |
| - name: Install azure-sdk-tools on in global uv, discover azpysdk checks | |
| run: | | |
| uv pip install --system eng/tools/azure-sdk-tools[ghtools,conda,systemperf] | |
| # Discover available azpysdk commands from the {command1,command2,...} line in help output | |
| CHECKS=$(azpysdk -h 2>&1 | \ | |
| grep -oP '\{[^}]+\}' | \ | |
| tail -1 | \ | |
| tr -d '{}' | \ | |
| tr ',' '\n' | \ | |
| grep -v '^next-' | \ | |
| sort | \ | |
| paste -sd,) | |
| if [ -z "$CHECKS" ]; then | |
| echo "No azpysdk check modules discovered from azpysdk -h" >&2 | |
| exit 1 | |
| fi | |
| echo "Discovered azpysdk checks: $CHECKS" | |
| echo "AZPYSDK_CHECKS=$CHECKS" >> "$GITHUB_ENV" | |
| shell: bash | |
| - name: Run all discovered checks against azure-template using uv as package manager | |
| run: | | |
| sdk_build azure-template -d $(pwd)/wheels --build_id 20250101.1 | |
| python eng/scripts/dispatch_checks.py --checks "$AZPYSDK_CHECKS" --wheel_dir $(pwd)/wheels azure-template | |
| shell: bash | |
| env: | |
| TOX_PIP_IMPL: "uv" | |
| - name: Install azure-sdk-tools on global pip env | |
| run: | | |
| python -m pip install -e eng/tools/azure-sdk-tools[ghtools,conda] | |
| shell: bash | |
| - name: Run all discovered checks against azure-template using pip as package manager | |
| run: | | |
| python eng/scripts/dispatch_checks.py --checks "$AZPYSDK_CHECKS" --wheel_dir $(pwd)/wheels azure-template | |
| shell: bash | |
| env: | |
| TOX_PIP_IMPL: "pip" |