Skip to content

Commit 9608aa8

Browse files
authored
chore: swap makefile to justfile (#39)
1 parent 3debb37 commit 9608aa8

5 files changed

Lines changed: 88 additions & 94 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request: ~
77
workflow_dispatch: ~
88

@@ -11,15 +11,16 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
java_version: [ "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" ]
14+
java_version:
15+
['8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25']
1516
steps:
16-
- uses: actions/checkout@v5
17-
- name: Set up JDK for compilation
18-
uses: actions/setup-java@v5
17+
- uses: actions/checkout@v6
18+
- uses: extractions/setup-just@v3
19+
- uses: actions/setup-java@v5
1920
with:
20-
distribution: "zulu"
21-
java-version: "21" # Always use the most recent LTS JDK for building
22-
cache: "maven"
21+
distribution: 'zulu'
22+
java-version: '25' # Always use the most recent LTS JDK for building
23+
cache: 'maven'
2324
- name: Load Maven dependencies cache
2425
uses: actions/cache@v3
2526
with:
@@ -28,31 +29,31 @@ jobs:
2829
restore-keys: |
2930
${{ runner.os }}-maven-
3031
- name: Install dependencies
31-
run: make install
32+
run: just install
3233
- name: Compile
33-
run: make build
34+
run: just build
3435
- name: Set up Java ${{ matrix.java_version }}
3536
uses: actions/setup-java@v5
3637
with:
37-
distribution: "zulu"
38+
distribution: 'zulu'
3839
java-version: ${{ matrix.java_version }}
39-
cache: "maven"
40+
cache: 'maven'
4041
- name: Run test with Java ${{ matrix.java_version }}
41-
run: make test
42+
run: just test
4243
coverage:
4344
runs-on: ubuntu-latest
4445
steps:
45-
- uses: actions/checkout@v5
46-
- name: Set up JDK for compilation
47-
uses: actions/setup-java@v5
46+
- uses: actions/checkout@v6
47+
- uses: extractions/setup-just@v3
48+
- uses: actions/setup-java@v5
4849
with:
49-
distribution: "zulu"
50-
java-version: "21" # Always use the most recent LTS JDK for building
51-
cache: "maven"
50+
distribution: 'zulu'
51+
java-version: '25' # Always use the most recent LTS JDK for building
52+
cache: 'maven'
5253
- name: Install dependencies
53-
run: make install
54+
run: just install
5455
- name: Test coverage
55-
run: make coverage
56+
run: just coverage
5657
- name: Load Rust cache
5758
if: github.ref == 'refs/heads/main'
5859
uses: Swatinem/rust-cache@v2
@@ -67,20 +68,21 @@ jobs:
6768
uses: coverallsapp/github-action@master
6869
with:
6970
github-token: ${{ secrets.GITHUB_TOKEN }}
70-
path-to-lcov: "./coverage.lcov"
71+
path-to-lcov: './coverage.lcov'
7172
lint:
7273
runs-on: ubuntu-latest
7374
steps:
74-
- uses: actions/checkout@v5
75+
- uses: actions/checkout@v6
76+
- uses: extractions/setup-just@v3
7577
- uses: actions/setup-java@v5
7678
with:
77-
distribution: "zulu"
78-
java-version: "21" # Always use the most recent LTS JDK for building
79-
cache: "maven"
79+
distribution: 'zulu'
80+
java-version: '25' # Always use the most recent LTS JDK for building
81+
cache: 'maven'
8082
- name: Install checkstyle and style guide
81-
run: make install-checkstyle
83+
run: just install-checkstyle
8284
- name: Lint
83-
run: make lint
85+
run: just lint
8486
- name: Upload Test results
8587
uses: actions/upload-artifact@master
8688
with:

.github/workflows/publish.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,25 @@ on:
2525

2626
jobs:
2727
release:
28-
runs-on: ubuntu-20.04
28+
runs-on: ubuntu-latest
2929
steps:
30-
- name: Checkout repository
31-
uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
3231
with:
3332
fetch-depth: 0
34-
35-
- name: Install JDK
36-
uses: actions/setup-java@v3
33+
- uses: extractions/setup-just@v3
34+
- uses: actions/setup-java@v5
3735
with:
38-
distribution: "zulu"
39-
java-version: "23" # Always use the latest JDK
40-
server-id: "ossrh"
36+
distribution: 'zulu'
37+
java-version: '25' # Always use the most recent LTS JDK for building
38+
server-id: 'ossrh'
4139
# define environmental variable names
4240
server-username: MAVEN_USERNAME
4341
server-password: MAVEN_CENTRAL_TOKEN
4442
gpg-passphrase: MAVEN_GPG_PASSPHRASE
4543
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
4644

4745
- name: Clean, build and publish to Apache Maven Central
48-
run: make install publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }}
46+
run: just install publish pass=${{ secrets.MAVEN_GPG_PASSPHRASE }}
4947
env:
5048
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
5149
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
@@ -54,5 +52,5 @@ jobs:
5452
- name: Upload output files to release
5553
uses: AButler/upload-release-assets@v3.0.1
5654
with:
57-
files: "target/*.jar;target/*.pom;target/*.asc"
55+
files: 'target/*.jar;target/*.pom;target/*.asc'
5856
repo-token: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 0 additions & 52 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,13 +340,13 @@ public class Example {
340340

341341
```bash
342342
# Build project
343-
mvn clean install -DskipTests -Dgpg.skip
343+
just install
344344

345345
# Run tests
346-
mvn clean test -B
346+
just build test
347347

348348
# Run tests with coverage
349-
mvn clean test -B jacoco:report
349+
just coverage
350350
```
351351

352352
### Testing

justfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Builds the project for development
2+
build:
3+
mvn clean install -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true
4+
5+
## Cleans the project
6+
clean:
7+
mvn clean
8+
9+
## Test the project and generate a coverage report
10+
coverage:
11+
mvn --batch-mode install -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true jacoco:report
12+
13+
## Install CheckStyle
14+
install-checkstyle:
15+
curl -LJs https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.3.1/checkstyle-10.3.1-all.jar -o checkstyle.jar
16+
curl -LJs https://raw.githubusercontent.com/EasyPost/examples/refs/heads/master/style_guides/java/easypost_java_style.xml -o easypost_java_style.xml
17+
18+
## Install requirements
19+
install: install-checkstyle
20+
git submodule init
21+
git submodule update
22+
23+
## Check if project follows CheckStyle rules (must run install-checkstyle first)
24+
lint:
25+
java -jar checkstyle.jar src -c easypost_java_style.xml -d
26+
27+
## Publish a release of the project
28+
# @parameters:
29+
# pass= - The GPG password to sign the release
30+
publish pass:
31+
mvn clean deploy -Dgpg.passphrase={{pass}}
32+
33+
## Build the project as a dry run to publishing
34+
# @parameters:
35+
# pass= - The GPG password to sign the release
36+
publish-dry pass:
37+
mvn clean install -Dgpg.passphrase={{pass}}
38+
39+
## Cuts a release for the project on GitHub (requires GitHub CLI)
40+
# tag = The associated tag title of the release
41+
release tag:
42+
gh release create {{tag}} target/*.jar target/*.asc target/*.pom
43+
44+
## Test the project
45+
test:
46+
mvn surefire:test

0 commit comments

Comments
 (0)