Skip to content

Commit

Permalink
- Port updated Makefile steps from Java client library to fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nwithan8 committed Sep 30, 2024
1 parent db1fa2f commit 406f649
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}

- name: Clean, build and publish to Apache Maven Central
run: make install publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: make install-styleguide publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }}
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
Expand Down
52 changes: 36 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,73 @@ help:

## build - Builds the project for development
build:
mvn clean install -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true
mvn install -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true -Djacoco.skip=true

## clean - Cleans the project
clean:
mvn clean

## coverage - Test the project and generate a coverage report
## coverage - Test (and build) the project to generate a coverage report
coverage:
mvn --batch-mode install -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true jacoco:report
mvn verify -Dgpg.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true jacoco:report

## install-checkstyle - Install CheckStyle
install-checkstyle:
## checkstyle - Check if project follows CheckStyle rules (must run install-checkstyle first)
checkstyle:
java -jar checkstyle.jar src -c examples/style_guides/java/easypost_java_style.xml -d

## docs - Generates library documentation
docs:
mvn install -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djacoco.skip=true
cp -R target/apidocs/ ./docs/

## install-checkstyle - Install the Checkstyle tool (Unix only)
install-checkstyle: | install-styleguide
curl -LJs https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.3.1/checkstyle-10.3.1-all.jar -o checkstyle.jar
curl -LJs https://raw.githubusercontent.com/EasyPost/easypost-java/master/easypost_java_style.xml -o easypost_java_style.xml

## install - Install requirements
install: | install-checkstyle
## install-styleguide - Install style guides
install-styleguide: | init-examples-submodule
sh examples/symlink_directory_files.sh examples/style_guides/java .

## init-examples-submodule - Initialize the examples submodule
init-examples-submodule:
git submodule init
git submodule update

## lint - Check if project follows CheckStyle rules (must run install-checkstyle first)
lint:
java -jar checkstyle.jar src -c easypost_java_style.xml -d
## install - Install requirements
install: | install-checkstyle

## lint - Lints the project
lint: checkstyle scan

## publish - Publish a release of the project
## publish - Publish a release of the project (will build the project via the `mvn deploy` command)
# @parameters:
# pass= - The GPG password to sign the release
publish:
mvn clean deploy -Dgpg.passphrase=${pass}

## publish-dry - Build the project as a dry run to publishing
## publish-dry - Build the project as a dry run to publishing (will build the project via the `mvn install` command)
# @parameters:
# pass= - The GPG password to sign the release
publish-dry:
mvn clean install -Dgpg.passphrase=${pass}

## release - Cuts a release for the project on GitHub (requires GitHub CLI)
# tag = The associated tag title of the release
# target = Target branch or full commit SHA
release:
gh release create ${tag} target/*.jar target/*.asc target/*.pom
gh release create ${tag} target/*.jar target/*.asc target/*.pom --target ${target}

## scan - Scan the project for serious security issues
scan:
mvn verify -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Djavadoc.skip=true -Ddependency-check.failBuildOnCVSS=0 -Ddependency-check.junitFailOnCVSS=0
mvn verify -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Djavadoc.skip=true -Djacoco.skip=true -Ddependency-check.failBuildOnCVSS=0 -Ddependency-check.junitFailOnCVSS=0

## test - Test the project
test:
mvn surefire:test

.PHONY: help build clean coverage install-checkstyle install lint publish publish-dry release scan test
## update-examples-submodule - Update the examples submodule
update-examples-submodule:
git submodule init
git submodule update --remote

.PHONY: help build clean coverage docs install-checkstyle install-styleguide install lint publish publish-dry release scan scan-strict test update-examples-submodule

0 comments on commit 406f649

Please sign in to comment.