Skip to content

Fix ci for versioning tutorial #90

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

Merged
merged 1 commit into from
Apr 17, 2023
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
13 changes: 10 additions & 3 deletions tutorial/versioning/revisions/intro/run_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import platform
from test.examples_tools import run, replace, chdir
from test.examples_tools import run, replace, chdir, load

from conan import conan_version

Expand All @@ -24,8 +25,14 @@
run("conan new cmake_lib -d name=chat -d version=1.0 -d requires=hello/1.0")
run("conan create .")

# FIXME: remove after beta10 is released or use the json output to parse the rrev
hello_rrev = "2475ece651f666f42c155623228c75d2" if "beta9" in str(conan_version) else "6b908be14391834776ffc2f42ea07cb7"
run("conan list hello/1.0#* --format=json > output.json")

data = json.loads(load("output.json"))

revisions = data["Local Cache"]["hello/1.0"]["revisions"]
sorted_revisions = sorted(revisions, key=lambda x: revisions[x]["timestamp"])

hello_rrev = sorted_revisions[-1] # oldest revision instead of the latest one

replace("conanfile.py", 'self.requires("hello/1.0")',
f'self.requires("hello/1.0#{hello_rrev}")')
Expand Down