Skip to content

Commit

Permalink
Always upload test results (#498)
Browse files Browse the repository at this point in the history
Upload test results always, even if "Run Test" failed
Add card_type mapping
  • Loading branch information
vmilosevic authored Oct 22, 2024
1 parent 0b9b8dc commit 375c069
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
- name: Upload Test Log
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-log-${{ matrix.build.runs-on }}
path: pytest.log
Expand All @@ -106,6 +107,7 @@ jobs:
- name: Upload Test Report
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: test-reports-${{ matrix.build.runs-on }}
path: ${{ steps.strings.outputs.test_report_path }}
Expand Down
43 changes: 7 additions & 36 deletions infra/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,42 +144,13 @@ def get_job_row_from_github_job(github_job):

assert github_job["status"] == "completed", f"{github_job_id} is not completed"

# Best effort card type getting

get_overlap = lambda labels_a, labels_b: set(labels_a) & set(labels_b)
labels_have_overlap = lambda labels_a, labels_b: bool(get_overlap(labels_a, labels_b))

try:
detected_config = return_first_string_starts_with("config-", labels).replace("config-", "")
except Exception as e:
logger.error(e)
logger.info("Seems to have no config- label, so assuming no special config requested")
detected_config = None

if labels_have_overlap(["E150", "grayskull", "arch-grayskull"], labels):
detected_arch = "grayskull"
elif labels_have_overlap(["N150", "N300", "wormhole_b0", "arch-wormhole_b0"], labels):
detected_arch = "wormhole_b0"
elif labels_have_overlap(["BH", "arch-blackhole"], labels):
detected_arch = "blackhole"
else:
detected_arch = None

single_cards_list = ("E150", "N150", "N300", "BH")
single_cards_overlap = get_overlap(single_cards_list, labels)

# In order of preference
if detected_config:
if not detected_arch:
raise Exception(f"There must be an arch detected for config {detected_config}")
card_type = f"{detected_config}-{detected_arch}"
elif single_cards_overlap:
logger.info(f"Detected overlap in single cards: {single_cards_overlap}")
card_type = list(single_cards_overlap)[0]
elif detected_arch:
card_type = detected_arch
else:
card_type = None
# Determine card type based on runner name
runner_name = (github_job.get("runner_name") or "").upper()
card_type = None
for card in ["E150", "N150", "N300", "BH"]:
if card in runner_name:
card_type = card
break

job_submission_ts = github_job["created_at"]

Expand Down
7 changes: 6 additions & 1 deletion infra/test/test_generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from generate_data import create_pipeline_json
import os
import json


def test_create_pipeline_json():
Expand All @@ -18,5 +19,9 @@ def test_create_pipeline_json():
workflow_outputs_dir="test/data",
)

assert pipeline is not None
assert os.path.exists(filename)

# assert pipeline json file has the correct
with open(filename, "r") as file:
data = json.load(file)
assert data["jobs"][0]["card_type"] == "N300"

0 comments on commit 375c069

Please sign in to comment.