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

windows-latest runner cache path doest not exists #52

Closed
RomainBrault opened this issue Sep 6, 2024 · 6 comments · Fixed by #57
Closed

windows-latest runner cache path doest not exists #52

RomainBrault opened this issue Sep 6, 2024 · 6 comments · Fixed by #57

Comments

@RomainBrault
Copy link

The default cache path is not working on windows runner:

Saving cache path: /tmp/setup-uv-cache
Error: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

workflow:

...
      - name: Install uv
        uses: astral-sh/setup-uv@v2
        with:
          enable-cache: true
...

I'm using windows-latest runner

@RomainBrault RomainBrault changed the title Windows cache path windows-latest runner cache path doest not exists Sep 6, 2024
@eifinger
Copy link
Collaborator

eifinger commented Sep 6, 2024

Can you show your complete workflow? This message usually indicates that the cache got not populated.

@RomainBrault
Copy link
Author

RomainBrault commented Sep 6, 2024

  test:
    name: Run tests under Python ${{ matrix.python }} on ${{ matrix.os }}
    needs: check
    runs-on: ${{ matrix.os }}
    environment:
      name: tests
    strategy:
      matrix:
        python:
          - "3.12"
        os:
          - ubuntu-latest
          - macos-latest
          - windows-latest
    steps:
      - name: Check out the repository
        uses: actions/checkout@v4
      - name: Install uv
        uses: astral-sh/setup-uv@v2
        with:
          enable-cache: true
      - name: Install Python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ matrix.python }}
      - name: Pick environment to run
        run: |
          import os;
          env = "TOXENV=py{}{}-test\n".format(*"${{ matrix.python }}".split("."))
          with open(os.environ["GITHUB_ENV"], mode="a", encoding="utf-8") as file_handler:
              file_handler.write(env)
        shell: python
      - name: Run the test suite
        shell: bash
        run: |
          echo "REPORT_FILE=.tox/test_report.md" >> "$GITHUB_ENV"
          uvx --quiet --no-progress --with tox-uv tox run
      - name: Output reports to the job summary when tests fail
        if: failure()
        shell: bash
        run: |
          if [ -f "$REPORT_FILE" ]; then
            echo "<details><summary>Failed Test Report</summary>" >> $GITHUB_STEP_SUMMARY
            echo "" >> $GITHUB_STEP_SUMMARY
            cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY
            echo "" >> $GITHUB_STEP_SUMMARY
            echo "</details>" >> $GITHUB_STEP_SUMMARY
          fi
      - name: Upload coverage data
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: coverage-data-${{ matrix.os }}-${{ matrix.python }}
          path: .tox/.coverage.*
          overwrite: true
          include-hidden-files: true
      - name: Upload test results
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: test-results-${{ matrix.os }}-${{ matrix.python }}
          path: .tox/junit.*
          overwrite: true
          include-hidden-files: true

It gets populated on the ubuntu and macos runner though, and there's no windows specific branching

@eifinger
Copy link
Collaborator

eifinger commented Sep 6, 2024

Can you run again with the branch changed to windows-default-storage-path?

uses: astral-sh/setup-uv@windows-default-storage-path

@eifinger
Copy link
Collaborator

eifinger commented Sep 6, 2024

I think the current default /tmp/setup-uv-cache has undefined behavior in Windows, or at least behavior I do not fully understand. We do have tests running on windows which do not show any errors.

Changing to a OS dependant default by using RUNNER_TEMP seems like a better apporach to me.

@RomainBrault
Copy link
Author

Looks like it's working :)

https://github.com/whiteprints/test-map-linux-py312-test-open-source/actions/runs/10740884185

It is a test repo, so it might disappear.

@skshetry
Copy link

skshetry commented Sep 6, 2024

I am also having similar issues on Windows runner. See https://github.com/iterative/dvc/actions/runs/10731598439/job/29762219494#step:12:2.

Post job cleanup.
Pruning cache...
Error: The process 'C:\hostedtoolcache\windows\uv\0.4.6\x86_64\uv.exe' failed with exit code

I think the current default /tmp/setup-uv-cache has undefined behavior in Windows
Changing to a OS dependant default by using RUNNER_TEMP seems like a better apporach to me.

hardlink link type doesn't work if they are on different drives. This may not be a problem for users installing directly with --system (on the contary, this might improve performance), but could make it slow for users that are creating virtualenv in the workspace, which is usually on D:\ drive (RUNNER_TEMP is on C: drive, right?).

I install into system Python environment on some packages, so I have been looking to change the cache directory to somewhere on C:\ drive.

EDIT: RUNNER_TEMP is on D:\ drive. Apologies for the confusion. 🤦🏽‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants