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

monorepo prep: use contextual cache names, add working_directory input #41

Merged
merged 4 commits into from
Feb 20, 2025

Conversation

matt-codecov
Copy link
Contributor

@matt-codecov matt-codecov commented Feb 13, 2025

currently we use cache names like cache-requirements. when worker and api are in different repositories, that's fine - their caches will remain separate. but when we move them all into a monorepo, they will collide. this PR includes the image repo argument in the cache name

our workflows all also assume they are operating out of the repository root. https://github.com/codecov/umbrella, however, will probably organize them in a structure like this:

- apps
  - worker
  - codecov-api
- libs
  - shared

so this PR adds a working_directory input and uses it as the default working directory for all run:-type steps. we can run worker tests in umbrella by calling the run-tests.yml workflow with working_directory: apps/worker. some things to note:

  • the default is . so no change should be necessary to the current separate repos. this is just helpful for umbrella
  • uses:-type steps (like cache actions) will not use the default working directory. for these steps, paths need to be prefixed with ${{ inputs.working_directory }}/

down the line we should absorb these workflows into the monorepo but fine for now

@matt-codecov matt-codecov changed the title add optional working-directory input to workflows monorepo prep: use contextual cache names, add working_directory input Feb 13, 2025
@matt-codecov matt-codecov requested review from trent-codecov and a team February 13, 2025 01:10
@trent-codecov
Copy link
Contributor

LGTM. You can release it and opt in your branch to bump the version in api/worker. If that CI works then you know your change is legit.

down the line we should absorb these workflows into the monorepo but fine for now

Maybe but we also use these same workflows in a couple other repos including internal ones. Not saying we are shackled to these but its nice to have it all in one place.

@matt-codecov matt-codecov force-pushed the pr41 branch 4 times, most recently from e342767 to fd45841 Compare February 20, 2025 00:23
requirements.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/docker/Dockerfile.requirements') }}
${{ inputs.working_directory }}/requirements.tar
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles(format('{0}/**/requirements.txt', inputs.working_directory)) }}-${{ hashFiles(format('{0}/**/docker/Dockerfile.requirements', inputs.working_directory)) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will hash a requirements.txt. For migrating to uv, I will need it to hash a uv.lock file instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted. i will skip that for the moment because i don't want it to blow up if the lockfile doesn't exist yet

@matt-codecov matt-codecov merged commit 0b65427 into main Feb 20, 2025
1 check passed
@matt-codecov matt-codecov deleted the pr41 branch February 20, 2025 19:29
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.

4 participants