Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Makefile targets #743

Merged
merged 1 commit into from
Jan 19, 2024
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
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ jobs:
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: |
cargo fmt --all -- --check
- run: make fmt

clippy:
runs-on: ubuntu-latest
Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ jobs:
target: ${{ matrix.target.triple }}
- name: "Run prepare tests"
run: ci/prepare-tests.sh
- run: |
cargo build --release --workspace
cargo test --release --workspace
- run: make release
- name: "Strip release binary"
run: |
# strip target/release/pica-lint
Expand Down Expand Up @@ -119,9 +117,7 @@ jobs:
target: ${{ matrix.target.triple }}
- name: "Run prepare tests"
run: ci/prepare-tests.sh
- run: |
cargo build --release --workspace
cargo test --release --workspace
- run: make release
- name: "Build release archive"
id: build-archive
shell: bash
Expand Down Expand Up @@ -164,9 +160,7 @@ jobs:
target: ${{ matrix.target.triple }}
- name: "Run prepare tests"
run: ci/prepare-tests.sh
- run: |
cargo build --release --workspace
cargo test --release --workspace
- run: make release
- name: "Strip release binary"
run: |
strip target/release/pica-lint
Expand Down
36 changes: 30 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,39 @@
.DEFAULT_GOAL := build

# Don't use implicit rules or variables.
MAKEFLAGS += -rR

DESTDIR=
CARGO ?= cargo
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin

.PHONY: check
check:
$(CARGO) check --workspace --all-features

.PHONY: clippy
build:
$(CARGO) build --workspace --all-features

clippy:
$(CARGO) clippy --workspace --all-features -- \
-D warnings -D rust-2021-compatibility -D future-incompatible \
-W unreachable-pub
$(CARGO) clippy --workspace --all-features

.PHONY: test
test:
$(CARGO) test --workspace --all-features --no-fail-fast

fmt:
$(CARGO) fmt --all -- --check

doc:
$(CARGO) doc --no-deps

release:
$(CARGO) build --workspace --all-features --release
$(CARGO) test --workspace --all-features --release

install: release
sudo install -Dm755 target/release/pica $(DESTDIR)$(BINDIR)

clean:
$(CARGO) clean

.PHONY: build clean check clippy test fmt doc release install