move lint commands to external file

This commit is contained in:
Jörg Thalheim 2018-08-13 17:55:34 +02:00
parent b132efe226
commit c7ebfd5241
2 changed files with 22 additions and 13 deletions

View file

@ -2,6 +2,8 @@
set -eu -o pipefail # Exit with nonzero exit code if anything fails
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
is-automatic-update() {
[[ "$TRAVIS_EVENT_TYPE" == "cron" ]] || [[ "$TRAVIS_EVENT_TYPE" == "api" ]]
}
@ -26,25 +28,14 @@ export encrypted_080f214a372c_key= encrypted_080f214a372c_iv=
nix-build release.nix
result/bin/nur format-manifest
if [ -n "$(git diff --exit-code repos.json)" ]; then
echo "repos.json was not formatted before committing repos.json:" >&2
git diff --exit-code repos.json
echo "Please run ./bin/nur/format-manifest.py and updates repos.json accordingly!" >&2
exit 1
if ! is-automatic-update; then
bash $DIR/lint.sh
fi
result/bin/nur update
nix-build
if ! is-automatic-update; then
# Type checker
nix run nixpkgs.python3Packages.mypy -c mypy nur
# Format checker
nix run nixpkgs.python3Packages.black -c black --check .
# Linter
nix run nixpkgs.python3Packages.flake8 -c flake8 .
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
echo "Skipping deploy; just doing a build."
exit 0

18
ci/lint.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eu -o pipefail # Exit with nonzero exit code if anything fails
$(nix-build --no-out-link release.nix)/bin/nur format-manifest
if [ -n "$(git diff --exit-code repos.json)" ]; then
echo "repos.json was not formatted before committing repos.json:" >&2
git diff --exit-code repos.json
echo "Please run ./bin/nur/format-manifest.py and updates repos.json accordingly!" >&2
exit 1
fi
# Type checker
nix run nixpkgs.python3Packages.mypy -c mypy nur
# Format checker
nix run nixpkgs.python3Packages.black -c black --check .
# Linter
nix run nixpkgs.python3Packages.flake8 -c flake8 .