CI: hotfix last version (#14627)

LooseVersion was not correctly evaluation RC and set it as last even though the full release is out...
This commit is contained in:
Jirka Borovec 2022-09-09 20:38:03 +02:00 committed by GitHub
parent b84c03f3a6
commit 7cbf153332
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 10 deletions

View File

@ -1,6 +1,7 @@
import datetime import datetime
import glob import glob
import json import json
import logging
import os import os
import re import re
import shutil import shutil
@ -16,6 +17,7 @@ from urllib.request import Request, urlopen
import fire import fire
import pkg_resources import pkg_resources
from packaging.version import parse as version_parse
REQUIREMENT_FILES = { REQUIREMENT_FILES = {
"pytorch": ( "pytorch": (
@ -123,7 +125,9 @@ class AssistantCLI:
data = json.load(urlopen(Request(url))) data = json.load(urlopen(Request(url)))
if not version: if not version:
versions = list(data["releases"].keys()) versions = list(data["releases"].keys())
version = sorted(versions, key=LooseVersion)[-1] versions = sorted(versions, key=lambda x: version_parse(x))
logging.debug(f"Available versions: {versions}")
version = versions[-1]
releases = list(filter(lambda r: r["packagetype"] == "sdist", data["releases"][version])) releases = list(filter(lambda r: r["packagetype"] == "sdist", data["releases"][version]))
assert releases, f"Missing 'sdist' for this package/version aka {package}/{version}" assert releases, f"Missing 'sdist' for this package/version aka {package}/{version}"
release = releases[0] release = releases[0]
@ -131,6 +135,7 @@ class AssistantCLI:
pkg_file = os.path.basename(pkg_url) pkg_file = os.path.basename(pkg_url)
pkg_path = os.path.join(folder, pkg_file) pkg_path = os.path.join(folder, pkg_file)
os.makedirs(folder, exist_ok=True) os.makedirs(folder, exist_ok=True)
print(f"downloading: {pkg_url}")
request.urlretrieve(pkg_url, pkg_path) request.urlretrieve(pkg_url, pkg_path)
@staticmethod @staticmethod

View File

@ -0,0 +1,3 @@
fire
packaging
requests

View File

@ -60,7 +60,7 @@ jobs:
set -e set -e
pip --version pip --version
sudo pip uninstall -y lightning pytorch-lightning sudo pip uninstall -y lightning pytorch-lightning
pip install fire pip install -q -r .actions/requirements.txt
python .actions/assistant.py requirements-prune-pkgs torch,torchvision python .actions/assistant.py requirements-prune-pkgs torch,torchvision
pip install ".[extra,test]" pip install ".[extra,test]"
pip list pip list

View File

@ -51,7 +51,7 @@ jobs:
- name: basic setup - name: basic setup
run: | run: |
pip --version pip --version
pip install -q fire pip install -q -r .actions/requirements.txt
- name: Setup Windows - name: Setup Windows
if: runner.os == 'windows' if: runner.os == 'windows'

View File

@ -114,7 +114,7 @@ jobs:
- name: Dowload package - name: Dowload package
# todo: download also lite after it is fist published # todo: download also lite after it is fist published
run: | run: |
pip install -q fire requests pip install -q -r .actions/requirements.txt
for pkg in 'app' 'pytorch' ; do for pkg in 'app' 'pytorch' ; do
python .actions/assistant.py download-package "$pkg" --folder pypi python .actions/assistant.py download-package "$pkg" --folder pypi
done done
@ -131,7 +131,7 @@ jobs:
- name: Miror source - name: Miror source
run: | run: |
pip install -q fire requests pip install -q -r .actions/requirements.txt
python .actions/assistant.py mirror-pkg2source pypi src python .actions/assistant.py mirror-pkg2source pypi src
ls -R src/ ls -R src/

View File

@ -71,7 +71,7 @@ jobs:
if: ${{ (steps.skip.outputs.continue == '1') }} if: ${{ (steps.skip.outputs.continue == '1') }}
run: | run: |
pip --version pip --version
pip install -q fire pip install -q -r .actions/requirements.txt
# Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646 # Github Actions: Run step on specific OS: https://stackoverflow.com/a/57948488/4521646
- name: Setup macOS - name: Setup macOS

View File

@ -26,7 +26,7 @@ jobs:
- name: Build packages - name: Build packages
run: | run: |
pip install -q fire pip install -q -r .actions/requirements.txt
python .actions/assistant.py prepare-nightly-version python .actions/assistant.py prepare-nightly-version
python setup.py sdist bdist_wheel python setup.py sdist bdist_wheel
ls -lh dist/ ls -lh dist/

View File

@ -26,7 +26,7 @@ jobs:
with: with:
python-version: 3.9 python-version: 3.9
- run: | - run: |
pip install -q fire requests pip install -q -r .actions/requirements.txt
mkdir dist && touch dist/.placeholder mkdir dist && touch dist/.placeholder
mkdir pypi && touch pypi/.placeholder mkdir pypi && touch pypi/.placeholder
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
@ -105,7 +105,7 @@ jobs:
- name: Dowload package - name: Dowload package
run: | run: |
pip install -q fire requests pip install -q -r .actions/requirements.txt
python .actions/assistant.py download-package ${{ matrix.pkg }} --folder pypi python .actions/assistant.py download-package ${{ matrix.pkg }} --folder pypi
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
@ -147,7 +147,7 @@ jobs:
- name: Miror source - name: Miror source
run: | run: |
pip install -q fire requests pip install -q -r .actions/requirements.txt
python .actions/assistant.py mirror-pkg2source pypi src python .actions/assistant.py mirror-pkg2source pypi src
ls -R src/ ls -R src/