Skip to content

Commit

Permalink
#104 Run tests for the user creating the PR and validate that the cal…
Browse files Browse the repository at this point in the history
…culate file exists for the user
  • Loading branch information
filiphr committed Jan 4, 2024
1 parent e5d0746 commit 73193bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ jobs:

- name: 'Build project'
run: mvn -B clean verify -Pci

- name: 'Test submission'
run: ./test.sh ${{ github.event.pull_request.user.login }}
if: github.event_name == 'pull_request'
8 changes: 7 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ if [ -z "$1" ]; then
exit 1
fi

CALCULATE_FILE="./calculate_average_$1.sh"
if [ ! -f "$CALCULATE_FILE" ]; then
echo "$CALCULATE_FILE does not exist."
exit 1
fi

for sample in $(ls src/test/resources/samples/*.txt); do
echo "Validating calculate_average_$1.sh -- $sample"

rm -f measurements.txt
ln -s $sample measurements.txt

diff <("./calculate_average_$1.sh") ${sample%.txt}.out
diff <(${CALCULATE_FILE}) ${sample%.txt}.out
done
rm measurements.txt

0 comments on commit 73193bf

Please sign in to comment.