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
63 changes: 34 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,42 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
javaversion: ["8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25"]
javaversion:
['8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25']
steps:
- uses: actions/checkout@v5
- uses: actions/checkout@v6
- uses: extractions/setup-just@v3
- uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "25" # 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: Build Library
run: make build
run: just build
- name: Set up Java ${{ matrix.javaversion }}
uses: actions/setup-java@v5
with:
distribution: "zulu"
distribution: 'zulu'
java-version: ${{ matrix.javaversion }}
cache: "maven"
cache: 'maven'
- name: Run test with Java ${{ matrix.javaversion }}
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test-ci
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 just test-ci
coverage:
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: "25" # 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: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make coverage
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 just coverage
- name: Load Rust cache
if: github.ref == 'refs/heads/master'
uses: Swatinem/rust-cache@v2
Expand All @@ -58,20 +61,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: "25" # 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 All @@ -81,16 +85,17 @@ jobs:
if: github.ref == 'refs/heads/master'
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: "25" # 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: Generate Docs
run: make docs
run: just docs
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,23 @@ jobs:
release:
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@v4
- uses: extractions/setup-just@v3
- uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "25" # Always use the most recent LTS JDK for building
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-styleguide publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: just install-styleguide publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }}
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
Expand All @@ -54,5 +52,5 @@ jobs:
- 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 }}
76 changes: 0 additions & 76 deletions Makefile

This file was deleted.

18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Users can subscribe to HTTP requests and responses via the `RequestHook` and `Re

API documentation can be found at: <https://docs.easypost.com>.

Library documentation can be found on the web at: <https://easypost.github.io/easypost-java/> or by building them locally via the `make docs` command.
Library documentation can be found on the web at: <https://easypost.github.io/easypost-java/> or by building them locally via the `just docs` command.

Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md).

Expand All @@ -135,26 +135,26 @@ For additional support, see our [org-wide support policy](https://github.com/Eas

```bash
# Install dependencies
make install
just install

# Build project
make build
just build

# Lint project
make lint
just lint

# Run tests
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make build test
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make coverage
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... just build test
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... just coverage

# Run security analysis
make scan
just scan

# Generate library documentation
make docs
just docs

# Update submodules
make update-examples-submodule
just update-examples-submodule
```

### Testing
Expand Down
68 changes: 68 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
## Builds the project for development
build:
mvn install -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true -Djacoco.skip=true

## Cleans the project
clean:
mvn clean

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

## 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

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

## 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

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

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

## Install requirements
install: install-checkstyle

## Lints the project
lint: checkstyle

## Publish a release of the project (will build the project via the `mvn deploy` command)
# 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 (will build the project via the `mvn install` command)
# 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
# target = Target branch or full commit SHA
release tag target:
gh release create {{tag}} target/*.jar target/*.asc target/*.pom --target {{target}}

## Test the project
test:
mvn test -Dgpg.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true -Djacoco.skip=true

## Test the project on CI (does not rebuild the project)
test-ci:
mvn surefire:test

## Update the examples submodule
update-examples-submodule:
git submodule init
git submodule update --remote
Loading