Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion .github/scripts/intel_host_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,9 @@ def source_identity(root):
def run_identity():
result = {name: os.environ.get(name, "") for name in ("GITHUB_REPOSITORY", "GITHUB_RUN_ID", "GITHUB_RUN_ATTEMPT")}
require(all(result.values()), "GitHub repository, run ID and attempt are required")
require(result["GITHUB_REPOSITORY"] == "UOR-Foundation/LexLean", "foreign repository")
# GitHub names a repository case-insensitively, and the repository is now
# spelled `UOR-Foundation/lexlean`; any other repository stays foreign.
require(result["GITHUB_REPOSITORY"].lower() == "uor-foundation/lexlean", "foreign repository")
require(all(result[n].isdigit() for n in ("GITHUB_RUN_ID", "GITHUB_RUN_ATTEMPT")), "invalid run ID/attempt")
return result

Expand Down
10 changes: 10 additions & 0 deletions .github/scripts/test_intel_host_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ def test_committed_lane_plan_is_complete_and_preserves_existing_parts(self):
self.assertGreater(len(lanes["lanes"]), 0)
self.assertEqual(set(lanes["producer"]), set(bdd["targets"]))

def test_run_identity_names_this_repository_in_any_case(self):
run = {"GITHUB_RUN_ID": "100", "GITHUB_RUN_ATTEMPT": "1"}
for name in ("UOR-Foundation/LexLean", "UOR-Foundation/lexlean"):
with patch.dict(os.environ, dict(run, GITHUB_REPOSITORY=name)):
self.assertEqual(factory.run_identity()["GITHUB_REPOSITORY"], name)
for name in ("someone/lexlean", "UOR-Foundation/lexlean-fork"):
with patch.dict(os.environ, dict(run, GITHUB_REPOSITORY=name)):
with self.assertRaisesRegex(factory.Invalid, "foreign repository"):
factory.run_identity()

def test_plan_missing_duplicate_foreign_and_added_part_are_refused(self):
fixture = Fixture(self.directory)
for change in (lambda p: p["lanes"]["lower"].clear(), lambda p: p["lanes"]["print"].append("a"), lambda p: p["lanes"]["moves"].append("unknown")):
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ compiler/.lexlean/
# and make `cargo package` read a dirty working directory.
/release/

# Python bytecode the CI helper scripts' unit tests leave beside them.
__pycache__/
*.pyc

# Editor and OS noise.
.DS_Store
*.swp
Expand Down
Loading