Skip to content

[pull] main from actions:main#16

Merged
pull[bot] merged 1 commit intoStars1233:mainfrom
actions:main
Jun 25, 2025
Merged

[pull] main from actions:main#16
pull[bot] merged 1 commit intoStars1233:mainfrom
actions:main

Conversation

@pull
Copy link

@pull pull bot commented Jun 25, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

Enhance dependency caching to support files located outside the workspace by copying them into the workspace before caching and update related exports, documentation, tests, and CI configuration.

New Features:

  • Allow cache-dependency-path to reference files outside the workspace by copying them into the workspace for caching

Enhancements:

  • Export cacheDependencies function for external use

CI:

  • Remove windows-2019 runner from test-pypy workflow

Documentation:

  • Document that cache-dependency-path supports files outside the workspace by copying them into the workspace

Tests:

  • Add unit tests for cacheDependencies covering file copy, path resolution, warnings, and fallback scenarios

…orkspace root (#1128)

* ehnace cache dependency path handling

* logic update

* npm run format-check

* update cacheDependencies tests to cover resolved paths and copy edge cases

* check failure fix

* depricate-windows-2019

* refactored the code

* Check failure fix
@pull pull bot added the ⤵️ pull label Jun 25, 2025
@pull pull bot merged commit 1264885 into Stars1233:main Jun 25, 2025
@gitnotebooks
Copy link

gitnotebooks bot commented Jun 25, 2025

Review these changes at https://app.gitnotebooks.com/Stars1233/setup-python/pull/16

@sourcery-ai
Copy link

sourcery-ai bot commented Jun 25, 2025

Reviewer's Guide

This PR exports the cacheDependencies function and enriches its cache-dependency-path handling to support files outside the workspace by resolving and copying them into the workspace for proper caching; it also updates documentation and workflows accordingly and adds comprehensive unit tests.

Sequence diagram for enhanced cache-dependency-path handling in cacheDependencies

sequenceDiagram
    participant Workflow
    participant cacheDependencies
    participant core
    participant fs
    participant process
    participant getCacheDistributor
    participant cacheDistributor

    Workflow->>cacheDependencies: Call with cache, pythonVersion
    cacheDependencies->>core: getInput('cache-dependency-path')
    cacheDependencies->>process: Get GITHUB_ACTION_PATH, GITHUB_WORKSPACE
    alt cache-dependency-path provided
        cacheDependencies->>fs: Check if sourcePath exists
        alt sourcePath does not exist
            cacheDependencies->>core: warning (path does not exist)
        else sourcePath exists
            alt sourcePath != targetPath
                cacheDependencies->>fs: mkdir(targetDir, {recursive: true})
                cacheDependencies->>fs: copyFile(sourcePath, targetPath)
                cacheDependencies->>core: info (Copied file)
            else
                cacheDependencies->>core: info (Already in workspace)
            end
            cacheDependencies->>core: info (Resolved path)
        end
    else
        Note over cacheDependencies: No cache-dependency-path provided
    end
    cacheDependencies->>getCacheDistributor: Call with dependencyPathForCache
    cacheDependencies->>cacheDistributor: restoreCache()
    cacheDistributor-->>cacheDependencies: Done
    cacheDependencies-->>Workflow: Done
Loading

File-Level Changes

Change Details Files
Export cacheDependencies for external use
  • Marked cacheDependencies as exported in TypeScript
  • Added exports.cacheDependencies in the compiled JS
src/setup-python.ts
dist/setup/index.js
Implement resolution and copying of external cache-dependency-paths
  • Introduced resolvedDependencyPath and computed source and target paths
  • Checked file existence with fs.access and emitted warnings if missing
  • Created target directories and copied files into workspace when needed
  • Logged info for copy actions and computed relative resolved paths
  • Fell back to original input when resolution failed
  • Updated getCacheDistributor call to use dependencyPathForCache
src/setup-python.ts
dist/setup/index.js
Update documentation and CI workflow
  • Added note in advanced-usage.md about supporting files outside the workspace
  • Removed deprecated windows-2019 runner from test-pypy workflow
docs/advanced-usage.md
.github/workflows/test-pypy.yml
Add unit tests for cacheDependencies logic
  • Created tests for successful copy and path resolution
  • Added scenarios for missing file warning and copy failures
  • Covered cases with no input and when file is already inside workspace
  • Mocked fs.promises, core inputs, and cache distributor
__tests__/setup-python.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant