Skip to content

Commit

Permalink
Create config.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
CRogers committed Sep 20, 2024
1 parent 62d0cb5 commit b782504
Showing 1 changed file with 123 additions and 0 deletions.
123 changes: 123 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# This file was generated by the excavator check 'excavator/manage-circleci' as specified in .circleci/template.sh.
# To request a modification to the general template, file an issue on Excavator.
# To manually manage the CircleCI configuration for this project, remove the .circleci/template.sh file.

version: 2.1

aliases:
- &check-no-files-changed
run:
name: Check that no git-tracked files were modified
command: |
FILES_MODIFIED="$(git status --porcelain)"
if [[ -n "$FILES_MODIFIED" ]]; then
echo "The following files were modified or added during the build process:"
echo "$FILES_MODIFIED"
echo "This will likely prevent successful publishing. Please run the build locally and include these changes in your pull request. (If new files are created, consider whether they should be checked in or .gitignored.)"
exit 1
fi
jobs:

check:
docker: [{ image: 'cimg/openjdk:11.0.22-node' }]
resource_class: large
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.workers.max=2 -Dorg.gradle.jvmargs='-Xmx2147483648 --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:MaxRAM=8g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
steps:
- checkout
- run:
name: delete_unrelated_tags
command: |
ALL_TAGS=$(git tag --points-at HEAD)
if [ -z "$ALL_TAGS" ]; then
echo "No-op as there are no tags on the current commit ($(git rev-parse HEAD))"
exit 0
fi
if [ -z "${CIRCLE_TAG:+x}" ]; then
echo "Non-tag build, deleting all tags which point to HEAD: [${ALL_TAGS/$'\n'/,}]"
echo "$ALL_TAGS" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
exit 0
fi
TAGS_TO_DELETE=$(echo "$ALL_TAGS" | grep -v "^$CIRCLE_TAG$" || :)
if [ -z "$TAGS_TO_DELETE" ]; then
echo "No-op as exactly one tag ($CIRCLE_TAG) points to HEAD"
exit 0
fi
echo "Detected tag build, deleting all tags except '$CIRCLE_TAG' which point to HEAD: [${TAGS_TO_DELETE/$'\n'/,}]"
echo "$TAGS_TO_DELETE" | while read -r TAG; do git tag -d "$TAG" 1>/dev/null; done
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
- restore_cache: { key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
- run:
name: check-setup
command: |
if [ -x .circleci/check-setup.sh ]; then
echo "Running check-setup" && .circleci/check-setup.sh && echo "check-setup complete"
fi
- run: ./gradlew --parallel --stacktrace --continue --max-workers=2 build -Porg.gradle.java.installations.fromEnv=JAVA_11_HOME,JAVA_17_HOME,JAVA_21_HOME,JAVA_HOME
- *check-no-files-changed
- persist_to_workspace:
root: /home/circleci
paths: [ project ]
- save_cache:
key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}'
paths: [ ~/.gradle/wrapper ]
- save_cache:
key: 'check-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
paths: [ ~/.gradle/caches ]
- run:
command: mkdir -p ~/junit && find . -type f -regex ".*/build/.*TEST.*xml" -exec cp --parents {} ~/junit/ \;
when: always
- store_test_results: { path: ~/junit }
- store_artifacts: { path: ~/artifacts }

publish:
docker: [{ image: 'cimg/openjdk:11.0.22-node' }]
resource_class: medium
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.workers.max=1 -Dorg.gradle.jvmargs='-Xmx2147483648 --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:MaxRAM=4g -XX:+CrashOnOutOfMemoryError -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
steps:
- attach_workspace: { at: /home/circleci }
- restore_cache: { key: 'gradle-wrapper-v1-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
- restore_cache: { key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}' }
- deploy:
command: ./gradlew --parallel --stacktrace --continue publish -Porg.gradle.java.installations.fromEnv=JAVA_11_HOME,JAVA_17_HOME,JAVA_21_HOME,JAVA_HOME
- run:
command: git status --porcelain
when: always
- save_cache:
key: 'publish-gradle-cache-v1-{{ checksum "versions.props" }}-{{ checksum "build.gradle" }}'
paths: [ ~/.gradle/caches ]
- store_test_results: { path: ~/junit }
- store_artifacts: { path: ~/artifacts }

circle-all:
docker: [{ image: 'busybox:1.36.1@sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74' }]
resource_class: small
steps:
- run: {command: echo "All required jobs finished successfully"}

workflows:
version: 2
build:
jobs:
- check:
filters: { tags: { only: /.*/ } }

- circle-all:
requires: [ check ]
filters: { tags: { only: /.*/ } }

- publish:
requires: [ circle-all ]
filters: { tags: { only: /.*/ }, branches: { only: develop } }

0 comments on commit b782504

Please sign in to comment.