Compare commits
2 Commits
3d6ed8604a
...
2876b56afb
Author | SHA1 | Date | |
---|---|---|---|
|
2876b56afb | ||
|
e66f67da4a |
14
default.nix
14
default.nix
@ -4,7 +4,7 @@
|
|||||||
hostSystem ? buildSystem,
|
hostSystem ? buildSystem,
|
||||||
pkgsNix ? (import ./nix/pkgs.nix),
|
pkgsNix ? (import ./nix/pkgs.nix),
|
||||||
|
|
||||||
revision ? "",
|
revision ? "dev",
|
||||||
releaseName ? "dev",
|
releaseName ? "dev",
|
||||||
|
|
||||||
bootstrap ? null,
|
bootstrap ? null,
|
||||||
@ -28,7 +28,6 @@ in rec {
|
|||||||
name = "isle-version";
|
name = "isle-version";
|
||||||
|
|
||||||
inherit buildSystem hostSystem revision releaseName;
|
inherit buildSystem hostSystem revision releaseName;
|
||||||
repoSrc = ./.;
|
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgsNative.git ];
|
nativeBuildInputs = [ pkgsNative.git ];
|
||||||
|
|
||||||
@ -41,11 +40,6 @@ in rec {
|
|||||||
|
|
||||||
versionFile=version
|
versionFile=version
|
||||||
|
|
||||||
if [ "$revision" = "" ]; then
|
|
||||||
cp -r "$repoSrc" repoSrcCp
|
|
||||||
revision="$(cd repoSrcCp && git rev-parse HEAD)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Release: $releaseName" >> "$versionFile"
|
echo "Release: $releaseName" >> "$versionFile"
|
||||||
echo "Platform: $hostSystem" >> "$versionFile"
|
echo "Platform: $hostSystem" >> "$versionFile"
|
||||||
echo "Git Revision: $revision" >> "$versionFile"
|
echo "Git Revision: $revision" >> "$versionFile"
|
||||||
@ -169,4 +163,10 @@ in rec {
|
|||||||
mv Isle-* "$out"/bin/isle
|
mv Isle-* "$out"/bin/isle
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tests = pkgs.writeShellScript "isle-tests" ''
|
||||||
|
export PATH=$PATH:${appImage}/bin
|
||||||
|
test_dir=${./tests}
|
||||||
|
exec $SHELL $test_dir/entrypoint.sh
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
releaseName,
|
releaseName,
|
||||||
|
revision,
|
||||||
|
|
||||||
buildSystem ? builtins.currentSystem,
|
buildSystem ? builtins.currentSystem,
|
||||||
pkgsNix ? (import ./nix/pkgs.nix),
|
pkgsNix ? (import ./nix/pkgs.nix),
|
||||||
@ -12,7 +13,7 @@
|
|||||||
mkRelease = hostSystem: let
|
mkRelease = hostSystem: let
|
||||||
|
|
||||||
appImage = ((import ./default.nix) {
|
appImage = ((import ./default.nix) {
|
||||||
inherit buildSystem hostSystem releaseName;
|
inherit buildSystem hostSystem releaseName revision;
|
||||||
}).appImage;
|
}).appImage;
|
||||||
|
|
||||||
in pkgs.stdenv.mkDerivation {
|
in pkgs.stdenv.mkDerivation {
|
||||||
|
@ -19,7 +19,10 @@ if [ -e "$out" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
revision=$(git rev-parse HEAD)
|
||||||
|
|
||||||
result=$(nix-build \
|
result=$(nix-build \
|
||||||
|
--argstr revision "$revision" \
|
||||||
--argstr releaseName "$releaseName" \
|
--argstr releaseName "$releaseName" \
|
||||||
--no-out-link \
|
--no-out-link \
|
||||||
release.nix \
|
release.nix \
|
||||||
|
3
test.sh
Executable file
3
test.sh
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
$(nix-build --no-out-link -A tests)
|
2
tests/00-version.sh
Normal file
2
tests/00-version.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
version="$(isle version)"
|
||||||
|
test "$(echo "$version" | wc -l)" -gt 0
|
27
tests/entrypoint.sh
Normal file
27
tests/entrypoint.sh
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
set -e
|
||||||
|
|
||||||
|
# cd into script's directory
|
||||||
|
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null
|
||||||
|
|
||||||
|
tmp="$(mktemp --tmpdir -d isle-tests.XXXXXX)"
|
||||||
|
trap 'rm -rf $tmp' EXIT
|
||||||
|
|
||||||
|
export TMPDIR="$tmp"
|
||||||
|
echo "tmp dir is $TMPDIR"
|
||||||
|
|
||||||
|
echo -e '\nrunning all tests...\n'
|
||||||
|
|
||||||
|
for file in $(find . -type f -name '*.sh' | grep -v entrypoint.sh | sort -n); do
|
||||||
|
echo "running test $file"
|
||||||
|
if ! $SHELL -e -x "$file" >"$tmp/$file.log" 2>&1; then
|
||||||
|
echo "TEST FAILED"
|
||||||
|
echo "output of test is as follows"
|
||||||
|
echo "------------------------------"
|
||||||
|
cat "$tmp/$file.log"
|
||||||
|
echo "------------------------------"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e '\ntests succeeded!'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user