Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 30 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: [ main ]
branches: [main]
pull_request: ~
workflow_dispatch: ~

Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,34 +25,32 @@

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
gpg-passphrase: MAVEN_GPG_PASSPHRASE
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 }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Upload output files to release
uses: AButler/[email protected]
with:
files: "target/*.jar;target/*.pom;target/*.asc"
files: 'target/*.jar;target/*.pom;target/*.asc'
repo-token: ${{ secrets.GITHUB_TOKEN }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
52 changes: 0 additions & 52 deletions Makefile

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
46 changes: 46 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -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
Loading