diff --git a/docker/concordia-contracts/Dockerfile b/docker/concordia-contracts/Dockerfile index 3098f71..44fb384 100644 --- a/docker/concordia-contracts/Dockerfile +++ b/docker/concordia-contracts/Dockerfile @@ -42,25 +42,13 @@ RUN yarn compile # -------------------------------------------------- FROM compile as test +WORKDIR /opt/concordia-contracts + +COPY ./docker/concordia-contracts/test-contracts.sh . + WORKDIR /usr/src/concordia/packages/concordia-contracts -ARG SKIP_TESTS -ARG CI - -RUN if [ -z "${SKIP_TESTS}" ]; then \ - yarn _eslint -f html -o /usr/test-reports/concordia-contracts-eslint.html --no-color \ - && (yarn _solhint > /usr/test-reports/concordia-contracts-solhint.report) \ - && (yarn test > /usr/test-reports/concordia-contracts-truffle-tests.report); \ - if [ $? -eq 0 ]; then \ - if [ -n "${CI}" ]; then \ - mkdir /usr/test-results && touch /usr/test-results/pass; \ - fi \ - else \ - echo "SOME TESTS FAILED!"; \ - fi \ - else \ - echo "Skipping tests..."; \ - fi +ENTRYPOINT ["/opt/concordia-contracts/test-contracts.sh"] # -------------------------------------------------- # Stage 4 (Build) diff --git a/docker/concordia-contracts/migrate.sh b/docker/concordia-contracts/migrate.sh index 3b12d96..b021223 100644 --- a/docker/concordia-contracts/migrate.sh +++ b/docker/concordia-contracts/migrate.sh @@ -1,7 +1,3 @@ #!/bin/sh -if [ -z "${SKIP_MIGRATE}" ]; then - cd /usr/src/concordia/packages/concordia-contracts && yarn migrate --network develop -else - echo "Skipping migration..." -fi +cd /usr/src/concordia/packages/concordia-contracts && yarn _migrate --network "${MIGRATE_NETWORK}" diff --git a/docker/concordia-contracts/test-contracts.sh b/docker/concordia-contracts/test-contracts.sh new file mode 100644 index 0000000..2a64a97 --- /dev/null +++ b/docker/concordia-contracts/test-contracts.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +yarn _eslint -f html -o /usr/test-reports/concordia-contracts-eslint.html --no-color && + (yarn _solhint >/usr/test-reports/concordia-contracts-solhint.report) && + (yarn test >/usr/test-reports/concordia-contracts-truffle-tests.report) + +if [ $? -eq 0 ]; then + # Tests ran successfully + if [ -n "${CI}" ]; then + # This is a ci run + # Create a pass file to alert the ci about test success + # mkdir /usr/test-results && touch /usr/test-results/pass + exit 0 + fi +else + echo "SOME TESTS FAILED!" + exit 1 +fi