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

build(ci): Use cache in GitHub Actions #4671

Merged
merged 3 commits into from
Mar 2, 2022
Merged

build(ci): Use cache in GitHub Actions #4671

merged 3 commits into from
Mar 2, 2022

Conversation

niheaven
Copy link
Member

@niheaven niheaven commented Jan 17, 2022

Description

Use https://github.com/actions/cache https://github.com/potatoqualitee/psmodulecache to cache PowerShell modules in GitHub Actions. (Really not happy while working with https://github.com/actions/cache)

Motivation and Context

PowerShell modules installation is the most time-consuming step of CI test, this fix tries to skip them.

It also skips modules installation if there're ones.

How Has This Been Tested?

I don't find an effective way to test the PR, but it seems to work

From CI results below, it found cache, but doesn't use them. Maybe a little more tweak are needed.

Use https://github.com/potatoqualitee/psmodulecache to cache PowerShell Modules, it works fine as this PR's two commits.

Checklist:

  • I have read the Contributing Guide.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

@niheaven
Copy link
Member Author

niheaven commented Jan 17, 2022

Should we remove CI running triggered by push if every change in Scoop Core must submit a PR? For this one, GHA runs four tests of which two are unneeded.

@rashil2000
Copy link
Member

For this one, GHA runs four tests of which two are unneeded.

I think this happens only when a PR is opened from Scoop core itself. If someone from outside forks and sends a PR it will run twice.

@niheaven
Copy link
Member Author

I mean, since a PR is required, is it needed for other pushed branches to pass CI test? This test should be run only when a PR is submitted.

@rashil2000
Copy link
Member

Hmm, yeah, makes sense

@rashil2000
Copy link
Member

Will it be possible to cache stuff for other workflows too, like pull request/issue handler, hash fix/404 error handler, /verify etc.? Currently it installs scoop, sets up 7zip etc. on each run and it takes a lot of time.

@niheaven
Copy link
Member Author

niheaven commented Jan 20, 2022

Caching scoop is not preferred since we need CI to test modified scoop code. For decompressing tools, current CI won't fetch them until needed, see

Scoop/test/bin/test.ps1

Lines 30 to 33 in 5f407ca

if (!$CI_WIN) {
Write-Warning 'Skipping tests and code linting for decompress.ps1 because they only work on Windows'
$excludes += 'Decompress'
}
and

Scoop/test/bin/test.ps1

Lines 42 to 45 in 5f407ca

if (!($changedScripts -like '*decompress.ps1') -and !($changedScripts -like '*Decompress.Tests.ps1')) {
Write-Warning "Skipping tests and code linting for decompress.ps1 files because it didn't change"
$excludes += 'Decompress'
}

If Decompress is excluded, the tools installation is skipped.

@rashil2000
Copy link
Member

... we need CI to test modified scoop code.

Why would this be required for issues/PR handlers?

@niheaven
Copy link
Member Author

niheaven commented Jan 20, 2022

Why would this be required for issues/PR handlers?

You mean tests in bucket repo? Yes, scoop code should be cached there, and a proper hash should be found to make sure it is in HEAD of 'master' branch except for Tests bucket.

@rashil2000
Copy link
Member

You mean tests in bucket repo?

Yes, I meant for the buckets itself

@niheaven
Copy link
Member Author

I'll take some time to check the probability. It should be cacheable, IMO.

@niheaven niheaven merged commit 765d3aa into develop Mar 2, 2022
@niheaven niheaven deleted the fix-ci-cache branch March 2, 2022 03:48
se35710 pushed a commit to se35710/scoop that referenced this pull request Mar 8, 2022
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.

3 participants