Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
quinna-h committed Dec 17, 2024
1 parent 15d6bd8 commit 9bf9371
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 8 deletions.
126 changes: 126 additions & 0 deletions .github/workflows/generate-supported-versions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Generate Package Versions

on:
workflow_dispatch: # can be triggered manually
push:
branches:
- quinna.halim/add-supported-versions-json # TODO: remove, for testing

jobs:
generate-supported-versions:
name: Generate supported versions table
runs-on: ubuntu-22.04
permissions:
actions: read
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Python 3.7
uses: actions/setup-python@v5
with:
python-version: "3.7"

- name: Setup Python 3.8
uses: actions/setup-python@v5
with:
python-version: "3.8"

- name: Setup Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Setup Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Setup Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libmariadb-dev
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install packaging
pip install requests
pip install riot==0.20.1
pip install wrapt==1.16.0
- uses: actions/checkout@v4
with:
persist-credentials: false
path: ddtrace

- name: Install ddtrace
run: |
pip install ./ddtrace
- uses: actions/checkout@v4
with:
persist-credentials: false

- run: python scripts/freshvenvs.py generate

- name: Generate table
run: python scripts/generate_table.py

- run: git diff

- name: Create Pull Request
id: pr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: "upgrade-supported-versions"
commit-message: "Update supported versions table"
delete-branch: true
base: main
title: "chore: update supported versions"
labels: changelog/no-changelog
body: |
Update the supported versions table.
## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
## Reviewer Checklist
- [ ] Reviewer has checked that all the criteria below are met
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
16 changes: 9 additions & 7 deletions scripts/freshvenvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def _get_version_bounds(packages) -> dict:
bounds[package] = (earliest, latest)
return bounds

def output_package_versions(all_required_packages, envs, bounds):
def output_outdated_packages(all_required_packages, envs, bounds):
for package in all_required_packages:
earliest, latest = _get_version_extremes(package)
bounds[package] = (earliest, latest)
Expand All @@ -251,10 +251,7 @@ def output_package_versions(all_required_packages, envs, bounds):
if not ordered:
continue
if not _versions_fully_cover_bounds(bounds[package], ordered):
print(
f"{package}: policy supports version {bounds[package][0]} through {bounds[package][1]} "
f"but only these versions are used: {[str(v) for v in ordered]}"
)
print(f"{package}")

def generate_supported_versions(contrib_packages, all_used_versions, patched):
for mod in mapping_module_to_package:
Expand Down Expand Up @@ -297,8 +294,13 @@ def main():
all_used_versions = _get_all_used_versions(envs, contrib_packages)
bounds = _get_version_bounds(contrib_packages)

output_package_versions(all_required_packages, envs, bounds)
generate_supported_versions(contrib_packages, all_used_versions, patched)
if len(sys.argv) != 2:
print("usage: python scripts/freshvenvs.py <output> or <generate>")
return
if sys.argv[1] == "output":
output_outdated_packages(all_required_packages, envs, bounds)
if sys.argv[1] == "generate":
generate_supported_versions(contrib_packages, all_used_versions, patched)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion scripts/regenerate-riot-latest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e

DDTEST_CMD=scripts/ddtest

pkgs=$(python scripts/freshvenvs.py | cut -d':' -f1)
pkgs=$(python scripts/freshvenvs.py output)
echo $pkgs

if ! $DDTEST_CMD; then
Expand Down

0 comments on commit 9bf9371

Please sign in to comment.