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

Cache invalidation issue for test files #690

Open
soumyart opened this issue Aug 7, 2023 · 1 comment
Open

Cache invalidation issue for test files #690

soumyart opened this issue Aug 7, 2023 · 1 comment

Comments

@soumyart
Copy link

soumyart commented Aug 7, 2023

Describe the bug
For the very first time when I run the test command lage is triggering the test scripts. But when I add/update test file without change in any source file lage is not triggering the test case and return the cached state.

I have to manually pass --no-cache options which is a pain as it triggers script in all the packages.

Below is my lage config:

module.exports = {
  pipeline: {
    build: ['^build'],
    lint: ['^build'],
    test: ['^build'],
  },
  ignore: ['*.md', '.vscode/**'],

  cacheOptions: {
    // These are the subset of files in the package directories that will be saved into the cache
    outputGlob: ['dist/**/*', '!node_modules'],

    // These are relative to the git root, and affects the hash of the cache
    // Any of these file changes will invalidate cache
    environmentGlob: ['*.js', '*.json', '*.yml'],
  },
  npmClient: 'yarn',
};

To Reproduce
Steps to reproduce the behavior:

  1. Create a mono repo with above lage config file.
  2. Run lage test
  3. Update any test file
  4. Run lage test
  5. Check the lage output

Expected behavior
Lage should run the test case of the updated package but it return the cached result

Environment/Troubleshooting

System:
    OS: Windows 10 10.0.19045
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11850H @ 2.50GHz
    Memory: 38.57 GB / 63.20 GB
  Binaries:
    Node: 18.15.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 3.6.1 - C:\Program Files\nodejs\yarn.CMD
    npm: 9.5.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.6.0 - C:\Program Files\nodejs\pnpm.CMD
  Managers:
    pip3: 21.1.1 - ~\AppData\Local\Programs\Python\Python38\Scripts\pip3.EXE
  Utilities:
    Git: 2.41.0. - /mingw64/bin/git
    Curl: 8.1.2 - C:\Program Files\Git\mingw64\bin\curl.EXE
  Virtualization:
    Docker: 24.0.2 - C:\Program Files\Docker\Docker\resources\bin\docker.EXE
  IDEs:
    VSCode: 1.81.0 - C:\Users\soumtr\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  Languages:
    Bash: 5.2.15 - C:\Program Files\Git\usr\bin\bash.EXE
    Go: 1.20.2 - C:\Program Files\Go\bin\go.EXE
    Java: 11.0.18 - /c/Program Files/Amazon Corretto/jdk11.0.18_10/bin/javac
    Perl: 5.36.1 - C:\Program Files\Git\usr\bin\perl.EXE
    Python: 3.8.10 - /c/Users/soumtr/AppData/Local/Programs/Python/Python38/python
    Python3: 3.8.10 - /c/Users/soumtr/.pyenv/pyenv-win/shims/python3
  Browsers:
    Chrome: master_preferences
    Edge: Spartan (44.19041.1266.0), Chromium (114.0.1823.86)
    Internet Explorer: 11.0.19041.1566
  Monorepos:
    Yarn Workspaces: 3.6.1
@chazmuzz
Copy link

chazmuzz commented Jan 2, 2024

@soumyart did you try adding the *.js files to the test task inputs?

E.g:

module.exports = {
  pipeline: {
    build: ['^build'],
    lint: ['^build'],
    test: { dependsOn: ['^build'], inputs: ['**/*.js', '*.json', '*.yml'] }, // Put the inputs here, 
  },
  ignore: ['*.md', '.vscode/**'],

  cacheOptions: {
    // These are the subset of files in the package directories that will be saved into the cache
    outputGlob: ['dist/**/*', '!node_modules'],

    // These are relative to the git root, and affects the hash of the cache
    // Any of these file changes will invalidate cache
    environmentGlob: [],  // Probably should avoid adding things in here because any changes here would invalidate all caches
  },
  npmClient: 'yarn',
};

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

No branches or pull requests

2 participants