blob: 33f281cf179431026757d39c5ac78aeec9d63019 [file] [log] [blame] [raw]
version: 2
defaults: &defaults
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/glowstone
environment:
JAVA_TOOL_OPTIONS: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:+AggressiveOpts -XX:+UseStringDeduplication -XX:StringDeduplicationAgeThreshold=1 -XX:+UseG1GC -XX:MaxGCPauseMillis=10000 -XX:G1ReservePercent=0 -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=0 -XX:MaxMetaspaceSize=96m -XX:G1HeapWastePercent=0 -XX:G1OldCSetRegionThresholdPercent=100 -XX:G1NewSizePercent=0 -XX:G1MaxNewSizePercent=15 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=25
jobs:
build:
<<: *defaults
steps:
- run: mvn --version
- run: java -version
- checkout
- restore_cache:
keys:
# Use cache for this pom
- glowstone-{{ checksum "pom.xml" }}
# Fallback to latest cache is an exact match is not found
- glowstone-
- run: mvn -T 1C -B dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: glowstone-{{ checksum "pom.xml" }}
- run: mvn -B package
- store_test_results:
path: target/surefire-reports
- store_artifacts:
path: target/glowstone.jar
destination: glowstone.jar
build-deploy:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
# Use cache for this pom
- glowstone-{{ checksum "pom.xml" }}
# Fallback to latest cache is an exact match is not found
- glowstone-
- run: mvn -T 1C -B dependency:go-offline
- save_cache:
paths:
- ~/.m2
key: glowstone-{{ checksum "pom.xml" }}
# Ensure we are on the right repo before attempting a deploy
- run: |
if [ "${CIRCLE_PROJECT_USERNAME}" == "GlowstoneMC" ]; then
mvn -B -s .circleci/maven.xml source:jar javadoc:jar deploy
else
mvn -B package
fi
- store_test_results:
path: target/surefire-reports
- store_artifacts:
path: target/glowstone.jar
destination: glowstone.jar
- store_artifacts:
path: target/glowstone-javadoc.jar
destination: glowstone-javadoc.jar
- store_artifacts:
path: target/glowstone-sources.jar
destination: glowstone-sources.jar
workflows:
version: 2
default-branch-build:
jobs:
- build-deploy:
filters:
branches:
only: dev
other-branch-build:
jobs:
- build:
filters:
branches:
ignore: dev