Skip to content

Commit 23a3f59

Browse files
authored
chore: swap makefile for justfile (#268)
# Description <!-- Please provide a general summary of your PR changes and link any related issues or other pull requests. --> # Testing <!-- Please provide details on how you tested this code. See below. - All pull requests must be tested (unit tests where possible with accompanying cassettes, or provide a screenshot of end-to-end testing when unit tests are not possible) - New features must get a new unit test - Bug fixes/refactors must re-record existing cassettes --> # Pull Request Type Please select the option(s) that are relevant to this PR. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Improvement (fixing a typo, updating readme, renaming a variable name, etc.)
1 parent aa33ea9 commit 23a3f59

File tree

4 files changed

+79
-88
lines changed

4 files changed

+79
-88
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,49 @@ jobs:
1010
lint:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v5
13+
- uses: actions/checkout@v6
14+
- uses: extractions/setup-just@v3
1415
- uses: actions/setup-go@v6
1516
with:
1617
go-version: '1.25'
1718
# install must occur in the same step as the linter to run properly on CI
1819
- name: Lint project
19-
run: make install lint
20+
run: just install lint
2021
build:
2122
runs-on: ubuntu-latest
2223
strategy:
2324
matrix:
2425
go-version: ['1.16', '1.17', '1.18', '1.19', '1.20', '1.21', '1.22', '1.23', '1.24', '1.25']
2526
steps:
26-
- uses: actions/checkout@v5
27+
- uses: actions/checkout@v6
28+
- uses: extractions/setup-just@v3
2729
- uses: actions/setup-go@v6
2830
with:
2931
go-version: ${{ matrix.go-version }}
3032
- name: run tests
31-
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make install test
33+
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 just install test
3234
coverage:
3335
runs-on: ubuntu-latest
3436
steps:
35-
- uses: actions/checkout@v5
37+
- uses: actions/checkout@v6
38+
- uses: extractions/setup-just@v3
3639
- uses: actions/setup-go@v6
3740
with:
3841
go-version: '1.25'
3942
- name: Run coverage report
40-
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make install coverage
43+
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 just install coverage
4144
coveralls:
4245
if: github.ref == 'refs/heads/master'
4346
runs-on: ubuntu-latest
4447
steps:
45-
- uses: actions/checkout@v5
48+
- uses: actions/checkout@v6
49+
- uses: extractions/setup-just@v3
4650
- uses: actions/setup-go@v6
4751
with:
4852
# NOTE: goveralls is not compatibile with go v1.22+, must remain on v1.21 max
4953
go-version: '1.21'
5054
- name: Run coverage report
51-
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 make install coverage
55+
run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 just install coverage
5256
- name: Install goveralls
5357
run: go install github.com/mattn/goveralls@latest
5458
- name: Coveralls

Makefile

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

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,20 @@ For additional support, see our [org-wide support policy](https://github.com/Eas
173173

174174
```bash
175175
# Install dependencies
176-
make install
176+
just install
177177

178178
# Lint project (requires `golangci-lint` to be installed - not included)
179-
make lint
179+
just lint
180180

181181
# Run tests
182-
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make test
183-
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... make coverage
182+
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... just test
183+
EASYPOST_TEST_API_KEY=123... EASYPOST_PROD_API_KEY=123... just coverage
184184

185185
# Run security analysis on the project (requires `gosec` to be installed - not included)
186-
make scan
186+
just scan
187187

188188
# Update submodules
189-
make update-examples-submodule
189+
just update-examples-submodule
190190
```
191191

192192
### Testing

justfile

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Build the project
2+
build:
3+
go build -o ../dist/easypost-go
4+
5+
# Clean the project
6+
clean:
7+
rm -rf dist
8+
rm $(go env GOPATH)/bin/easypost-go
9+
10+
# Get test coverage and open it in a browser
11+
coverage:
12+
go clean -testcache
13+
go test -coverprofile=covprofile ./...
14+
bash -c 'statement_cov=$(go tool cover -func=covprofile | grep total: | awk "{print substr(\$NF, 1, length(\$NF)-1)}"); if [ $(echo "$statement_cov < 78.0" | bc) -eq 1 ]; then echo "Tests passed but statement coverage failed with coverage: $statement_cov"; exit 1; fi'
15+
go tool cover -html=covprofile
16+
17+
# Initialize the examples submodule
18+
init-examples-submodule:
19+
git submodule init
20+
git submodule update
21+
22+
# Install and vendor dependencies
23+
install: init-examples-submodule
24+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.6
25+
curl -sSfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
26+
go mod vendor
27+
28+
# Lint the project
29+
golangci:
30+
$(go env GOPATH)/bin/golangci-lint run --config examples/style_guides/golang/.golangci.yml
31+
32+
# Lint the project
33+
lint: golangci scan
34+
35+
# Runs formatting tools against the project
36+
lint-fix:
37+
$(go env GOPATH)/bin/golangci-lint run --config examples/style_guides/golang/.golangci.yml --fix
38+
39+
# Cuts a release for the project on GitHub (requires GitHub CLI)
40+
# tag = The associated tag title of the release
41+
# target = Target branch or full commit SHA
42+
release tag target:
43+
gh release create {{tag}} --target {{target}}
44+
45+
# Run gosec to scan for security issues
46+
scan:
47+
$(go env GOPATH)/bin/gosec -tests --exclude-dir=examples ./...
48+
49+
# Test the project
50+
test:
51+
go clean -testcache
52+
go test ./... -v
53+
54+
# Tidies up the vendor directory
55+
tidy:
56+
go mod tidy
57+
58+
# Update the examples submodule
59+
update-examples-submodule:
60+
git submodule init
61+
git submodule update --remote

0 commit comments

Comments
 (0)