Skip to content

Commit 985190c

Browse files
committed
Add Justfile to automate common tasks
This will help standardize and document maintenance. "Just" is a popular make-like tool used by many Rust projects.
1 parent 9e8808d commit 985190c

File tree

2 files changed

+44
-8
lines changed

2 files changed

+44
-8
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,24 @@ jobs:
108108
- uses: actions/checkout@v2
109109
with:
110110
submodules: recursive
111-
- name: Check source formatting and warnings
112-
run: |
113-
cargo fmt -- --check
114-
cargo clippy -- -D warnings
115-
- name: Check policy
111+
- name: Install Just
116112
run: |
113+
version=1.13.0
114+
basename=just-$version-${{ matrix.host }}
115+
curl -fLO https://github.com/casey/just/releases/download/$version/$basename.tar.gz
116+
tar xf $basename.tar.gz just
117+
mv just /usr/local/bin/
118+
rm -rf $basename.tar.gz
119+
- name: Install cargo-deny
117120
version=0.11.0
118121
basename=cargo-deny-$version-${{ matrix.host }}
119122
curl -fLO https://github.com/EmbarkStudios/cargo-deny/releases/download/$version/$basename.tar.gz
120123
tar xf $basename.tar.gz
121124
mv $basename/cargo-deny /usr/local/bin/
122125
rm -rf $basename $basename.tar.gz
123-
cargo deny check
124-
- name: Test
126+
- name: Check source formatting, warnings, licences, security alerts & tests
125127
run: |
126-
cargo test
128+
just check
127129
- name: Install cargo cross (if needed)
128130
if: ${{ matrix.cargo == 'cross' }}
129131
# Note that this will not work for Rust programs using openssl or libpq.

Justfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This is a `justfile`, which is sort of like a less crufty makefile
2+
# It's processed using <https://github.com/casey/just>, which you can
3+
# install using `cargo install -f just`
4+
#
5+
# To see a list of available commands, run `just --list`
6+
7+
# Look up our version using cargo.
8+
VERSION := `cargo metadata --format-version 1 | jq -r '.packages[] | select(.name == "geocode-csv") | .version'`
9+
10+
# Print the current version.
11+
version:
12+
@echo "{{VERSION}}"
13+
14+
# Check to make sure that we're in releasable shape.
15+
check:
16+
cargo fmt -- --check
17+
cargo deny check
18+
cargo clippy -- -D warnings
19+
cargo test --all
20+
21+
# Check to make sure our working copy is clean.
22+
check-clean:
23+
git diff-index --quiet HEAD --
24+
25+
# Test against real network services, including Smarty.
26+
test-full:
27+
cargo test --all -- --include-ignored
28+
29+
# Release via crates.io and GitHub.
30+
release: check check-clean
31+
cargo publish
32+
git tag v{{VERSION}}
33+
git push
34+
git push --tags

0 commit comments

Comments
 (0)