Skip to content
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

fix(IDX): fix python tests #1709

Merged
merged 6 commits into from
Sep 30, 2024
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
1 change: 1 addition & 0 deletions .github/workflows-source/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ jobs:
env:
CI_COMMIT_REF_PROTECTED: ${{ github.ref_protected }}
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
REPO_NAME: ${{ github.repository }}

build-ic:
name: Build IC
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ jobs:
env:
CI_COMMIT_REF_PROTECTED: ${{ github.ref_protected }}
CI_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
REPO_NAME: ${{ github.repository }}
build-ic:
name: Build IC
runs-on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from data_source.jira_finding_data_source import JiraFindingDataSource
from model.ic import (
IS_PRIVATE,
REPO_NAME,
get_ic_repo_ci_pipeline_base_url,
get_ic_repo_for_rust,
get_ic_repo_merge_request_base_url,
Expand All @@ -14,7 +14,7 @@
from scanner.scanner_job_type import ScannerJobType

if __name__ == "__main__":
if IS_PRIVATE:
if REPO_NAME == "dfinity/ic-private":
logging.basicConfig(level=logging.INFO)
else:
logging.basicConfig(level=logging.WARNING)
Expand Down
21 changes: 6 additions & 15 deletions ci/src/dependencies/model/ic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
from model.project import Project
from model.repository import Repository
from model.team import Team
from scanner.dependency_scanner import PROJECT_ROOT

IS_PRIVATE = PROJECT_ROOT.name == "ic-private"
CI_PROJECT_PATH = os.environ.get("CI_PROJECT_PATH", "dfinity/ic")
GITHUB_REF = os.environ.get("GITHUB_REF", "refs/heads/master")
REPO_NAME = os.environ.get("REPO_NAME", "dfinity/ic")


def is_running_in_ic_repo() -> bool:
Expand All @@ -23,25 +22,17 @@ def is_env_for_periodic_job() -> bool:


def get_ic_repo_for_rust() -> Repository:
if IS_PRIVATE:
return Repository("ic", "https://github.com/dfinity/ic-private",
[Project(name="ic", path="ic-private", owner_by_path={"ic-private/rs/crypto": [Team.CRYPTO_TEAM], "ic-private/rs/validator": [Team.CRYPTO_TEAM], "ic-private/rs/canonical_state": [Team.CRYPTO_TEAM]})])
return Repository("ic", "https://github.com/dfinity/ic", [Project(name="ic", path="ic", owner_by_path={"ic/rs/crypto": [Team.CRYPTO_TEAM], "ic/rs/validator": [Team.CRYPTO_TEAM], "ic/rs/canonical_state": [Team.CRYPTO_TEAM]})])
repo_name = REPO_NAME.replace("dfinity/", "")
return Repository("ic", f"https://github.com/dfinity/{repo_name}", [Project(name="ic", path=repo_name, owner_by_path={f"{repo_name}/rs/crypto": [Team.CRYPTO_TEAM], f"{repo_name}/rs/validator": [Team.CRYPTO_TEAM], f"{repo_name}/rs/canonical_state": [Team.CRYPTO_TEAM]})])


def get_ic_repo_merge_request_base_url() -> str:
if IS_PRIVATE:
return "https://github.com/dfinity/ic-private/pull/"
return "https://github.com/dfinity/ic/pull/"
return f"https://github.com/{REPO_NAME}/pull/"


def get_ic_repo_ci_pipeline_base_url() -> str:
if IS_PRIVATE:
return "https://github.com/dfinity/ic-private/actions/runs/"
return "https://github.com/dfinity/ic/actions/runs/"
return f"https://github.com/{REPO_NAME}/actions/runs/"


def __test_get_ic_path():
if IS_PRIVATE:
return "ic-private"
return "ic"
return REPO_NAME.replace("dfinity/", "")
Loading