From 1560892c58b183dfaf33af0230f35b3e183fcc69 Mon Sep 17 00:00:00 2001 From: merwanehamadi Date: Fri, 11 Aug 2023 17:28:53 -0700 Subject: [PATCH] Sync skill tree to a versioned website (#289) Signed-off-by: Merwane Hamadi --- .github/workflows/ci.yml | 15 +++++++++++++++ .gitmodules | 4 ++++ agbenchmark/challenges | 2 +- agbenchmark/utils/dependencies/graphs.py | 6 +++--- agbenchmark/utils/dependencies/main.py | 7 +++++++ 5 files changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7eca47f46..2db450a9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,6 +122,11 @@ jobs: - name: Setup Chrome and ChromeDriver run: | + echo "Add submodules" + cd agbenchmark/challenges + git submodule update --init --remote --recursive + cd ../.. + sudo apt-get update sudo apt-get install -y unzip xvfb wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - @@ -273,6 +278,14 @@ jobs: if git push origin HEAD; then echo "Success!" poetry run python send_to_googledrive.py || echo "Failed to upload to Google Drive" + echo "Adding skill_tree submodule to update website" + poetry run agbenchmark start --mock + cd agbenchmark/challenges/skill_tree + git add . + git commit -m "Update website with new skill tree" + git remote set-url origin https://x-access-token:${{ env.GH_TOKEN }}@github.com/agbenchmark/skill-tree.github.io.git + git push origin HEAD:refs/heads/main + cd ../../.. exit 0 else echo "Attempt $(($attempts + 1)) failed. Retrying..." @@ -284,6 +297,8 @@ jobs: env: GDRIVE_BASE64: ${{ secrets.GDRIVE_BASE64 }} GITHUB_REF_NAME: ${{ github.ref_name }} + BUILD_SKILL_TREE: true + AGENT_NAME: ${{ matrix.agent-name }} generate_charts: needs: tests diff --git a/.gitmodules b/.gitmodules index de4680fff..5039aa182 100644 --- a/.gitmodules +++ b/.gitmodules @@ -33,3 +33,7 @@ [submodule "agbenchmark/challenges"] path = agbenchmark/challenges url = https://github.com/agbenchmark/agent-evals.git +[submodule "skill-tree"] + path = skill-tree + url = https://github.com/agbenchmark/skill-tree.github.io + branch = main diff --git a/agbenchmark/challenges b/agbenchmark/challenges index 790e54011..949f17d9f 160000 --- a/agbenchmark/challenges +++ b/agbenchmark/challenges @@ -1 +1 @@ -Subproject commit 790e54011653bdc1cb80a83483070ec7ff2abf7b +Subproject commit 949f17d9f9f4d0d0cef54654c9fd6f583104c1c3 diff --git a/agbenchmark/utils/dependencies/graphs.py b/agbenchmark/utils/dependencies/graphs.py index 7445474b7..241afe940 100644 --- a/agbenchmark/utils/dependencies/graphs.py +++ b/agbenchmark/utils/dependencies/graphs.py @@ -266,7 +266,7 @@ def graph_interactive_network( "layout": {"hierarchical": hierarchical_options}, } - relative_path = "agbenchmark/challenges/dependencies.html" + relative_path = "agbenchmark/challenges/skill_tree/dependencies.html" file_path = str(Path(relative_path).resolve()) if show: @@ -279,7 +279,7 @@ def graph_interactive_network( ] iframe_path = "dependencies.html" - combined_file_path = "agbenchmark/challenges/combined_view.html" + combined_file_path = "agbenchmark/challenges/skill_tree/combined_view.html" create_combined_html(combined_file_path, iframe_path, table_data) # JavaScript code snippet to be inserted @@ -295,7 +295,7 @@ def graph_interactive_network( """ # Path to the iframe HTML file - iframe_path = "agbenchmark/challenges/dependencies.html" + iframe_path = "agbenchmark/challenges/skill_tree/dependencies.html" # Insert the JS code snippet into the iframe HTML file insert_js_into_iframe(iframe_path, iframe_js_code) diff --git a/agbenchmark/utils/dependencies/main.py b/agbenchmark/utils/dependencies/main.py index cf09b6c88..8ec88fb02 100644 --- a/agbenchmark/utils/dependencies/main.py +++ b/agbenchmark/utils/dependencies/main.py @@ -7,6 +7,7 @@ __init__.py. import collections import json +import os from typing import Any, Generator, Optional import colorama @@ -195,6 +196,12 @@ class DependencyManager(object): def sorted_items(self, show_graph: Optional[bool] = False) -> Generator: """Get a sorted list of tests where all tests are sorted after their dependencies.""" # Build a directed graph for sorting + build_skill_tree = os.getenv("BUILD_SKILL_TREE") + BUILD_SKILL_TREE = ( + build_skill_tree.lower() == "true" if build_skill_tree else False + ) + if BUILD_SKILL_TREE: + show_graph = True dag = networkx.DiGraph() # Insert all items as nodes, to prevent items that have no dependencies and are not dependencies themselves from