Skip to content

Commit

Permalink
reconfiguring travis for slightly shorter build times (#343)
Browse files Browse the repository at this point in the history
* using java -jar instead of sbt for running obsidian in the testing loop for ganache tests; trying to get travis to run tests in parallel

* second shot at travis parallel jobs

* third shot at travis parallel jobs

* small changes, another travis round

* debugging travis

* refining travis job

* refining travis job 3

* updating checks, travis job fussing 4

* removing SBT hack

* sbt hack seems to no longer be needed, so removing the commented out version

* trying jdk13 for laughs

* jdk 13 does not work and i do not want to fix it right now

* removing yul tests that are now deprecated by running through ganache
  • Loading branch information
ivoysey committed Jun 8, 2021
1 parent 692c4aa commit 26e3bc4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 51 deletions.
21 changes: 7 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,14 @@ before_install:
- ./travis_specific/install_ganache.sh

install:
- |
# from https://github.com/sbt/sbt/releases:
# update this only when sbt-the-bash-script needs to be updated
export SBT_LAUNCHER=1.5.0
export SBT_OPTS="-Dfile.encoding=UTF-8"
curl -L --silent "https://github.com/sbt/sbt/releases/download/v$SBT_LAUNCHER/sbt-$SBT_LAUNCHER.tgz" > $HOME/sbt.tgz
tar zxf $HOME/sbt.tgz -C $HOME
sudo rm /usr/local/bin/sbt
sudo ln -s $HOME/sbt/bin/sbt /usr/local/bin/sbt
script:
- gradle publish -b Obsidian_Runtime/build.gradle
- sbt ++$TRAVIS_SCALA_VERSION test # this actually builds Obsidian
- bash travis_specific/tests.sh
- bash travis_specific/ganache_tests.sh
- sbt ++$TRAVIS_SCALA_VERSION assembly # this builds the Obsidian jar

env:
- TEST_SUITE=tests.sh
- TEST_SUITE=ganache_tests.sh

script: "travis_specific/$TEST_SUITE"

cache:
directories:
Expand Down
2 changes: 0 additions & 2 deletions resources/tests/YulTests/EmptyContract.obs

This file was deleted.

18 changes: 0 additions & 18 deletions resources/tests/YulTests/EmptyContract.sh

This file was deleted.

18 changes: 13 additions & 5 deletions travis_specific/ganache_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ else
tests=(resources/tests/GanacheTests/*.json)
fi

missing_json=$(comm -13 <(ls resources/tests/GanacheTests/*.json | xargs basename -s '.json') <(ls resources/tests/GanacheTests/*.obs | xargs basename -s '.obs'))
missing_json=$(diff --changed-group-format='%<%>' --unchanged-group-format='' <(ls resources/tests/GanacheTests/*.json | xargs basename -s '.json') <(ls resources/tests/GanacheTests/*.obs | xargs basename -s '.obs'))
if [ "$missing_json" ]
then
echo "******** warning: some tests are defined but do not have json files and will not be run:"
Expand All @@ -36,6 +36,14 @@ fi
# keep track of which tests fail so that we can output that at the bottom of the log
failed=()

# check that the jar file for obsidian exists; `sbt assembly` ought to have been run before this script gets run
obsidian_jar="$(find target/scala* -name obsidianc.jar | head -n1)"
if [[ ! "$obsidian_jar" ]]
then
echo "Error building Obsidian jar file, exiting."
exit 1
fi

for test in "${tests[@]}"
do
echo "---------------------------------------------------------------"
Expand Down Expand Up @@ -68,16 +76,16 @@ do
fi

# compile the contract to yul, also creating the directory to work in, failing otherwise
if ! sbt "runMain edu.cmu.cs.obsidian.Main --yul resources/tests/GanacheTests/$NAME.obs"
if ! $(java -jar $obsidian_jar --yul resources/tests/GanacheTests/$NAME.obs)
then
echo "$NAME test failed: sbt exited cannot compile obs to yul"
failed+=("$test [sbt]")
echo "$NAME test failed: cannot compile obs to yul"
failed+=("$test [compile obs to yul]")
exit 1
fi

if [ ! -d "$NAME" ]; then
echo "$NAME directory failed to get created"
failed+=("$test [directory]")
failed+=("$test [output directory]")
exit 1
fi

Expand Down
12 changes: 0 additions & 12 deletions travis_specific/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,3 @@ cd resources/tests/FabricTests || exit 1
bash IntContainerTest.sh
bash MultipleConstructorsTest.sh
bash TransactionInConstructorTest.sh

cd ../../../

# Yul tests -- note that these only test if the compiler runs without an error
cd resources/tests/YulTests || exit 1

echo "running Yul tests, currently at $( pwd -P)"
for test in *.sh
do
echo "running Yul Test $test"
bash "$test"
done

0 comments on commit 26e3bc4

Please sign in to comment.