Browse Source

Optimize CircleCI Configuration for Maven Central Releases (#1338)

Updates the Circle CI configuration to follow Circle best practices and configure workflows for snapshot and tag releases.
pull/1340/head
Kevin Davis 4 years ago committed by GitHub
parent
commit
83b7f25590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 219
      .circleci/config.yml
  2. 4
      pom.xml
  3. 0
      scripts/no-git-changes.sh
  4. 0
      scripts/release.sh

219
.circleci/config.yml

@ -12,28 +12,32 @@ @@ -12,28 +12,32 @@
# the License.
#
# our job defaults
defaults: &defaults
working_directory: ~/feign
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
steps:
- checkout
- restore_cache:
keys:
- feign-dependencies-{{ checksum "pom.xml" }}
- feign-dependencies-
- run: mvn dependency:resolve-plugins go-offline:resolve-dependencies install -DskipTests=true
- save_cache:
paths:
- ~/.m2
key: feign-dependencies-{{ checksum "pom.xml" }}
- run: mvn -o test
version: 2.1
# common executors
executors:
java:
parameters:
version:
description: 'jdk version to use'
default: '8'
type: string
docker:
- image: circleci/openjdk:<<parameters.version>>
# common commands
commands:
resolve-dependencies:
description: 'Download and prepare all dependencies'
steps:
- run:
name: 'Resolving Dependencies'
command: |
mvn dependency:resolve-plugins go-offline:resolve-dependencies -DskipTests=true
verify-formatting:
steps:
- run:
name: 'Verify formatting'
command: |
scripts/no-git-changes.sh
configure-gpg:
steps:
- run:
@ -43,51 +47,180 @@ commands: @@ -43,51 +47,180 @@ commands:
nexus-deploy:
steps:
- run:
name: 'Deploy to Sonatype'
name: 'Deploy Core Modules Sonatype'
command: |
mvn -nsu -s .circleci/settings.xml -P release -pl -:feign-benchmark -DskipTests=true deploy
nexus-deploy-jdk11:
steps:
- run:
name: 'Deploy JDK 11 Modules to Sonatype'
command: |
mvn -B -nsu -s ./travis/settings.xml -P release,java11 -pl :feign-java11 -DskipTests=true deploy
jobs:
jdk8:
docker:
- image: circleci/openjdk:8
<<: *defaults
# our job defaults
defaults: &defaults
working_directory: ~/feign
environment:
# Customize the JVM maximum heap limit
MAVEN_OPTS: -Xmx3200m
jdk11:
docker:
- image: circleci/openjdk:11
<<: *defaults
# branch filters
master-only: &master-only
branches:
only: master
jdk14:
docker:
- image: circleci/openjdk:14-buster
tags-only: &tags-only
branches:
ignore: /.*/
tags:
only: /.*/
all-branches: &all-branches
branches:
ignore: master
tags:
ignore: /.*/
version: 2.1
jobs:
test:
parameters:
jdk:
description: 'jdk version to use'
default: '8'
type: string
executor:
name: java
version: <<parameters.jdk>>
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- feign-dependencies-{{ checksum "pom.xml" }}
- feign-dependencies-
- resolve-dependencies
- save_cache:
paths:
- ~/.m2
key: feign-dependencies-{{ checksum "pom.xml" }}
- run:
name: 'Test'
command: |
mvn -o test
- verify-formatting
deploy:
docker:
- image: circleci/openjdk:8
parameters:
jdk:
description: 'jdk version to use'
default: '8'
type: string
executor:
name: java
version: <<parameters.jdk>>
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- feign-dependencies-{{ checksum "pom.xml" }}
- feign-dependencies-
- resolve-dependencies
- configure-gpg
- nexus-deploy
deploy-jdk11:
parameters:
jdk:
description: 'jdk version to use'
default: '11'
type: string
executor:
name: java
version: <<parameters.jdk>>
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- feign-dependencies-{{ checksum "pom.xml" }}
- feign-dependencies-
- resolve-dependencies
- configure-gpg
- nexus-deploy-jdk11
workflows:
version: 2
build:
jobs:
- jdk8
- jdk11
- jdk14
- test:
jdk: '8'
name: 'jdk 8'
filters:
<<: *all-branches
- test:
jdk: '11'
name: 'jdk 11'
filters:
<<: *all-branches
- test:
jdk: '14-buster'
name: 'jdk 14'
filters:
<<: *all-branches
snapshot:
jobs:
- test:
jdk: '8'
name: 'jdk 8'
filters:
<<: *master-only
- test:
jdk: '11'
name: 'jdk 11'
filters:
<<: *master-only
- test:
jdk: '14-buster'
name: 'jdk 14'
filters:
<<: *master-only
- deploy:
jdk: '8'
name: 'deploy snapshot'
requires:
- 'jdk 8'
- 'jdk 11'
- 'jdk 14'
context: Sonatype
filters:
<<: *master-only
- deploy-jdk11:
jdk: '11'
name: 'deploy jdk11 snapshot modules'
requires:
- 'jdk 11'
- 'deploy snapshot'
context: Sonatype
filters:
<<: *master-only
release:
jobs:
- deploy:
jdk: '8'
name: 'release to maven central'
context: Sonatype
filters:
<<: *tags-only
- deploy-jdk11:
jdk: '11'
name: 'release jdk11 artifacts to maven central'
requires:
- jdk8
- jdk11
- jdk14
- 'release to maven central'
context: Sonatype
filters:
branches:
only: master
<<: *tags-only

4
pom.xml

@ -538,7 +538,7 @@ @@ -538,7 +538,7 @@
</configuration>
<executions>
<execution>
<phase>compile</phase>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
@ -565,7 +565,7 @@ @@ -565,7 +565,7 @@
</configuration>
<executions>
<execution>
<phase>verify</phase>
<phase>validate</phase>
<goals>
<goal>format</goal>
</goals>

0
scripts/no-git-changes.sh

0
scripts/release.sh

Loading…
Cancel
Save