-
Notifications
You must be signed in to change notification settings - Fork 40
Order the targets in available_software.py #447
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
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
54f4fa3
add ordering of targets to available software script
2e12ae5
fix tests for adding ordered targets
9f56640
add __pycache__ to gitignore
laraPPr d39c0fa
implement new order in overview.md
laraPPr 65af95a
make linter happy
laraPPr 6af5363
add scrollbar
laraPPr 8abbb55
remove names of columns
laraPPr f999104
add workflow for checking the overview.md page of available software
laraPPr df848e1
change name of workflow
laraPPr 4aa8a6d
change action so that it will run for all not just prs with EESSI as …
laraPPr 6fb1c32
fix indentation in yml file
laraPPr 2d7e3eb
test new workflow
laraPPr b40475c
fix github workflow parsing error
laraPPr 0f89928
fix test_overview_available_software.py script
laraPPr e4ef4d1
add comparison definition to sort targets
laraPPr 86fdced
fix failing available software test
laraPPr 9b70e50
remove trailing whitespace
laraPPr ff35d0c
fix failing test
laraPPr f2282ef
remove trailing whitespace
laraPPr 1e22b47
remove trailing whitespace
laraPPr aa60709
fix test
laraPPr 1dc05c6
set correct table hierarchy in overview.md
laraPPr d5cdce9
set correct table hierarchy in overview.md
laraPPr 19769c4
spellcheck
laraPPr bdfee65
expand docstring
laraPPr e246c06
Make linter happy
Neves-P File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
.github/workflows/scripts/test_overview_available_software.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import os | ||
import json | ||
from bs4 import BeautifulSoup | ||
|
||
path = os.path.dirname(os.path.realpath(__file__)) | ||
path_overview = "/../../../docs/available_software/overview.md" | ||
path_data = "/../../../docs/available_software/data/json_data.json" | ||
if os.path.exists(path + path_overview) and os.path.exists(path + path_data): | ||
with open(path + path_data) as json_data: | ||
data = json.load(json_data) | ||
with open(path + path_overview) as f: | ||
soup = BeautifulSoup(f, "html.parser") | ||
else: | ||
os.write(1, b'Error: Could not find overview.md and/or data/json_data.json') | ||
|
||
# parse the numbers for the different targets | ||
targets = data["targets"] | ||
ARM_targets = [] | ||
x86_targets = [] | ||
amd_targets = [] | ||
intel_targets = [] | ||
nvidia_targets = [] | ||
|
||
for target in targets: | ||
t = target.split('/') | ||
if t[7] == 'aarch64': | ||
ARM_targets.append(target) | ||
else: | ||
x86_targets.append(target) | ||
if t[8] == "amd": | ||
amd_targets.append(target) | ||
elif t[8] == "intel": | ||
intel_targets.append(target) | ||
elif t[8] == 'nvidia': | ||
nvidia_targets.append(target) | ||
|
||
# parse the overview.md page to check the number of colums in rows | ||
table = soup.find("table", {"class": "table"}) | ||
for row in table.find_all("tr"): | ||
for column in row.find_all('th'): | ||
if column.text == "x86_64": | ||
print(f'the value for x86_64 is {column.get("colspan")} in the overview page and there are {len(x86_targets)} targets in json_data.json.') | ||
if int(column.get("colspan")) != len(x86_targets): | ||
os.write(2, b'Error: Please make sure the values for x86_64 in json_data.json and overview.md are the same.') | ||
elif column.text == "aarch64": | ||
print(f'the value for aarch64 is {column.get("colspan")} in the overview page and there are {len(ARM_targets)} targets in json_data.json.') | ||
if int(column.get("colspan")) != len(ARM_targets): | ||
os.write(2, b'Error: Please make sure the values for aarch64 in json_data.json and overview.md are the same.') | ||
elif column.text == "amd": | ||
print(f'the value for amd is {column.get("colspan")} in the overview page and there are {len(amd_targets)} targets in json_data.json.') | ||
if int(column.get("colspan")) != len(amd_targets): | ||
os.write(2, b'Error: Please make sure the values for amd in json_data.json and overview.md are the same.') | ||
elif column.text == "intel": | ||
print(f'the value for intel is {column.get("colspan")} in the overview page and there are {len(intel_targets)} targets in json_data.json.') | ||
if int(column.get("colspan")) != len(intel_targets): | ||
os.write(2, b'Error: Please make sure the values for intel in json_data.json and overview.md are the same.') | ||
elif column.text == "nvidia": | ||
print(f'the value for nvidia is {column.get("colspan")} in the overview page and there are {len(nvidia_targets)} targets in json_data.json.') | ||
if int(column.get("colspan")) != len(nvidia_targets): | ||
os.write(2, b'Error: Please make sure the values for nvidia in json_data.json and overview.md are the same.') | ||
last_row = table.find_all("tr")[-1] | ||
print(f'there are {len(last_row.find_all("th"))} columns in the overview page and {len(targets)} targets in json_data.json.') | ||
if len(last_row.find_all("th")) != len(targets): | ||
os.write(2, b'Error: Please make sure there are correct number of <th> elements in the last <tr> element in overview.md for JavaScript to generate the table.') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Test overview of available software in EESSI | ||
on: | ||
push: | ||
paths: | ||
- ".github/**" | ||
- "docs/available_software/data/**" | ||
jobs: | ||
check_targets: | ||
name: check targets in overview.md and json_data.json | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
|
||
- name: set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | ||
with: | ||
python-version: '3.10' | ||
architecture: x64 | ||
|
||
- name: test overview available software | ||
id: test_overview_available_software | ||
run: | | ||
# install required Python packages in virtual environment | ||
python -m venv venv | ||
. venv/bin/activate | ||
pip install -r mkdocs-ldjson-plugin/requirements.txt | ||
|
||
python .github/workflows/scripts/test_overview_available_software.py |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
site/ | ||
venv* | ||
scripts/available_software/__pycache__ | ||
scripts/available_software/tests/__pycache__ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This workflow didn't run (as expected, given run the conditions), but it did run in @laraPPr's branch and works well: https://github.com/laraPPr/EESSI_docs/actions/runs/14799375963, so it's safe to assume it will run well when the conditions are met in the target branch.