diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50a4b63..9712ab7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ main ] + branches: [main] pull_request: ~ workflow_dispatch: ~ @@ -11,15 +11,16 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java_version: [ "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" ] + java_version: + ['8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25'] steps: - - uses: actions/checkout@v5 - - name: Set up JDK for compilation - uses: actions/setup-java@v5 + - uses: actions/checkout@v6 + - uses: extractions/setup-just@v3 + - uses: actions/setup-java@v5 with: - distribution: "zulu" - java-version: "21" # Always use the most recent LTS JDK for building - cache: "maven" + distribution: 'zulu' + java-version: '25' # Always use the most recent LTS JDK for building + cache: 'maven' - name: Load Maven dependencies cache uses: actions/cache@v3 with: @@ -28,31 +29,31 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - name: Install dependencies - run: make install + run: just install - name: Compile - run: make build + run: just build - name: Set up Java ${{ matrix.java_version }} uses: actions/setup-java@v5 with: - distribution: "zulu" + distribution: 'zulu' java-version: ${{ matrix.java_version }} - cache: "maven" + cache: 'maven' - name: Run test with Java ${{ matrix.java_version }} - run: make test + run: just test coverage: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - name: Set up JDK for compilation - uses: actions/setup-java@v5 + - uses: actions/checkout@v6 + - uses: extractions/setup-just@v3 + - uses: actions/setup-java@v5 with: - distribution: "zulu" - java-version: "21" # Always use the most recent LTS JDK for building - cache: "maven" + distribution: 'zulu' + java-version: '25' # Always use the most recent LTS JDK for building + cache: 'maven' - name: Install dependencies - run: make install + run: just install - name: Test coverage - run: make coverage + run: just coverage - name: Load Rust cache if: github.ref == 'refs/heads/main' uses: Swatinem/rust-cache@v2 @@ -67,20 +68,21 @@ jobs: uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: "./coverage.lcov" + path-to-lcov: './coverage.lcov' lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 + - uses: extractions/setup-just@v3 - uses: actions/setup-java@v5 with: - distribution: "zulu" - java-version: "21" # Always use the most recent LTS JDK for building - cache: "maven" + distribution: 'zulu' + java-version: '25' # Always use the most recent LTS JDK for building + cache: 'maven' - name: Install checkstyle and style guide - run: make install-checkstyle + run: just install-checkstyle - name: Lint - run: make lint + run: just lint - name: Upload Test results uses: actions/upload-artifact@master with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dca7728..9d2e4fd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,19 +25,17 @@ on: jobs: release: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 + - uses: actions/checkout@v6 with: fetch-depth: 0 - - - name: Install JDK - uses: actions/setup-java@v3 + - uses: extractions/setup-just@v3 + - uses: actions/setup-java@v5 with: - distribution: "zulu" - java-version: "23" # Always use the latest JDK - server-id: "ossrh" + distribution: 'zulu' + java-version: '25' # Always use the most recent LTS JDK for building + server-id: 'ossrh' # define environmental variable names server-username: MAVEN_USERNAME server-password: MAVEN_CENTRAL_TOKEN @@ -45,7 +43,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: just install publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }} env: MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} @@ -54,5 +52,5 @@ jobs: - name: Upload output files to release uses: AButler/upload-release-assets@v3.0.1 with: - files: "target/*.jar;target/*.pom;target/*.asc" + files: 'target/*.jar;target/*.pom;target/*.asc' repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile deleted file mode 100644 index df510db..0000000 --- a/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -## help - Display help about make targets for this Makefile -help: - @cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t - -## 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 - -## clean - Cleans the project -clean: - mvn clean - -## coverage - Test the project and 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 - -## install-checkstyle - Install CheckStyle -install-checkstyle: - 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/examples/refs/heads/master/style_guides/java/easypost_java_style.xml -o easypost_java_style.xml - -## install - Install requirements -install: | install-checkstyle - 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 - -## publish - Publish a release of the project -# @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 -# @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 -release: - gh release create ${tag} target/*.jar target/*.asc target/*.pom - -## test - Test the project -test: - mvn surefire:test - -.PHONY: help build clean coverage install-checkstyle install lint publish publish-dry release test diff --git a/README.md b/README.md index e3c6094..1482932 100644 --- a/README.md +++ b/README.md @@ -340,13 +340,13 @@ public class Example { ```bash # Build project -mvn clean install -DskipTests -Dgpg.skip +just install # Run tests -mvn clean test -B +just build test # Run tests with coverage -mvn clean test -B jacoco:report +just coverage ``` ### Testing diff --git a/justfile b/justfile new file mode 100644 index 0000000..00eb922 --- /dev/null +++ b/justfile @@ -0,0 +1,46 @@ +## 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 + +## Cleans the project +clean: + mvn clean + +## Test the project and 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 + +## Install CheckStyle +install-checkstyle: + 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/examples/refs/heads/master/style_guides/java/easypost_java_style.xml -o easypost_java_style.xml + +## Install requirements +install: install-checkstyle + git submodule init + git submodule update + +## Check if project follows CheckStyle rules (must run install-checkstyle first) +lint: + java -jar checkstyle.jar src -c easypost_java_style.xml -d + +## Publish a release of the project +# @parameters: +# pass= - The GPG password to sign the release +publish pass: + mvn clean deploy -Dgpg.passphrase={{pass}} + +## Build the project as a dry run to publishing +# @parameters: +# pass= - The GPG password to sign the release +publish-dry pass: + mvn clean install -Dgpg.passphrase={{pass}} + +## Cuts a release for the project on GitHub (requires GitHub CLI) +# tag = The associated tag title of the release +release tag: + gh release create {{tag}} target/*.jar target/*.asc target/*.pom + +## Test the project +test: + mvn surefire:test