Skip to content

Commit 569ff59

Browse files
authored
Merge pull request #176 from EasyPost/unified_makefile
chore: unify Makefile and add release target
2 parents 1eb9cd2 + e8dfa2c commit 569ff59

File tree

3 files changed

+41
-30
lines changed

3 files changed

+41
-30
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
distribution: "zulu"
2020
java-version: ${{ matrix.javaversion }}
2121
- name: Build and test with Maven
22-
run: EASYPOST_TEST_API_KEY=${{ secrets.EASYPOST_TEST_API_KEY }} EASYPOST_PROD_API_KEY=${{ secrets.EASYPOST_PROD_API_KEY }} mvn --batch-mode install -Dgpg.skip=true -Dcheckstyle.skip=true
22+
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make test
2323
lint:
2424
runs-on: ubuntu-latest
2525
steps:
@@ -35,7 +35,7 @@ jobs:
3535
runs-on: ubuntu-latest
3636
steps:
3737
- uses: actions/checkout@v3
38-
- name: Run security check
38+
- name: Run security analysis
3939
run: make scan
4040
- name: Upload Test results
4141
uses: actions/upload-artifact@master

Makefile

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,49 @@
22
help:
33
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t
44

5-
## build-release - Build the project for release
6-
# @parameters:
7-
# pass= - The GPG password to sign the release
8-
build-release:
9-
mvn clean install -Dgpg.passphrase=${pass}
10-
11-
## build-dev - Build the project for development
12-
build-dev:
5+
## build - Builds the project for development
6+
build:
137
mvn clean install -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true
148

15-
## publish - Publish a release of the project
16-
# @parameters:
17-
# pass= - The GPG password to sign the release
18-
publish:
19-
mvn clean deploy -Dgpg.passphrase=${pass}
20-
21-
## test - Test the project
22-
test:
23-
mvn --batch-mode install -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true
24-
25-
## clean - Clean the project
9+
## clean - Cleans the project
2610
clean:
2711
mvn clean
2812

29-
# install-checkstyle - Install CheckStyle
13+
## coverage - Test the project and generate a coverage report
14+
coverage:
15+
mvn --batch-mode install -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true jacoco:report
16+
17+
## install-checkstyle - Install CheckStyle
3018
install-checkstyle:
3119
wget -O checkstyle.jar -q https://github.com/checkstyle/checkstyle/releases/download/checkstyle-10.3.1/checkstyle-10.3.1-all.jar
3220

3321
## lint - Check if project follows CheckStyle rules (must run install-checkstyle first)
3422
lint:
3523
java -jar checkstyle.jar src -c easypost_java_style.xml -d
3624

25+
## publish - Publish a release of the project
26+
# @parameters:
27+
# pass= - The GPG password to sign the release
28+
publish:
29+
mvn clean deploy -Dgpg.passphrase=${pass}
30+
31+
## publish-dry - Build the project as a dry run to publishing
32+
# @parameters:
33+
# pass= - The GPG password to sign the release
34+
publish-dry:
35+
mvn clean install -Dgpg.passphrase=${pass}
36+
37+
## release - Cuts a release for the project on GitHub (requires GitHub CLI)
38+
# tag = The associated tag title of the release
39+
release:
40+
gh release create ${tag} target/*.jar target/*.asc target/*.pom
41+
3742
## scan - Scan the project for serious security issues
3843
scan:
39-
mvn verify -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Djavadoc.skip=true -Ddependency-check.failBuildOnCVSS=7 -Ddependency-check.junitFailOnCVSS=7
40-
41-
## scan-strict - Scan the project for any security issues (strict mode)
42-
scan-strict:
4344
mvn verify -DskipTests=true -Dgpg.skip=true -Dcheckstyle.skip=true -Djavadoc.skip=true -Ddependency-check.failBuildOnCVSS=0 -Ddependency-check.junitFailOnCVSS=0
4445

45-
.PHONY: help build-release build-dev publish test clean install-checkstyle lint scan scan-strict
46+
## test - Test the project
47+
test:
48+
mvn --batch-mode install -Dgpg.skip=true -Dcheckstyle.skip=true -Dcheckstyle.skip=true -Ddependency-check.skip=true -Djavadoc.skip=true
49+
50+
.PHONY: help build clean install-checkstyle lint publish publish-dry release scan scan-strict test

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,19 @@ Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_G
9191

9292
```bash
9393
# Build project
94-
mvn clean install -Dgpg.skip
94+
make build
95+
96+
# Lint project
97+
make lint
9598

9699
# Run tests
97-
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... mvn clean test -B
100+
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make test
98101

99102
# Run tests with coverage
100-
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... mvn clean test -B jacoco:report
103+
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make coverage
104+
105+
# Run security analysis
106+
make scan
101107
```
102108

103109
### Testing

0 commit comments

Comments
 (0)