diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c9a7e0d..f5edeb3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 }} diff --git a/Makefile b/Makefile index 5774782..c4e40fa 100644 --- a/Makefile +++ b/Makefile @@ -4,37 +4,51 @@ 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: @@ -42,15 +56,21 @@ publish-dry: ## 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