The java program I’m using with circleci expects a MySQL database and despite reading the documentation I am still stumped on how to implement this. Here is my config thus far (using some example code from documentation):
version: 2 # use CircleCI 2.0
jobs: # a collection of steps
build: # runs not using Workflows must have a `build` job as entry point
working_directory: ~/search-ci # directory where steps will run
docker: # run the steps with Docker
- image: circleci/openjdk:8-jdk-browsers # ...with this image as the primary container; this is where all `steps` will run
environment:
MYSQL_HOST: 127.0.0.1
MYSQL_DB: archivesearch
MYSQL_USER: root
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_PASSWORD:
- image: circleci/mysql:latest-ram
steps: # a collection of executable commands
- checkout # check out source code to working directory
- run:
name: database_setup
command: |
sudo apt-get install mysql-client
- restore_cache: # restore the saved cache after the first run or if `pom.xml` has changed
# Read about caching dependencies: https://circleci.com/docs/2.0/caching/
key: circleci-demo-java-spring-{{ checksum "pom.xml" }}
- run: mvn dependency:go-offline # gets the project dependencies
- save_cache: # saves the project dependencies
paths:
- ~/.m2
key: circleci-demo-java-spring-{{ checksum "pom.xml" }}
- run: mvn package # run the actual tests
- store_test_results: # uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard.
# Upload test results for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/
path: target/surefire-reports
- store_artifacts: # store the uberjar as an artifact
# Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: target/demo-java-spring-0.0.1-SNAPSHOT.jar
# See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples