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

Mage Github action appears to download mage on every run without caching #264

Closed
joshuacc opened this issue Oct 29, 2022 · 2 comments · Fixed by #277
Closed

Mage Github action appears to download mage on every run without caching #264

joshuacc opened this issue Oct 29, 2022 · 2 comments · Fixed by #277

Comments

@joshuacc
Copy link

Behaviour

Steps to reproduce this issue

  1. Set up a Github action that includes the mage action as a step
  2. Run the action multiple times

Expected behaviour

It should download mage on the first run, but not subsequent runs.

Actual behaviour

It downloads mage on every run.

I believe this is because the action never attempts to check if the mage executable is in the cache and skip the download if available. The tc.find() method is never invoked in the installer.

Configuration

name: mage
on: 
  pull_request:
    branches:
      - main
  push:
    branches:
      - main


jobs:
  build:
    name: mage build
    runs-on: windows-latest

    steps:
      - uses: actions/checkout@v3
      - name: Setup Go
        uses: actions/setup-go@v3
        with:
          go-version: '1.19.x'
      - name: Install dependencies
        run: go get .
      - name: Run Mage
        uses: magefile/mage-action@v2
        with:
          version: latest
          args: verify
      - name: Codecov
        uses: codecov/[email protected]
        with:
          token: ${{ secrets.CODECOV_TOKEN }}

Logs

logs_104.zip

@crazy-max
Copy link
Member

I believe this is because the action never attempts to check if the mage executable is in the cache and skip the download if available. The tc.find() method is never invoked in the installer.

This API is only useful on self-hosted runners. With public runners the instance is removed anyway. We could cache the binary using the cache API through https://github.com/actions/toolkit/tree/main/packages/cache

@dmvolod
Copy link
Contributor

dmvolod commented Mar 31, 2023

@crazy-max I would like to care about this issue, but have a quick question: what we need to do, if @actions/cache option is not available calling cache.isFeatureAvailable() on self-hosted or GHE? Is it require to handle both options: for local and global cache?
Thanks in advance

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

Successfully merging a pull request may close this issue.

3 participants