|
| 1 | +version: 2 |
| 2 | +jobs: |
| 3 | + build: |
| 4 | + machine: true |
| 5 | + working_directory: ~/workdir |
| 6 | + steps: |
| 7 | + - checkout |
| 8 | + - run: |
| 9 | + name: Clone test project |
| 10 | + working_directory: ~/ |
| 11 | + command: | |
| 12 | + (git -C ~/codacy-plugins-test fetch --all && |
| 13 | + git -C ~/codacy-plugins-test reset --hard origin/master) || |
| 14 | + git clone git://github.com/codacy/codacy-plugins-test.git ~/codacy-plugins-test |
| 15 | + - restore_cache: |
| 16 | + key: dependencies-{{ checksum "build.sbt" }} |
| 17 | + - run: |
| 18 | + name: Compile test project |
| 19 | + working_directory: ~/codacy-plugins-test |
| 20 | + command: sbt compile |
| 21 | + - run: |
| 22 | + name: Publish tool docker locally |
| 23 | + working_directory: ~/workdir |
| 24 | + command: sbt 'set version in Docker := "latest"' "set name := \"$CIRCLE_PROJECT_REPONAME\"" docker:publishLocal |
| 25 | + - save_cache: |
| 26 | + key: dependencies-{{ checksum "build.sbt" }} |
| 27 | + paths: |
| 28 | + - "~/.ivy2" |
| 29 | + - "~/.m2" |
| 30 | + - "~/.sbt" |
| 31 | + - "~/codacy-plugins-test/target" |
| 32 | + - "~/codacy-plugins-test/project/target" |
| 33 | + - "~/codacy-plugins-test/project/project" |
| 34 | + - "~/workdir/target" |
| 35 | + - "~/workdir/project/target" |
| 36 | + - "~/workdir/project/project" |
| 37 | + - run: |
| 38 | + name: Test json |
| 39 | + working_directory: ~/codacy-plugins-test |
| 40 | + command: sbt -Dcodacy.tests.ignore.descriptions=true "run-main codacy.plugins.DockerTest json $CIRCLE_PROJECT_REPONAME:latest" |
| 41 | + - run: |
| 42 | + name: Test patterns |
| 43 | + working_directory: ~/codacy-plugins-test |
| 44 | + command: sbt -Dcodacy.tests.noremove=true -Dcodacy.tests.threads=8 "run-main codacy.plugins.DockerTest pattern $CIRCLE_PROJECT_REPONAME:latest" |
| 45 | + - deploy: |
| 46 | + name: Push application Docker image |
| 47 | + command: | |
| 48 | + if [ "${CIRCLE_BRANCH}" == "master" ]; then |
| 49 | + docker login -u $DOCKER_USER -p $DOCKER_PASS |
| 50 | + docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME |
| 51 | + docker tag $CIRCLE_PROJECT_REPONAME codacy/$CIRCLE_PROJECT_REPONAME:1.0.$CIRCLE_BUILD_NUM |
| 52 | + docker push codacy/$CIRCLE_PROJECT_REPONAME |
| 53 | + fi |
| 54 | +
|
| 55 | +workflows: |
| 56 | + version: 2 |
| 57 | + build-and-deploy: |
| 58 | + jobs: |
| 59 | + - build |
0 commit comments