diff --git a/.github/workflows/reusable-python-ci.yml b/.github/workflows/reusable-python-ci.yml index 3d0b8b0..9dfb2b3 100644 --- a/.github/workflows/reusable-python-ci.yml +++ b/.github/workflows/reusable-python-ci.yml @@ -1,7 +1,6 @@ name: Reusable - Complete Python CI on: - pull_request: workflow_call: inputs: python-version: @@ -19,6 +18,11 @@ on: required: false type: string default: 'pip install -e ".[dev]"' + test-install-command: + description: 'Command to install project dependencies for tests' + required: false + type: string + default: '' skip-commit-check: description: 'Skip commit message check' required: false @@ -59,6 +63,9 @@ on: required: false type: number default: 500 + secrets: + proton_samples_token: + required: false jobs: pr-size-check: @@ -105,4 +112,6 @@ jobs: uses: ./.github/workflows/reusable-tests.yml with: python-version: ${{ inputs.python-version || '3.11' }} - install-command: ${{ inputs.install-command || 'pip install -e ".[dev]"' }} + install-command: ${{ inputs.test-install-command || inputs.install-command || 'pip install -e ".[dev]"' }} + secrets: + proton_samples_token: ${{ secrets.proton_samples_token }} diff --git a/.github/workflows/reusable-tests.yml b/.github/workflows/reusable-tests.yml index 2f8301f..2bcf7f8 100644 --- a/.github/workflows/reusable-tests.yml +++ b/.github/workflows/reusable-tests.yml @@ -23,6 +23,9 @@ on: required: false type: boolean default: true + secrets: + proton_samples_token: + required: false jobs: comprehensive-tests: @@ -43,6 +46,11 @@ jobs: python-version: ${{ inputs.python-version }} - name: Install dependencies + env: + GIT_CONFIG_COUNT: ${{ secrets.proton_samples_token != '' && '1' || '0' }} + GIT_CONFIG_KEY_0: 'url.https://x-access-token:${{ secrets.proton_samples_token }}@github.com/IS-Model-Framework/ProtonSamples.insteadOf' + GIT_CONFIG_VALUE_0: 'https://github.com/IS-Model-Framework/ProtonSamples' + GIT_TERMINAL_PROMPT: '0' run: | python -m pip install --upgrade pip ${{ inputs.install-command }} diff --git a/scripts/check_mr_logs.py b/scripts/check_mr_logs.py index 55280bf..85344fd 100644 --- a/scripts/check_mr_logs.py +++ b/scripts/check_mr_logs.py @@ -26,7 +26,7 @@ def get_commit_log(commit_hash): try: result = subprocess.run( - ["git", "show", "-s", f"--format=%B%nAuthor: %an <%ae>", commit_hash], + ["git", "show", "-s", "--format=%B%nAuthor: %an <%ae>", commit_hash], capture_output=True, text=True, check=True, @@ -49,7 +49,7 @@ def check_header(commit_msg): if not header_match: return ( False, - f"Invalid header format. Should be: []: ", + "Invalid header format. Should be: []: ", ) return True, "" diff --git a/scripts/code_format_helper.py b/scripts/code_format_helper.py index cecda7a..1bd97b7 100644 --- a/scripts/code_format_helper.py +++ b/scripts/code_format_helper.py @@ -36,7 +36,7 @@ class FormatArgs: verbose: bool = True def __init__(self, args: Optional[argparse.Namespace] = None) -> None: - if not args is None: + if args is not None: self.start_rev = args.start_rev self.end_rev = args.end_rev self.changed_files = args.changed_files diff --git a/scripts/typing_helper.py b/scripts/typing_helper.py index 0763cdc..92e2f2a 100644 --- a/scripts/typing_helper.py +++ b/scripts/typing_helper.py @@ -30,7 +30,7 @@ class TypingArgs: verbose: bool = True def __init__(self, args: Optional[argparse.Namespace] = None) -> None: - if not args is None: + if args is not None: self.changed_files = args.changed_files @@ -142,5 +142,5 @@ def typing_run(self, changed_files: List[str], args: TypingArgs) -> bool: sys.exit(1) if not helper.run(changed_files, args): - print(f"error: static typing for python failed") + print("error: static typing for python failed") sys.exit(1)