rtfeldman / rtfeldman/node-test-runner

Speed up CI builds by analysing diffs

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
140
Forks
83
Avg merge
8h 25m
Merged PRs (30d)
5

Description

Inspired by flake8, I think it would be cool to have a --with-diff option that would allow accepting a git diff and working out from that diff what tests could be affected by the changes in the diff which tests it is necessary to run.

I think the simplest solution would be built on top of #110 with the following assumptions:

  • the branch that is being diffed against is a safe branch where the build is already green (i.e. master where you only merge if tests pass).
  • only file names would be taken from the diff. So no need to worry about the contents of what changed in the file (that would be cool, but much more complicated)

A travis configuration would then look something like this:

sudo: false

cache:
  directories:
    - elm-stuff/build-artifacts
    - elm-stuff/packages
    - sysconfcpus
os:
  - linux

env:
  matrix:
    - ELM_VERSION=0.18.0 TARGET_NODE_VERSION=node

before_install:
  - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config

install:
  - nvm install $TARGET_NODE_VERSION
  - nvm use $TARGET_NODE_VERSION
  - node --version
  - npm --version
  - npm install -g elm@$ELM_VERSION elm-test
  - git clone https://github.com/NoRedInk/elm-ops-tooling
  - elm-ops-tooling/with_retry.rb elm package install --yes
  # Faster compile on Travis.
  - |
    if [ ! -d sysconfcpus/bin ];
    then
      git clone https://github.com/obmarg/libsysconfcpus.git;
      cd libsysconfcpus;
      ./configure --prefix=$TRAVIS_BUILD_DIR/sysconfcpus;
      make && make install;
      cd ..;
    fi
before_script:
  - $TRAVIS_BUILD_DIR/sysconfcpus/bin/sysconfcpus -n 2 elm-make ./tests/Main.elm

script:
  -  git diff -u $TRAVIS_COMMIT_RANGE | elm test --with-diff

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #110 and the existing elm-test command path; this proposal does not name implementation files or tests. Trace how the CLI consumes input, then define the --with-diff behavior around the shown git diff -u pipeline. Done means accepting changed file names and running only the tests affected by those files, with the Travis configuration working.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
ci-cd, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.