Skip to content

Automate regression tests #1736

@poslegm

Description

@poslegm

There is a very helpful ability to perform regression testing of formatting changes:

  1. Clone https://github.com/olafurpg/scala-repos (a large bunch of real world Scala code)
  2. Format it with scalafmt built from master (or last release)
  3. Format it with scalafmt built from your branch
  4. push scala-repos changes
  5. Add link to commit difference to your PR

It would be good to have GitHub bot (or something like it) that can react on "regress, please" comment on pull request and run job with regression testing. And the add comment with difference link to PR.

Script draft:

#!/bin/bash

LAST_RELEASE=v2.4.2
REPOS=/tmp/regress-tests
BRANCH=alignment-fix
CONFIG=/tmp/.scalafmt.conf

build_scalafmt () {
  cd $REPOS/scalafmt
  git pull
  git checkout $1
  sbt cli/assembly
}

format_scala_repos () {
  cd $REPOS/scala-repos
  git checkout master
  git pull
  git branch $BRANCH
  git checkout $BRANCH 
  java -jar $REPOS/scalafmt/scalafmt-cli/target/scala-2.13/scalafmt.jar -c $CONFIG $REPOS/scala-repos/
  git commit -a -m "formatted with ${1}"
  git push -u origin HEAD
}

git clone git@github.com:poslegm/scalafmt.git $REPOS/scalafmt
git clone git@github.com:poslegm/scala-repos.git $REPOS/scala-repos

build_scalafmt $LAST_RELEASE
format_scala_repos $LAST_RELEASE

build_scalafmt $BRANCH
format_scala_repos $BRANCH

Related: #154

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions