ci: Verify rustfmt
Split out the command into a separate `Makefile` that doesn't use Automake so we can invoke it early. Closes: #1674 Approved by: dustymabe
This commit is contained in:
parent
6b5e475607
commit
387da3a420
13
Makefile-extra.inc
Normal file
13
Makefile-extra.inc
Normal file
@ -0,0 +1,13 @@
|
||||
# -*- mode: makefile -*-
|
||||
# This file defines rules that don't depend on Automake.
|
||||
# The main idea here is some things we may want to execute
|
||||
# from CI before we've even run automake, and secondly
|
||||
# one can avoid rerunning Automake when these rules change.
|
||||
#
|
||||
# Specifically right now one can invoke e.g.
|
||||
# `make -f Makefile-extra.inc rustfmt` directly.
|
||||
|
||||
rustfmt:
|
||||
rustfmt rust/src/*.rs
|
||||
.PHONY: rustfmt
|
||||
|
@ -127,10 +127,6 @@ endif
|
||||
|
||||
rpm_ostree_CFLAGS += $(PKGDEP_RPMOSTREE_RS_CFLAGS)
|
||||
rpm_ostree_LDADD += $(librpmostree_rust_path) $(PKGDEP_RPMOSTREE_RS_LIBS)
|
||||
rustfmt:
|
||||
rustfmt $(filter %.rs,$(LIBRPMOSTREE_RUST_SRCS))
|
||||
# Outside the ifdef, otherwise automake complains
|
||||
.PHONY: rustfmt
|
||||
|
||||
# Wraps `cargo test`. This is always a debug non-release build;
|
||||
# the main thing here is we still drop the `target` dir in our build
|
||||
|
@ -16,6 +16,7 @@
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
include Makefile-decls.am
|
||||
include Makefile-extra.inc
|
||||
|
||||
newname = nts
|
||||
if BUILDOPT_NEW_NAME
|
||||
|
@ -5,6 +5,25 @@ set -xeuo pipefail
|
||||
|
||||
dn=$(dirname $0)
|
||||
. ${dn}/libbuild.sh
|
||||
|
||||
# Add checks here which depend on the build container
|
||||
# but don't require a full build (code static analysis).
|
||||
if test -x /usr/bin/rustfmt; then
|
||||
echo "Verifying rustfmt"
|
||||
if !git diff --quiet --exit-code; then
|
||||
echo "outstanding diff before rustfmt" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
make -f Makefile-extra.inc rustfmt
|
||||
if git diff --quiet --exit-code; then
|
||||
git diff
|
||||
echo "Please run rustfmt"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "No /usr/bin/rustfmt, skipping"
|
||||
fi
|
||||
|
||||
${dn}/build.sh
|
||||
# NB: avoid make function because our RPM building doesn't
|
||||
# support parallel runs right now
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -xeuo pipefail
|
||||
|
||||
echo "Checking for tabs:"
|
||||
(git grep -E '^ +' -- '*.[ch]' || true) > tabdamage.txt
|
||||
if test -s tabdamage.txt; then
|
||||
@ -7,4 +8,5 @@ if test -s tabdamage.txt; then
|
||||
cat tabdamage.txt
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "ok"
|
||||
|
@ -29,5 +29,5 @@ pkg_install ostree{,-devel,-grub2} createrepo_c /usr/bin/jq PyYAML \
|
||||
libubsan libasan libtsan elfutils fuse sudo python-gobject-base \
|
||||
selinux-policy-devel selinux-policy-targeted python2-createrepo_c \
|
||||
rsync rpm-python # provided by python2-rpm on Fedora
|
||||
# For ex-container tests and clang build
|
||||
pkg_install_if_os fedora parallel clang
|
||||
# For more CI testing
|
||||
pkg_install_if_os fedora parallel clang rustfmt-preview
|
||||
|
Loading…
Reference in New Issue
Block a user