Skip to content

Instantly share code, notes, and snippets.

@MakamuEvans
Last active February 22, 2021 17:48
Show Gist options
  • Select an option

  • Save MakamuEvans/951a8625b4628a41f1ff6cc0bb4afba0 to your computer and use it in GitHub Desktop.

Select an option

Save MakamuEvans/951a8625b4628a41f1ff6cc0bb4afba0 to your computer and use it in GitHub Desktop.

Revisions

  1. MakamuEvans revised this gist Feb 22, 2021. 1 changed file with 14 additions and 4 deletions.
    18 changes: 14 additions & 4 deletions config.yaml
    Original file line number Diff line number Diff line change
    @@ -1,20 +1,29 @@
    # Check https://circleci.com/docs/2.0/language-java/ for more details

    version: 2.1
    jobs:
    build:
    docker:
    # specify the version you desire here
    # specify the version you desire here.
    # its always a good idea to use circle-ci prebuilt images
    - image: circleci/openjdk:11-browsers-legacy
    #specify system properties
    environment:
    DB_ROOT_USER: root
    DB_URL: jdbc:mysql://localhost:3306/farm
    # To easen your work, set the below values to be the same as those of your development environment
    # This will ensure your application.properties values will be used accross the dev env and the circle CI images
    # -----alternatively--------
    # you may define env variables and create a Datasource bean and configure accordingly.
    DB_ROOT_USER: root
    DB_URL: jdbc:mysql://localhost:3306/farm #farm indicates the name of the database
    DB_DRIVER: com.mysql.cj.jdbc.Driver
    DB_PASS: ""
    # Customize the JVM maximum heap limit
    MAVEN_OPTS: -Xmx3200m

    # Speficy your version of MYSQL
    - image: circleci/mysql:5.7
    environment:
    # Remember to always use passwords, and strong ones. Dont be like me.
    MYSQL_ALLOW_EMPTY_PASSWORD: yes
    MYSQL_ROOT_PASSWORD: ''

    @@ -27,7 +36,8 @@ jobs:
    # preinstalled in circleci/* docker image
    command: dockerize -wait tcp://localhost:3306 -timeout 1m
    #install mysql client
    - run: sudo apt-get install mysql-client
    #if default-mysql-client fails, try the old way "sudo apt-get install mysql-client"
    - run: sudo apt-get install default-mysql-client
    # create databases
    - run: mysql -h 127.0.0.1 -u root -e "create database farm"

  2. MakamuEvans created this gist Feb 22, 2021.
    51 changes: 51 additions & 0 deletions config.yaml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    version: 2.1
    jobs:
    build:
    docker:
    # specify the version you desire here
    - image: circleci/openjdk:11-browsers-legacy
    #specify system properties
    environment:
    DB_ROOT_USER: root
    DB_URL: jdbc:mysql://localhost:3306/farm
    DB_DRIVER: com.mysql.cj.jdbc.Driver
    DB_PASS: ""
    # Customize the JVM maximum heap limit
    MAVEN_OPTS: -Xmx3200m

    - image: circleci/mysql:5.7
    environment:
    MYSQL_ALLOW_EMPTY_PASSWORD: yes
    MYSQL_ROOT_PASSWORD: ''

    working_directory: ~/repo

    steps:
    - checkout
    - run:
    name: Wait for Database Connection
    # preinstalled in circleci/* docker image
    command: dockerize -wait tcp://localhost:3306 -timeout 1m
    #install mysql client
    - run: sudo apt-get install mysql-client
    # create databases
    - run: mysql -h 127.0.0.1 -u root -e "create database farm"

    # Download and cache dependencies
    - restore_cache:
    keys:
    - v1-dependencies-{{ checksum "pom.xml" }}
    # fallback to using the latest cache if no exact match is found
    - v1-dependencies-

    # - run: mvn install -DskipTests

    - run: mvn dependency:go-offline

    - save_cache:
    paths:
    - ~/.m2
    key: v1-dependencies-{{ checksum "pom.xml" }}

    # run tests!
    - run: mvn integration-test