Actions/setup-python caching

Please help me to understand the behavior of Gitea Actions.
I have run the runner in docker and it works correctly.

sudo docker run --restart always \
    -v $(pwd)/config/config.yaml:/config.yaml \.
    -v $(pwd)/data:/data \.
    -v /var/run/docker.sock:/var/run/docker.sock \.
    --env-file="$(pwd)/.env" \
    -p 8088:8088 \
    -e CONFIG_FILE=/config.yaml \.
    -e GITEA_RUNNER_NAME="VM runner" \
    --name gitea_runner.
    -d gitea/act_runner:latest.

I have enabled the cache as described in the documentation (Act Runner | Gitea Documentation) and actions/cache is also working correctly.

The problem is that some actions such as setup-python download their artifacts every time.
setup-python loads the tar.gz archive into the /opt/hostedtoolcache folder on the runner.
This folder is specified in the environment variables of the running runners (e.g., RUNNER_TOOL_CACHE)

But every time action runs, new docker runner starts and this folder is empty. So, setup-python downloads the archive again.

Is there a possibility to cache the /opt/hostedtoolcache folder?

Also, if i specify cache flag:

- name: Set up Python 3.x
  uses: actions/setup-python@v4
    python-version: '3.7.17'
    architecture: 'x64'
    cache: 'pip'

runner downloads packages to the /root/.cache/pip folder, but this folder also remains only in the runner on which setup-python was run and subsequent runs install the dependencies again.

1 Like