Skip to content

Commit

Permalink
Improve sanity check, add boto3-stubs sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
vemel committed Dec 19, 2024
1 parent ab8732d commit ca6026e
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 59 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/aio_sanity_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,10 @@ jobs:
rm -rf mypy_boto3_output/*
uv run mypy_boto3_builder mypy_boto3_output \
--product aioboto3 aiobotocore \
--no-smart-version
- name: Install main packages
run: |
bash ./scripts/install_aiobotocore.sh main
--no-smart-version \
--download-static-stubs
- name: Check s3 output
run: |
rm -rf mypy_boto3_output/*
uv run mypy_boto3_builder mypy_boto3_output \
--product aiobotocore-services \
-s s3 \
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/sanity_boto3_stubs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: "Sanity: boto3-stubs"

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
inputs:
boto3_version:
description: Target boto3 version
required: false

jobs:
versions:
runs-on: ubuntu-latest
outputs:
boto3: ${{ steps.boto3.outputs.result }}
botocore: ${{ steps.botocore.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Extract boto3 version
id: boto3
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { getBoto3Version, setupGlobals } = require('./.github/workflows/helpers.js')
setupGlobals({ core, context, fetch })
const inputBoto3Version = context.payload.inputs && context.payload.inputs.boto3_version
const version = inputBoto3Version ? inputBoto3Version : await getBoto3Version()
core.notice(`boto3 version ${version}`)
return version
- name: Extract botocore version
id: botocore
uses: actions/github-script@v7
env:
BOTO3_VERSION: ${{ steps.boto3.outputs.result }}
with:
result-encoding: string
script: |
const { getBotocoreVersion } = require('./.github/workflows/helpers.js')
const version = getBotocoreVersion(process.env.BOTO3_VERSION)
core.notice(`botocore version ${version}`)
return version
sanity-check:
name: "Sanity: boto3-stubs"
runs-on: ubuntu-latest
needs: versions
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install the project
run: uv sync --extra check --dev
- name: Install boto3
env:
BOTO3_VERSION: ${{ needs.versions.outputs.boto3 }}
BOTOCORE_VERSION: ${{ needs.versions.outputs.botocore }}
run: |
uv pip install -U boto3==${BOTO3_VERSION} botocore==${BOTOCORE_VERSION}
- name: Build main packages
run: |
rm -rf mypy_boto3_output/*
uv run mypy_boto3_builder mypy_boto3_output \
--product boto3 \
--no-smart-version \
--download-static-stubs
- name: Check s3 output
run: |
uv run mypy_boto3_builder mypy_boto3_output \
--product boto3-services \
--no-smart-version \
-s s3
uv run ./scripts/check_output.py -p ./mypy_boto3_output s3
- name: Build packages
run: |
uv run mypy_boto3_builder mypy_boto3_output \
--product boto3-services \
--no-smart-version
- name: Check output
run: |
uv run ./scripts/check_output.py -p ./mypy_boto3_output
4 changes: 1 addition & 3 deletions .github/workflows/sanity_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,9 @@ jobs:
uv run mypy_boto3_builder mypy_boto3_output \
--product types-boto3 \
--no-smart-version \
--output-type wheel
python -m pip install mypy_boto3_output/*.whl
--download-static-stubs
- name: Check s3 output
run: |
rm -rf mypy_boto3_output/*
uv run mypy_boto3_builder mypy_boto3_output \
--product types-boto3-services \
--no-smart-version \
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
".venv": true,
".mypy_cache": true,
".pytest_cache": true,
".ruff_cache": true,
"**/.ruff_cache": true,
"*.egg-info": true,
"build": true,
"dist": true,
Expand Down
48 changes: 26 additions & 22 deletions scripts/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,28 +175,32 @@ def get_workflow(path: Path) -> Workflow | None:
"""
Get existing workflow paths.
"""
response = run_gh(
[
"run",
"list",
"--workflow",
path.as_posix(),
"--json",
"name",
"--json",
"status",
"--json",
"startedAt",
"--json",
"updatedAt",
"--json",
"headBranch",
"--json",
"name",
"--limit",
"1",
]
)
try:
response = run_gh(
[
"run",
"list",
"--workflow",
path.as_posix(),
"--json",
"name",
"--json",
"status",
"--json",
"startedAt",
"--json",
"updatedAt",
"--json",
"headBranch",
"--json",
"name",
"--limit",
"1",
]
)
except subprocess.CalledProcessError:
sys.stderr.write(f"Failed to get workflow {path}\n")
return None
response_json = json.loads(response)
if not response_json:
return None
Expand Down
8 changes: 0 additions & 8 deletions scripts/install_dev.sh

This file was deleted.

8 changes: 6 additions & 2 deletions scripts/open.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
set -e

NAME="${1:-boto3}"
echo "Opening $NAME"
exit 0

SITE_PACKAGES=`uv run python -c "import sys; import os; paths = filter(lambda x: x.startswith(os.getcwd()), sys.path); print(list(paths)[0])"`
echo "Site packages:" $SITE_PACKAGES
code $SITE_PACKAGES/botocore
echo "Site packages:" ${SITE_PACKAGES}
code ${SITE_PACKAGES}/${NAME}
6 changes: 0 additions & 6 deletions scripts/open_aioboto3.sh

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/open_aiobotocore.sh

This file was deleted.

6 changes: 0 additions & 6 deletions scripts/open_boto3.sh

This file was deleted.

0 comments on commit ca6026e

Please sign in to comment.