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

Cleanup test workflow #2801

Merged
merged 3 commits into from
Jan 31, 2025
Merged

Cleanup test workflow #2801

merged 3 commits into from
Jan 31, 2025

Conversation

sainak
Copy link
Member

@sainak sainak commented Jan 31, 2025

Proposed Changes

  • Brief of changes made.

Associated Issue

  • Link to issue here, explain how the proposed solution will solve the reported issue/ feature request.

Architecture changes

  • Remove this section if not used

Merge Checklist

  • Tests added/fixed
  • Update docs in /docs
  • Linting Complete
  • Any other necessary step

Only PR's with test cases included and passing lint and test pipelines will be reviewed

@ohcnetwork/care-backend-maintainers @ohcnetwork/care-backend-admins

Summary by CodeRabbit

  • Chores
    • Updated GitHub Actions workflow configuration.
    • Refined Docker image build process.
    • Modified database dump step conditions.
    • Enhanced control over pre-commit checks by replacing the action with explicit commands.
    • Added job names for clarity in workflows.

@sainak sainak requested a review from a team as a code owner January 31, 2025 06:13
Copy link
Contributor

coderabbitai bot commented Jan 31, 2025

📝 Walkthrough

Walkthrough

The pull request modifies the GitHub Actions workflow configuration files across several YAML files. Key changes include the removal of a Docker image baking step in .github/workflows/reusable-test.yml, an adjustment of the Docker image tag from care:dev to care_local, and refined conditions for database dump steps based on GitHub event names and branch references. Additionally, the .github/workflows/linter.yml file now includes enhanced control over pre-commit execution, while job names were added to .github/workflows/test-merge-queue.yml and .github/workflows/test-pull-request.yml. How original!

Changes

File Change Summary
.github/workflows/reusable-test.yml - Removed Docker bake action step
- Changed Docker image tag to care_local
- Modified database dump step conditions
.github/workflows/linter.yml - Replaced pre-commit/action@v3.0.1 with explicit commands for installation and execution
.github/workflows/test-merge-queue.yml - Added job name Test
.github/workflows/test-pull-request.yml - Added job name Test

Possibly related PRs

  • switched to ubuntu-24.04-arm runners #2742: The changes in this PR involve updating the runner environment in .github/workflows/reusable-test.yml, which is directly related to the changes made in the main PR that also updates the runner environment in the same file.
  • Improve workflow caching #2796: This PR enhances the caching mechanism in the workflow, which is relevant to the main PR's modifications that streamline the Docker image building process and refine caching strategies within the same workflow file.

Suggested reviewers

  • vigneshhari

Poem

🐳 Workflows dance, a GitHub ballet
Docker tags shift, cache finds its way
Conditions refined, steps elegantly twirl
CI/CD magic begins to unfurl!
mic drop 🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f969463 and 5e20e14.

📒 Files selected for processing (1)
  • .github/workflows/linter.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/linter.yml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test / Test
  • GitHub Check: Analyze (python)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
.github/workflows/reusable-test.yml (2)

54-54: Oh, changing the tag to 'care_local', I see what you did there.

The tag name change from 'care:dev' to 'care_local' is more descriptive of its purpose, which is... nice, I suppose. Though I can't help but wonder if we should consider a more standardized naming convention like 'care:local' to maintain consistency with Docker's conventional tag format.

-            --tag care_local \
+            --tag care:local \

Line range hint 77-78: Interesting choice having two separate database dump steps...

While I'm sure there's a perfectly good reason for having two separate 'make dump-db' commands, one might wonder if we could perhaps consolidate these into a single step with combined conditions. But who am I to judge? 😊

Consider consolidating the dumps:

      - name: Dump db and upload artifact
        if: |
          inputs.event_name == 'push' || 
          github.event_name == 'push'
        run: make dump-db

      - name: Upload db artifact
        if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/develop' }}
        uses: actions/upload-artifact@v4
        with:
          name: care-db-dump
          path: care_db.dump
          retention-days: 30
          compression-level: 0 # file is already compressed

Also applies to: 108-109

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 521f5bf and cdb8b09.

📒 Files selected for processing (1)
  • .github/workflows/reusable-test.yml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test / Test
  • GitHub Check: Analyze (python)

Copy link

codecov bot commented Jan 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.15%. Comparing base (521f5bf) to head (5e20e14).
Report is 6 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2801   +/-   ##
========================================
  Coverage    56.15%   56.15%           
========================================
  Files          215      215           
  Lines        10214    10214           
  Branches      1030     1030           
========================================
  Hits          5736     5736           
  Misses        4462     4462           
  Partials        16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/linter.yml (2)

31-40: Cache configuration looks good, I suppose.

The pre-commit cache setup is quite thorough. Though, if you really wanted to be precise, you could've included the Python version in the cache key. But I guess this works too.

Consider updating the cache key to include the Python version:

-          key:  ${{ runner.os }}-${{ runner.arch }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
+          key:  ${{ runner.os }}-${{ runner.arch }}-python-3.13-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

42-48: That's quite a condition you've got there.

The cache save logic is correct, though it's giving me a slight headache trying to parse that condition. Maybe we could make it more... readable? Just a thought.

Consider breaking down the condition using environment variables:

+      - name: Set cache save conditions
+        id: cache-conditions
+        run: |
+          echo "CACHE_MISS=${{ steps.cache-restore.outputs.cache-hit != 'true' }}" >> $GITHUB_ENV
+          echo "IS_PUSH=${{ github.event_name == 'push' }}" >> $GITHUB_ENV
+          echo "IS_TARGET_BRANCH=${{ github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging' }}" >> $GITHUB_ENV

       - name: Save pre-commit cache
         id: cache-save
-        if: ${{ steps.cache-restore.outputs.cache-hit != 'true' && github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/staging') }}
+        if: ${{ env.CACHE_MISS == 'true' && env.IS_PUSH == 'true' && env.IS_TARGET_BRANCH == 'true' }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cdb8b09 and f969463.

📒 Files selected for processing (3)
  • .github/workflows/linter.yml (2 hunks)
  • .github/workflows/test-merge-queue.yml (1 hunks)
  • .github/workflows/test-pull-request.yml (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • .github/workflows/test-pull-request.yml
  • .github/workflows/test-merge-queue.yml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Test / Test
🔇 Additional comments (1)
.github/workflows/linter.yml (1)

8-11: Oh, I see we're running this on every push now too.

The addition of push triggers for develop and staging branches is... reasonable. Just keep in mind this might increase our CI minutes usage, but I'm sure you've thought that through.

@vigneshhari vigneshhari merged commit 9be535f into develop Jan 31, 2025
8 checks passed
@vigneshhari vigneshhari deleted the sainak/even-faster-builds branch January 31, 2025 07:42
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