Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appsurify-testbrain-cli

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appsurify-testbrain-cli

Command Line Interface for Appsurify Testbrain.

  • 2024.1.27
  • PyPI
  • Socket score

Maintainers
1

image image image image

Appsurify Script Installation

Index

Refs

Installation Instructions

Requirements

Python 3.7+

Note: Support for Python 3.7 will be completed soon because this version is already considered deprecated

Support OS / Python

OSPythonSupport
Linux3.7🟢
Linux3.8🟢
Linux3.11🟢
MacOS3.7🟢
MacOS3.8🟢
MacOS3.11🟢
Windows3.7🟢
Windows3.8🟢
Windows3.11🟢

Installation Command

pip install appsurify-testbrain-cli

or

poetry add appsurify-testbrain-cli

Note: Use -U or --upgrade for force upgrade to last version

Docker image "appsurify-testbrain-cli"

Latest version

docker pull appsurifyinc/appsurify-testbrain-cli

Specify version

docker pull appsurifyinc/appsurify-testbrain-cli:2023.10.24

Howto usage

Repository Push | Git2Testbrain (git2appsurify)

This module is used to push changes in the repository to the Testbrain server for further analysis and testing optimization.

This module can be used as an independent command in the OS or as a subcommand of the main CLI application "testbrain"

Alias #1

testbrain git push --help

Alias #2

git2testbrain push --help

Alias #3

testbrain git2testbrain push --help

Possible params

RequiredParameterDefaultEnvDescriptionExample
yes--serverTESTBRAIN_SERVEREnter your testbrain server instance url.http://127.0.0.1
yes--tokenTESTBRAIN_TOKENEnter your testbrain server instance token.
yes--projectTESTBRAIN_PROJECTEnter your testbrain project name.
no--work-dircurrent dirTESTBRAIN_WORK_DIREnter the testbrain script working directory. If not specified, the current working directory will be used.
no--repo-nameTESTBRAIN_REPO_NAMEDefine repository name. If not specified, it will be automatically taken from the GitRepository repository.
no--repo-dircurrent dirTESTBRAIN_REPO_DIREnter the git repository directory. If not specified, the current working directory will be used.
no--branchcurrentTESTBRAIN_BRANCHEnter the explicit branch to process commits. If not specified, use current active branch.
no--start / --commitlatest (HEAD)TESTBRAIN_START_COMMITEnter the commit that should be starter. If not specified, it will be used 'latest' commit.
no--number1TESTBRAIN_NUMBER_OF_COMMITSEnter the number of commits to process.
no (unavailable)--blamefalseAdd blame information.
no--minimizefalseSuppress commit changes information. [default: (False)]
no--pr-modefalseTESTBRAIN_PR_MODEActivate PR mode
no-l, --loglevelINFOPossible failities: DEBUG/INFO/WARNING/ERROR
no--logfilestderrSave logs to file
no--quietfalseQuiet mode... everytime exit with 0

Usage examples

Push to Testbrain server only one last commit from current branch

git2testbrain --server https://demo.appsurify.com --token ************************************************************** --project DEMO

or

git2testbrain push --server https://demo.appsurify.com --token ************************************************************** --project DEMO

Push to Testbrain server last 100 commits started from specify commit into specify branch

git2testbrain --server https://demo.appsurify.com --token ************************************************************** --project DEMO --branch main --start latest --number 100

If need more process information - change logging level

git2testbrain --server https://demo.appsurify.com --token ************************************************************** --project DEMO --branch main --start latest --number 100 --loglevel DEBUG

Add log file with full or relative path.

git2testbrain --server https://demo.appsurify.com --token ************************************************************** --project DEMO --branch main --start latest --number 100 --loglevel INFO --logfile ./git2testbrain.log

If any crash errors script will create crash dump file into {WORK_DIR}/.crashdumps/

git2testbrain --server https://demo.appsurify.com --token ************************************************************** --project DEMO

You can see this message

2023-11-05 21:16:03 INFO     testbrain.repository.cli push [repository/cli.py:184] Running...
2023-11-05 21:16:03 DEBUG    testbrain.terminal.process Process.__init__ [terminal/process.py:22] Set up execution working dir ...
Dumped crash report to <path_to_work_dir>/.crashdumps/git2testbrain-2023-10-23-11-27-39.dump

Docker version usage

$(pwd) - git repository path

docker run --rm -it \
-v $(pwd)/:/data \
appsurifyinc/appsurify-testbrain-cli git2testbrain --server https://demo.appsurify.com --token ************************************************************** --project DEMO

CI example (github actions)

.github/workflows/testbrain-git2testbrain.yml

name: "Testbrain"

on:
    workflow_dispatch:
    pull_request:
        branches:
            - "main"
            - "development"
    push:
        branches:
            - "main"
            - "releases/*.*.*"
            - "development"

jobs:
    push-changes:
        name: "Push changes to server"
        runs-on: ubuntu-latest
        permissions:
            contents: write
            pull-requests: write
            checks: write
        steps:
            - name: "Checkout git"
              uses: actions/checkout@v4
              with:
                  fetch-depth: 0
            - name: "Extract branch name"
              shell: bash
              run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
              id: extract_branch
            - name: "Push"
              uses: addnab/docker-run-action@v3
              with:
                  image: appsurifyinc/appsurify-testbrain-cli:latest
                  options: -v ${{ github.workspace }}:/data -e TESTBRAIN_PR_MODE=${{ github.event_name == 'pull_request' }}
                  run: |
                      git2testbrain push --server ${{ vars.TESTBRAIN_SERVER }} --token ${{ secrets.TESTBRAIN_TOKEN }} --project ${{ vars.TESTBRAIN_PROJECT }} --branch ${{ steps.extract_branch.outputs.branch }} --start ${{ github.sha }} --number ${{ vars.TESTBRAIN_NUMBER_OF_COMMITS }} -l DEBUG
            - name: "Upload crash dumps"
              uses: actions/upload-artifact@v3
              if: failure()
              with:
                  name: "crashdumps"
                  path: ${{ github.workspace }}/.crashdumps/
                  retention-days: 1

Repository Checkout

This module is used to checkout branches during the execution of CI pipelines or manually. Cloning is not provided.

Alias #1

testbrain git checkout --help

Alias #2

git2testbrain checkout --help

Alias #3

testbrain git2testbrain checkout --help

Possible params

RequiredParameterDefaultEnvDescriptionExample
no--repo-dircurrent dirTESTBRAIN_REPO_DIREnter the git repository directory. If not specified, the current working directory will be used.
no--branchcurrentTESTBRAIN_BRANCHEnter the explicit branch to process commits. If not specified, use current active branch.
no--commitlatest (HEAD)TESTBRAIN_START_COMMITEnter the commit that should be starter. If not specified, it will be used 'latest' commit.
no--pr-modefalseTESTBRAIN_PR_MODEActivate PR mode
no--work-dircurrent dirTESTBRAIN_WORK_DIREnter the testbrain script working directory. If not specified, the current working directory will be used.
no-l, --loglevelINFOPossible failities: DEBUG/INFO/WARNING/ERROR
no--logfilestderrSave logs to file
no--quietfalseQuiet mode... everytime exit with 0

Usage examples

Checkout using Testbrain CLI

git2testbrain checkout --branch main -l INFO

or

git2testbrain checkout --branch main --commit 75ec2f061868c33306963a27d5164211553c049b --pr-mode -l INFO

or

git2testbrain checkout --branch main --commit 676c581 --pr-mode -l INFO

Docker version usage

$(pwd) - git repository path

docker run --rm -it \
-v $(pwd)/:/data \
appsurifyinc/appsurify-testbrain-cli git2testbrain checkout --branch main --commit 676c581 --pr-mode -l INFO

QA2Testbrain (runtestswithappsurify)

Coming soon. Currently under development. Use the old 'appsurifyci' package

pip install appsurifyci --upgrade

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc