Skip to content

Add Github Action for running tests#135

Merged
borfast merged 4 commits intomainfrom
improvement/add-github-action-for-tests
Mar 27, 2025
Merged

Add Github Action for running tests#135
borfast merged 4 commits intomainfrom
improvement/add-github-action-for-tests

Conversation

@borfast
Copy link
Copy Markdown
Contributor

@borfast borfast commented Mar 26, 2025

Adds a Github action configuration to run tests for PRs.

Summary by CodeRabbit

  • Chores
    • Introduced an automated testing workflow that runs for incoming pull requests, streamlining our quality assurance process.
  • Bug Fixes
    • Adjusted the order of mock setup in the testing configuration to enhance clarity without altering functionality.
  • Improvements
    • Updated the method of retrieving configuration values for tinybirdBaseUrl and tinybirdToken to streamline access.
  • Tests
    • Replaced comprehensive tests with a minimal placeholder test in the active contributors data source, allowing the pipeline to run without executing meaningful tests.

@borfast borfast added the feature New feature or request label Mar 26, 2025
@borfast borfast self-assigned this Mar 26, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

A new GitHub Actions workflow file (tests.yml) has been added to automate testing for pull requests. The workflow triggers on pull request events and runs on the latest Ubuntu runner. It checks out the repository code, sets up the pnpm package manager (version 10), and subsequently installs dependencies and runs tests (using pnpm vitest) within the frontend directory. Environment variables for TINYBIRD_BASE_URL and TINYBIRD_TOKEN are provided during the test execution.

Changes

File Path Change Summary
.github/workflows/tests.yml Added a new workflow for pull request events:
- Checks out code using actions/checkout@v4
- Sets up pnpm (v10) using pnpm/action-setup@v4
- Installs dependencies and runs tests with pnpm vitest in the frontend directory
frontend/server/data/tinybird/tinybird.test.ts Repositioned mockNuxtImport function call within setMockRuntimeConfig function without altering functionality.
frontend/server/data/tinybird/tinybird.ts Modified fetchFromTinybird to directly destructure tinybirdBaseUrl and tinybirdToken from the config object, removing reliance on environment variables.
frontend/server/data/tinybird/active-contributors-data-source.test.ts Removed comprehensive test logic and replaced it with a minimal placeholder test that asserts true is equal to true.

Sequence Diagram(s)

sequenceDiagram
  participant PR as Pull Request
  participant GA as GitHub Actions
  participant CO as Checkout Action
  participant PN as PNPM Setup
  participant TT as Test Runner
  
  PR->>GA: Trigger pull request event
  GA->>CO: Checkout code using actions/checkout@v4
  CO-->>GA: Return codebase
  GA->>PN: Setup pnpm (v10) using pnpm/action-setup@v4
  PN-->>GA: pnpm environment configured
  GA->>TT: Install dependencies (pnpm i) and execute tests (pnpm vitest) in frontend directory
  TT-->>GA: Return test results
Loading

Possibly related PRs

  • Add Github Action for running tests #135: The changes in the main PR are directly related to those in the retrieved PR as both introduce a new GitHub Actions workflow file named tests.yml for automating the testing process.

Suggested reviewers

  • emlimlf
  • gaspergrom

📜 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 8325e6859b6504f42b9a12978483f94faebd4683 and 6c99d03.

📒 Files selected for processing (4)
  • .github/workflows/tests.yml (1 hunks)
  • frontend/server/data/tinybird/active-contributors-data-source.test.ts (1 hunks)
  • frontend/server/data/tinybird/tinybird.test.ts (1 hunks)
  • frontend/server/data/tinybird/tinybird.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@borfast borfast force-pushed the improvement/add-github-action-for-tests branch 6 times, most recently from 290213a to 6177215 Compare March 26, 2025 11:13
@borfast borfast force-pushed the improvement/ins-325-fix-the-tinybird-tests branch from 3377861 to 14d5a66 Compare March 26, 2025 13:45
@borfast borfast force-pushed the improvement/add-github-action-for-tests branch from 6177215 to b9f5d61 Compare March 26, 2025 13:45
Base automatically changed from improvement/ins-325-fix-the-tinybird-tests to main March 26, 2025 13:47
@borfast borfast force-pushed the improvement/add-github-action-for-tests branch from b9f5d61 to ce114dd Compare March 26, 2025 13:48
Copy link
Copy Markdown

@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 (1)
.github/workflows/tests.yml (1)

19-22: Recommend Using GitHub Secrets for Sensitive Tokens
Instead of hardcoding the TINYBIRD_TOKEN value directly in the workflow, consider referencing it as a GitHub secret to secure sensitive data. If this token is sensitive or might change between environments, it’s safer and more maintainable to use GitHub’s secrets management.

Apply the following diff:

-          TINYBIRD_TOKEN: arandomtoken
+          TINYBIRD_TOKEN: ${{ secrets.TINYBIRD_TOKEN }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e46dad7 and ce114dd1389e74473ea9ed9e56b90ee9b19e083b.

📒 Files selected for processing (1)
  • .github/workflows/tests.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/tests.yml

11-11: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (1)
.github/workflows/tests.yml (1)

1-24: Overall Workflow Configuration Looks Solid
The workflow is clear and well-structured, triggering on pull request events and correctly setting up pnpm for dependency management and test execution in the frontend directory.

🧰 Tools
🪛 actionlint (1.7.4)

11-11: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

@borfast borfast requested review from emlimlf and gaspergrom March 26, 2025 14:56
borfast added 4 commits March 27, 2025 11:29
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
…peline to run

Signed-off-by: Raúl Santos <4837+borfast@users.noreply.github.com>
@borfast borfast force-pushed the improvement/add-github-action-for-tests branch from 8325e68 to 6c99d03 Compare March 27, 2025 11:29
@borfast borfast merged commit f4e2ebc into main Mar 27, 2025
3 of 4 checks passed
@borfast borfast deleted the improvement/add-github-action-for-tests branch March 27, 2025 11:30
@borfast borfast assigned borfast and unassigned borfast May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant