From ff4b73411dba6097b18266de204587279307be23 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Tue, 1 Jan 2019 17:36:26 -0200 Subject: Run shellcheck tests in srht builds. --- .build.yml | 18 ++++++++++++++++++ .gitignore | 1 + default.nix | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 .build.yml create mode 100644 default.nix diff --git a/.build.yml b/.build.yml new file mode 100644 index 0000000..33e6627 --- /dev/null +++ b/.build.yml @@ -0,0 +1,18 @@ +image: debian/stretch +packages: + - curl +triggers: + - condition: failure + action: email + to: EuAndreh +sources: + - https://git.sr.ht/~euandreh/dotfiles +secrets: + - 7159f943-811f-402d-bb6d-37cd764dc728 +tasks: + - setup: | + curl https://nixos.org/nix/install | sh + echo '. ~/.nix-profile/etc/profile.d/nix.sh' >> ~/.buildenv + - tests: | + cd dotfiles/ + nix-build -A test diff --git a/.gitignore b/.gitignore index 01e9f4e..e671f1e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ mail/offlineimap.pyc tam_required +/result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..8481db4 --- /dev/null +++ b/default.nix @@ -0,0 +1,32 @@ +let + pkgs = import {}; +in with pkgs; with pkgs.stdenv; rec { + subtasks = rec { + shellcheck = mkDerivation rec { + name = "dotfiles-shellcheck"; + src = ./.; + phases = "unpackPhase buildPhase"; + buildInputs = [ pkgs.shellcheck ]; + buildPhase = '' + find . -type f -name '*.sh' | xargs shellcheck + touch $out + ''; + }; + }; + test = mkDerivation rec { + name = "dotfiles-test"; + src = ./.; + phases = "unpackPhase buildPhase"; + buildInputs = [ + subtasks.shellcheck + ]; + buildPhase = '' + echo "Ran tests for:" + for d in ${builtins.toString buildInputs}; do + echo " $d" + done + echo "All tests passed!" + touch $out + ''; + }; +} -- cgit v1.2.3