Skip to content

Commit

Permalink
Build packages in isolated environment for release (#330)
Browse files Browse the repository at this point in the history
* Convert release to uv script

* Revert --no-project

* Isolate publish build scripts

* Update to astral-sh/setup-uv@v4

* Rework uv cache

* Use actions/setup-python for prereleases

* Build docs in isolated uv script

* Remove docs from git

* Use uvx for building packages

* Add debug to full package builds

* Fix all isolated builds --with

* Try sparce checkout

* Use actions/setup-python

* Update all CI scripts

* Revert matrix changes

* Rename publish jobs
  • Loading branch information
vemel authored Dec 9, 2024
1 parent db6a46c commit a0d3dad
Show file tree
Hide file tree
Showing 18 changed files with 155 additions and 343 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/aio_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install the project
Expand Down Expand Up @@ -60,9 +60,8 @@ jobs:
with:
python-version: ${{ matrix.version }}
allow-prereleases: true
cache: "pip"
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Check output
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/aio_sanity_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install the project
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install the project
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
python-version: ${{ matrix.version }}
allow-prereleases: true
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Check output
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: types-boto3 build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: types-boto3-full integration tests
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ jobs:
unit-tests:
name: Code style & unit tests
runs-on: ubuntu-latest
env:
UV_CACHE_DIR: /tmp/.uv-cache
strategy:
matrix:
version:
Expand All @@ -21,12 +19,13 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.version }}"
python-version: ${{ matrix.version }}
allow-prereleases: true
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
- name: Install the project
run: uv sync --extra check --dev
- name: Install extra dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on_push_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install the project
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/on_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ jobs:
- uses: actions/checkout@v4
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Get version
id: version
uses: actions/github-script@v7
Expand All @@ -30,8 +26,12 @@ jobs:
return context.payload.inputs.version
}
return context.ref.split('/').pop()
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install the project
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/on_release_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,13 @@ jobs:
with:
python-version-file: .python-version
- name: Set up uv
uses: astral-sh/setup-uv@v3
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install the project
run: uv sync --dev
- name: Install handsdown
run: |
uv run pip install -r requirements.mkdocs.txt
- name: Build docs
run: |
rm -rf docs/*
uv run mkdocs build
uvx --with-requirements requirements.mkdocs.txt mkdocs build
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
Expand Down
53 changes: 17 additions & 36 deletions .github/workflows/publish_aiobotocore_full.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Publish types-aiobotocore-full
concurrency: update_types_aiobotocore_full
concurrency: publish_types_aiobotocore_full

on:
schedule:
Expand Down Expand Up @@ -31,7 +31,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
aiobotocore: ${{ steps.aiobotocore.outputs.result }}
aiobotocore-url: ${{ steps.aiobotocore-url.outputs.result }}
version: ${{ steps.version.outputs.result }}
extra-flags: ${{ steps.extra-flags.outputs.result }}
steps:
Expand Down Expand Up @@ -100,63 +99,45 @@ jobs:
core.notice(`Extra flags = ${extraFlags}`)
return extraFlags.join(' ')
- name: Aiobotocore download URL
id: aiobotocore-url
if: steps.version.outputs.result
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js')
setupGlobals({ core, context, fetch })
const url = await getDownloadURL('aiobotocore', "${{ steps.aiobotocore.outputs.result }}")
core.notice(`aiobotocore download URL ${url}`)
return url
publish-types-aiobotocore:
name: Publish types-aiobotocore
publish:
name: Publish types-aiobotocore-full
runs-on: ubuntu-latest
needs: versions
if: needs.versions.outputs.version
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts/release.py
.python-version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Install builder
run: |
rm -rf mypy_boto3_builder
python -m pip install mypy_boto3_builder
- name: Install aiobotocore
run: |
mkdir installtemp
cd installtemp
wget ${{ needs.versions.outputs.aiobotocore-url }}
pip uninstall -y s3transfer
pip install aiobotocore*.whl s3transfer
cd ..
rm -rf installtemp
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Build
env:
VERSION: ${{ needs.versions.outputs.version }}
EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }}
AIOBOTOCORE_VERSION: ${{ needs.versions.outputs.aiobotocore }}
run: |
rm -rf mypy_boto3_output/*
echo "Building"
python -m mypy_boto3_builder mypy_boto3_output \
uvx \
--no-cache \
--with aiobotocore==${AIOBOTOCORE_VERSION} \
mypy_boto3_builder mypy_boto3_output \
-b ${VERSION} \
--product aiobotocore-full \
${EXTRA_FLAGS} \
--download-static-stubs \
-s all -d
- name: Install dependencies for publishing
run: |
python -m pip install setuptools wheel twine
- name: Publish to PyPI
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python ./scripts/release.py
uv run --no-project ./scripts/release.py
50 changes: 15 additions & 35 deletions .github/workflows/publish_aiobotocore_stubs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Publish types-aiobotocore
concurrency: update_types_aiobotocore
concurrency: publish_types_aiobotocore

on:
schedule:
Expand Down Expand Up @@ -36,7 +36,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
aiobotocore: ${{ steps.aiobotocore.outputs.result }}
aiobotocore-url: ${{ steps.aiobotocore-url.outputs.result }}
version: ${{ steps.version.outputs.result }}
extra-flags: ${{ steps.extra-flags.outputs.result }}
steps:
Expand Down Expand Up @@ -107,63 +106,44 @@ jobs:
core.notice(`Extra flags = ${extraFlags}`)
return extraFlags.join(' ')
- name: Aiobotocore download URL
id: aiobotocore-url
if: steps.version.outputs.result
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { getDownloadURL, setupGlobals } = require('./.github/workflows/helpers.js')
setupGlobals({ core, context, fetch })
const url = await getDownloadURL('aiobotocore', "${{ steps.aiobotocore.outputs.result }}")
core.notice(`aiobotocore download URL ${url}`)
return url
publish-types-aiobotocore:
publish:
name: Publish types-aiobotocore
runs-on: ubuntu-latest
needs: versions
if: needs.versions.outputs.version
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
scripts/release.py
.python-version
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: .python-version
- name: Install builder
run: |
rm -rf mypy_boto3_builder
python -m pip install mypy_boto3_builder
- name: Install aiobotocore
run: |
mkdir installtemp
cd installtemp
wget ${{ needs.versions.outputs.aiobotocore-url }}
pip uninstall -y s3transfer
pip install aiobotocore*.whl s3transfer
cd ..
rm -rf installtemp
- name: Set up uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Build all packages
env:
VERSION: ${{ needs.versions.outputs.version }}
EXTRA_FLAGS: ${{ needs.versions.outputs.extra-flags }}
AIOBOTOCORE_VERSION: ${{ needs.versions.outputs.aiobotocore }}
run: |
rm -rf mypy_boto3_output/*
echo "Building all packages"
python -m mypy_boto3_builder mypy_boto3_output \
uvx \
--with aiobotocore==${AIOBOTOCORE_VERSION} \
mypy_boto3_builder mypy_boto3_output \
-b ${VERSION} \
--product aiobotocore aiobotocore-lite aiobotocore-services \
${EXTRA_FLAGS} \
--download-static-stubs \
-s all -d
- name: Install dependencies for publishing
run: |
python -m pip install setuptools wheel twine
- name: Publish to PyPI
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python ./scripts/release.py
uv run --no-project ./scripts/release.py
Loading

0 comments on commit a0d3dad

Please sign in to comment.