Skip to content

Instantly share code, notes, and snippets.

@perforb
Created January 28, 2019 03:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perforb/eebb08ba8a31b49387676f08b7a2a5fa to your computer and use it in GitHub Desktop.
Save perforb/eebb08ba8a31b49387676f08b7a2a5fa to your computer and use it in GitHub Desktop.
example of config.yml
# Sample 2.0 config.yml Files
# https://circleci.com/docs/2.0/sample-config/
# https://circleci.com/docs/2.0/language-java/
version: 2.1
executors:
default:
docker:
- image: circleci/openjdk:11-jdk-browsers
environment:
JVM_OPTS: -Xmx3200m
SPRING_PROFILES_ACTIVE: ci
working_directory: ~/workspace
with_db:
docker:
- image: circleci/openjdk:11-jdk-browsers
environment:
JVM_OPTS: -Xmx3200m
SPRING_PROFILES_ACTIVE: ci
- image: circleci/mysql:8.0
command: |
--default-authentication-plugin=mysql_native_password \
--character-set-server=utf8 \
--collation-server=utf8_general_ci
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: true
MYSQL_DATABASE: myapp
working_directory: ~/workspace
commands:
restore_dependencies:
steps:
- restore_cache:
keys:
- dependencies-{{ checksum "build.gradle" }}-{{ checksum "module-common/build.gradle" }}-{{ checksum "module-api/build.gradle" }}
save_dependencies:
steps:
- save_cache:
key: dependencies-{{ checksum "build.gradle" }}-{{ checksum "module-common/build.gradle" }}-{{ checksum "module-api/build.gradle" }}
paths:
- ~/workspace/.gradle
jobs:
setup:
executor: default
steps:
- checkout
- restore_dependencies
- run:
name: Download dependencies
command: |
./gradlew dependencies
./gradlew :module-common:dependencies
./gradlew :module-api:dependencies
- save_dependencies
test_common:
executor: with_db
steps:
- checkout
- run:
name: Waiting for databasee
command: |
dockerize -wait tcp://127.0.0.1:3306 -timeout 1m
- run:
name: Test common module
command: |
./gradlew :module-common:dependencies
./gradlew :module-common:test
test_api:
executor: with_db
steps:
- checkout
- run:
name: Waiting for database
command: |
dockerize -wait tcp://127.0.0.1:3306 -timeout 1m
- run:
name: Test api module
command: |
./gradlew :module-api:dependencies
./gradlew :module-api:test
build:
executor: default
steps:
- checkout
- restore_dependencies
- run:
name: Build project
command: |
./gradlew clean
./gradlew build
- store_artifacts:
path: module-api/build/libs/module-api-0.0.1-SNAPSHOT.jar
workflows:
test_build:
jobs:
- setup
- test_common:
requires:
- setup
- test_api:
requires:
- setup
- build:
requires:
- test_common
- test_api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment