Skip to content

Commit

Permalink
Add script for regression testing against older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Feb 10, 2024
1 parent b83bd94 commit a8b4f68
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 200 deletions.
128 changes: 0 additions & 128 deletions test/add_credo_plugin_to_project.exs

This file was deleted.

38 changes: 38 additions & 0 deletions test/regression/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# common setup

set -e

DIRNAME=$( cd "$( dirname "$0" )" && pwd )
CREDO_ROOT=$( cd "$DIRNAME/../.." && pwd )

# script specific sources, variables and function definitions

OLD_CREDO_VERSION=$1
GIT_REPO=$2
PROJECT_NAME=$3

mkdir -p tmp

WORKING_DIR=$( cd "$CREDO_ROOT/tmp/$PROJECT_NAME" && pwd )

cd tmp

rm -fr $PROJECT_NAME
git clone $GIT_REPO $PROJECT_NAME --depth=1 --quiet

cd $CREDO_ROOT

# TODO: add --enable-disabled-checks .

mix credo --working-dir $WORKING_DIR \
--strict --format oneline --mute-exit-status | sort | sed -e 's/tmp\///g' > tmp/results_current.txt

cp test/regression/run_older_credo_version.exs tmp/
cd tmp

mix run --no-mix-exs run_older_credo_version.exs $OLD_CREDO_VERSION --working-dir $WORKING_DIR \
--strict --format oneline --mute-exit-status | sort | sed -e 's/tmp\///g' > results_old.txt

diff results_old.txt results_current.txt && echo "No differences in issues."
7 changes: 7 additions & 0 deletions test/regression/run_older_credo_version.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[credo_version|rest] = System.argv()

Mix.install([
{:credo, credo_version}
])

Credo.run(rest)
4 changes: 2 additions & 2 deletions test/run_on_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
set -e

DIRNAME=$( cd "$( dirname "$0" )" && pwd )
PROJECT_ROOT=$( cd "$DIRNAME/.." && pwd )
CREDO_ROOT=$( cd "$DIRNAME/.." && pwd )

# script specific sources, variables and function definitions

Expand All @@ -19,7 +19,7 @@ CREDO_ARG5=$7

# setup

cd $PROJECT_ROOT
cd $CREDO_ROOT

mkdir -p tmp

Expand Down
4 changes: 2 additions & 2 deletions test/test_if_tests_fail_after_resetting_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
set -e

DIRNAME=$( cd "$( dirname "$0" )" && pwd )
PROJECT_ROOT=$( cd "$DIRNAME/.." && pwd )
CREDO_ROOT=$( cd "$DIRNAME/.." && pwd )

# execution

cd $PROJECT_ROOT
cd $CREDO_ROOT

git checkout master lib/

Expand Down
65 changes: 0 additions & 65 deletions test/test_on_projects.sh

This file was deleted.

6 changes: 3 additions & 3 deletions test/test_phoenix_compatibility.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set -e

DIRNAME=$( cd "$( dirname "$0" )" && pwd )
PROJECT_ROOT=$( cd "$DIRNAME/.." && pwd )
CREDO_ROOT=$( cd "$DIRNAME/.." && pwd )

# script specific sources, variables and function definitions

Expand All @@ -20,7 +20,7 @@ PROJECT_DIRNAME=tmp/$PROJECT_NAME

yes | mix archive.install hex phx_new

cd $PROJECT_ROOT
cd $CREDO_ROOT

mkdir -p tmp

Expand All @@ -39,6 +39,6 @@ echo ""
echo "--> Running Credo ..."
echo ""

cd $PROJECT_ROOT
cd $CREDO_ROOT

mix credo $PROJECT_DIRNAME

0 comments on commit a8b4f68

Please sign in to comment.