cache icon indicating copy to clipboard operation
cache copied to clipboard

Trying to cache android sdk or cmdline tools doesn't work due to invalid path warning while path exists

Open RadwaSaleh opened this issue 1 year ago • 0 comments

I'm working on a github actions workflow that installs comdline tools and sdk packages every run and I want to cache these directories

       - name: Restore Android SDK Cache
          uses: actions/cache@v3
          with:
           path: $HOME/android-sdk
           key: ${{ runner.os }}-android-sdk 

I get this warning in Post Restore Android SDK Cache step and nothing is cached even after first run:

Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

this is the action where I download cmdline tools

      - name: Download Android Command Line Tools
        run: |
          set -e
          SDK_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip"

          mkdir -p $HOME/android-sdk/cmdline-tools
          curl -o sdk-tools.zip $SDK_TOOLS_URL
          unzip -q sdk-tools.zip -d $HOME/android-sdk/cmdline-tools
          mv $HOME/android-sdk/cmdline-tools/cmdline-tools $HOME/android-sdk/cmdline-tools/latest
          rm sdk-tools.zip
          echo "Setup completed. Directory structure:"
          tree $HOME/android-sdk/cmdline-tools || ls -R $HOME/android-sdk/cmdline-tools 

I have tried so many things and I tried to set the cache step before and after the download step but nothing works

RadwaSaleh avatar Jan 17 '25 16:01 RadwaSaleh