Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check python/django EOL and throw warnings #55

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,28 @@ jobs:
- name: Generate matrix from setup.py
id: set-matrix
run: |
set -x
python -c "from setup import GITHUB_MATRIX; print(GITHUB_MATRIX)" > matrix.json
echo "matrix=$(<matrix.json)" >> $GITHUB_OUTPUT
- name: Check version EOF
run: |
set -x
python -c "import json
from urllib.request import Request, urlopen
from datetime import date, datetime, timedelta
from itertools import chain, zip_longest
from setup import DJANGO_VERSIONS, PYTHON_VERSIONS
today = date.today()
WARNING_DAYS = timedelta(days=90)
versions = chain.from_iterable([zip_longest(['django'] * len(DJANGO_VERSIONS), DJANGO_VERSIONS), zip_longest(['python'] * len(PYTHON_VERSIONS), PYTHON_VERSIONS)])
for product, version in versions:
url = f'https://endoflife.date/api/{product}/{version}.json'
with urlopen(Request(url)) as httpresponse:
eol = json.loads(httpresponse.read())['eol']
eol_date = datetime.strptime(eol, '%Y-%m-%d').date()
if eol_date < today:
print(f'::error ::{product} v{version}: EOL was {eol}')
elif eol_date - today < WARNING_DAYS:
print(f'::warning ::{product} v{version}: EOL is coming up on the {eol}')"

tests:
runs-on: ubuntu-latest
Expand Down
Loading