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

Update cache for MINT_PATH and MINT_LINK_PATH #27

Closed
wants to merge 1 commit into from

Conversation

Wei18
Copy link

@Wei18 Wei18 commented Jul 9, 2024

@irgaly
Copy link
Owner

irgaly commented Jul 9, 2024

Thank you for your PR!

in #25, I have changed mint executable binary to $HOME/bin/mint from /usr/local/bin/mint.
Then that mint executable binary will be stored to cache by mintPaths and mintCacheKey.

setup-mint/src/main.ts

Lines 71 to 77 in 8e4c5f7

const binaryDirectoryPrefix = `${process.env['HOME']}`
const binaryDirectory = `${binaryDirectoryPrefix}/bin`
const mintPath = `${binaryDirectory}/mint`
const mintCacheKey = `${cachePrefix}-${process.env['RUNNER_OS']}-${process.env['RUNNER_ARCH']}-irgaly/setup-mint-${mintVersion}`
const mintPaths = [mintPath]
core.info(`mint cache key: ${mintCacheKey}`)
const mintRestored = ((await cache.restoreCache(mintPaths, mintCacheKey)) != undefined)

On the other hand, mintBinaryDirectory is ~/.mint/bin, this directory is used to putting SwiftPM command (xcodegen, swiftgen...) that was built by mint.

Because the mint binary itself is stored to $HOME/bin/mint and cached independently, so It's not affected by MINT_PATH or MINT_LINK_PATH.

Sorry these variable names is confusable in my code. GitHub Actions test result seems store / restore mint binary correctly.

https://github.com/irgaly/setup-mint/actions/runs/9816733619/job/27202672853

mint cache key: -macOS-ARM64-irgaly/setup-mint-0.17.0
Cache Size: ~1 MB (698706 B)
/opt/homebrew/bin/gtar -xf /Users/runner/work/_temp/92b1c20c-d55f-414f-a7ce-70645f0356f1/cache.tzst -P -C /Users/runner/work/setup-mint/setup-mint --delay-directory-restore --use-compress-program unzstd
Cache restored successfully
/Users/runner/bin/mint restored from cache

@Wei18
Copy link
Author

Wei18 commented Jul 9, 2024

I hit the issue when uses irgaly/setup-mint.

~/.mint/bin/mint // default behavior not found, 
$HOME/bin/mint // PASS

I believe the variable MINT_BIN = $MINT_LINK_PATH/mint is used everywhere...

Maybe restore-cache-path can follow

    const mintDirectory = (process.env['MINT_PATH'] || '~/.mint').replace(/^~\//, `${os.homedir()}/`)
    const mintBinaryDirectory = (process.env['MINT_LINK_PATH'] || '~/.mint/bin').replace(/^~\//, `${os.homedir()}/`)

@irgaly
Copy link
Owner

irgaly commented Jul 9, 2024

I want to hear what usecase do you have, and what problem you faced?


https://github.com/yonaskolb/Mint

The mint binary is default to be installed to /usr/local/bin/mint for Homebrew.

image

Or for make install.

https://github.com/yonaskolb/Mint/blob/7b55208b2609e590303a3c498372b72b3b7b4c03/Makefile#L5-L6

image

~/.mint/bin/mint is default for mint install.

image

@Wei18
Copy link
Author

Wei18 commented Jul 9, 2024

~/.mint/bin/mint is default for mint install.

Our developers use this path on local side,
so I hit the error mint not found when running after [email protected] on GitHub actions.

Good to know, there are 2 paths between homebrew and mint itself..

@Wei18
Copy link
Author

Wei18 commented Jul 11, 2024

@Wei18 Wei18 closed this Jul 11, 2024
@Wei18 Wei18 deleted the patch-1 branch July 11, 2024 15:43
@irgaly
Copy link
Owner

irgaly commented Jul 11, 2024

@Wei18

I released v1.6.0, and setup-mint@v1 automatically point this new version. Please check this.

https://github.com/irgaly/setup-mint/releases/tag/v1.6.0

v1.6.0 now, setup-mint will run mint bootstrap --link, so swift command symbolic link is placed in ~/.mint/bin/{executable}.
Also you can specify mint-executable-directory: ~/.mint/bin with your self hosted macOS runner, this option will prevent instllation error.

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 this pull request may close these issues.

2 participants