Enjinx
  • Enjinx
    • What is Enjinx ?
    • Setup and Installation
      • Install on VSCode
      • Install on JetBrains IDEs
      • Subscription Plans
      • Sign in
      • Extension Settings
      • Uninstall Enjinx
    • Enjinx Chat
      • Focus
        • Current File Focus
        • Git Diff Focus
      • Context
        • Add Context
        • Add image as Context
      • Commands
        • /ask
        • /changelog
        • /commit
        • /describe
        • /docstring
        • /enhance
        • /explain
        • /find-on-github
        • /generate-best-practices
        • /help
        • /improve
        • /issues
        • /quick-test
        • /recap
        • /review
        • /test-suite
      • Chat History
      • Model Selection
      • Company Codebase
    • Code Completion
    • Coding Agent
      • Tasks
      • Continuous Code Improvement
    • Test Generation
      • Using Test Generation
      • Behaviors
      • Test Suite
      • Configuration
      • Example Test
      • Context
      • Running Tests
    • Data Sharing
  • Enjinx cover
    • What is Enjinx Cover ?
    • Setup
      • GitHub Action
      • CLI
    • Feature Flags
    • Database Usage
    • Coverage Report
    • Examples
  • Alpha Codium
    • What is Alpha Codium?
    • Setup
    • Usage
      • Configuration
      • Solving Problems
      • Solving the entire dataset
      • Evaluation
    • Technical Q&A
    • Research Paper
    • Examples
Powered by GitBook
On this page
  1. Enjinx cover
  2. Setup

GitHub Action

Automatically enhance test coverage as part of your CI pipelines using Enjinx Cover's GitHub Action.

  1. Run Enjinx Cover to extend existing test suites throughout the repository, in order to increase overall test coverage.

  2. Trigger Enjinx Cover on a code change, to ensure the new code is properly tested with good coverage.

Once Enjinx Cover is added to your repository as a Github Action, it can be triggered in various scenarios: when a new PR is opened, on a scheduled basis, manually and more.

Setup GitHub Action

Example Usage

Use Enjinx's example repository to help you set up Enjinx Cover GitHub Action

Add the following to your workflow:

Copy

Copy

name: Run Enjinx-Cover

on:
  pull_request:
    branches:
      - main
    types:
      - opened # Trigger only when a pull request is opened

permissions:
  pull-requests: write # Allows commenting on pull requests
  contents: write # Allows reading and writing files

jobs:
  run-Enjinx-cover:
    runs-on: ubuntu-22.04
    steps:
      
      ... # Set up your python test environment

      - name: Enjinx-cover
        uses: Enjinx-ai/Enjinx-ci/.github/actions/Enjinx-cover@v0.1.1
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          project_language: python
          project_root: <path/to/your/python/project>
          code_coverage_report_path: <path/to/your/coverage.xml>
          test_command: "pytest --cov=. --cov-report=xml --cov-report=term"
          model: gpt-4o

        env:
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

Inputs

Variable NameDescriptionRequired?Default

github_token

GitHub token for authentication

Yes

N/A

project_language

Programming language of the project

No

python

project_root

Root directory of the project

No

.

code_coverage_report_path

Path to the coverage.xml file

No

./coverage.xml

test_command

Command to run tests (must generate coverage.xml)

Yes

N/A

model

LLM model name

No

gpt-4o

max_iterations

Maximum test generation attempts per file

No

3

desired_coverage

Target coverage percentage

No

100

Repository secret

Note: This requirement is temporary. We will enable users to issue access tokens from their Enjinx Portal in a future release.

Workflow permissions

For this action to work you must explicitly allow GitHub Actions to create pull requests. This setting can be found in a repository's settings under Actions > General > Workflow permissions.

Outputs

If the Enjinx Cover agent succeeds in improving coverage it will comment on your PR with a link to a patch PR containing the new tests.

PreviousSetupNextCLI

Last updated 5 months ago

Add OPENAI_API_KEY to your .

repository secrets