mirror of
https://github.com/nix-community/naersk
synced 2024-11-10 06:04:17 +00:00
Only run full test suite on master
This commit is contained in:
parent
68ce6cfd64
commit
7d9077bf51
4 changed files with 173 additions and 226 deletions
22
.github/workflows/fast.yml
vendored
Normal file
22
.github/workflows/fast.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
name: "fast test"
|
||||
on:
|
||||
push:
|
||||
# master tests are run in test.yml
|
||||
branches-ignore:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
install-nix:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-18.04, macos]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: './.github/actions/nix'
|
||||
- name: "Run tests"
|
||||
run: './script/test --fast'
|
||||
- name: "Save cache"
|
||||
run: save-cache
|
||||
env:
|
||||
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
|
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
|
@ -2,11 +2,14 @@ name: "test"
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
install-nix:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-18.04, macos]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: './.github/actions/nix'
|
||||
|
|
11
script/test
11
script/test
|
@ -9,7 +9,16 @@ export NIX_PATH="nixpkgs=./nix"
|
|||
|
||||
echo "Building"
|
||||
|
||||
extraArgs=( )
|
||||
|
||||
if [ "${1:-}" == "--fast" ]; then
|
||||
echo "running only fast tests"
|
||||
extraArgs+=( --arg fast true )
|
||||
else
|
||||
echo "running all tests"
|
||||
fi
|
||||
|
||||
# Build and create a root
|
||||
nix-build ./test.nix --sandbox --no-link --max-jobs 10
|
||||
nix-build ./test.nix --sandbox --no-link --max-jobs 10 "${extraArgs[@]}"
|
||||
|
||||
echo "all good"
|
||||
|
|
359
test.nix
359
test.nix
|
@ -1,229 +1,142 @@
|
|||
{ system ? builtins.currentSystem }:
|
||||
{ system ? builtins.currentSystem
|
||||
, fast ? false
|
||||
}:
|
||||
let
|
||||
sources = import ./nix/sources.nix;
|
||||
pkgs = import ./nix { inherit system; };
|
||||
naersk = pkgs.callPackage ./default.nix
|
||||
{ inherit (pkgs.rustPackages) cargo rustc; };
|
||||
builtinz = builtins // pkgs.callPackage ./builtins {};
|
||||
|
||||
# local tests, that run pretty fast
|
||||
fastTests =
|
||||
rec
|
||||
{
|
||||
readme = pkgs.runCommand "readme-gen" {}
|
||||
''
|
||||
cat ${./README.tpl.md} > $out
|
||||
${docparse}/bin/docparse ${./config.nix} >> gen
|
||||
sed -e '/GEN_CONFIGURATION/{r gen' -e 'd}' -i $out
|
||||
'';
|
||||
|
||||
docparse = naersk.buildPackage {
|
||||
root = ./docparse;
|
||||
src = builtins.filterSource (
|
||||
p: t:
|
||||
let
|
||||
p' = pkgs.lib.removePrefix (toString ./docparse + "/") p;
|
||||
in
|
||||
p' == "Cargo.lock" || p' == "Cargo.toml" || p' == "src" || p' == "src/main.rs"
|
||||
) ./docparse;
|
||||
};
|
||||
|
||||
readme_test = pkgs.runCommand "readme-test" {}
|
||||
''
|
||||
diff ${./README.md} ${readme}
|
||||
touch $out
|
||||
'';
|
||||
|
||||
simple-dep = naersk.buildPackage {
|
||||
src = ./test/simple-dep;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
simple-dep-doc = naersk.buildPackage
|
||||
{
|
||||
src = ./test/simple-dep;
|
||||
doDoc = true;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
simple-dep-patched = naersk.buildPackage {
|
||||
src = ./test/simple-dep-patched;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
dummyfication = naersk.buildPackage {
|
||||
src = ./test/dummyfication;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
dummyfication_test = pkgs.runCommand
|
||||
"dummyfication-test"
|
||||
{ buildInputs = [ dummyfication ]; }
|
||||
"my-bin > $out";
|
||||
|
||||
git-dep = naersk.buildPackage {
|
||||
doCheck = true;
|
||||
src = ./test/git-dep;
|
||||
cargoOptions = (opts: opts ++ [ "--locked" ]);
|
||||
};
|
||||
|
||||
git-dep-dup = naersk.buildPackage {
|
||||
doCheck = true;
|
||||
src = ./test/git-dep-dup;
|
||||
cargoOptions = (opts: opts ++ [ "--locked" ]);
|
||||
};
|
||||
|
||||
cargo-wildcard = naersk.buildPackage {
|
||||
src = ./test/cargo-wildcard;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace = naersk.buildPackage {
|
||||
src = ./test/workspace;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace-patched = naersk.buildPackage {
|
||||
src = ./test/workspace-patched;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace-doc = naersk.buildPackage
|
||||
{
|
||||
src = ./test/workspace;
|
||||
doDoc = true;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace-build-rs = naersk.buildPackage {
|
||||
src = ./test/workspace-build-rs;
|
||||
doCheck = true;
|
||||
};
|
||||
};
|
||||
|
||||
# extra crates, that are kinda slow to build
|
||||
heavyTests = rec {
|
||||
|
||||
ripgrep-all = naersk.buildPackage
|
||||
{
|
||||
src = sources.ripgrep-all;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
ripgrep-all_test = pkgs.runCommand "ripgrep-all-test"
|
||||
{ buildInputs = [ ripgrep-all ]; }
|
||||
"rga --help && touch $out";
|
||||
|
||||
lorri = naersk.buildPackage {
|
||||
src = sources.lorri;
|
||||
BUILD_REV_COUNT = 1;
|
||||
RUN_TIME_CLOSURE = "${sources.lorri}/nix/runtime.nix";
|
||||
};
|
||||
|
||||
lorri_test = pkgs.runCommand "lorri-test" { buildInputs = [ lorri ]; }
|
||||
"lorri --help && touch $out";
|
||||
|
||||
talent-plan-1 = naersk.buildPackage {
|
||||
src = "${sources.talent-plan}/rust/projects/project-1";
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
talent-plan-2 = naersk.buildPackage {
|
||||
doCheck = true;
|
||||
src = "${sources.talent-plan}/rust/projects/project-2";
|
||||
};
|
||||
|
||||
talent-plan-3 = naersk.buildPackage "${sources.talent-plan}/rust/projects/project-3";
|
||||
|
||||
rustlings = naersk.buildPackage sources.rustlings;
|
||||
};
|
||||
in
|
||||
rec
|
||||
{
|
||||
readme = pkgs.runCommand "readme-gen" {}
|
||||
''
|
||||
cat ${./README.tpl.md} > $out
|
||||
${docparse}/bin/docparse ${./config.nix} >> gen
|
||||
sed -e '/GEN_CONFIGURATION/{r gen' -e 'd}' -i $out
|
||||
'';
|
||||
|
||||
docparse = naersk.buildPackage {
|
||||
root = ./docparse;
|
||||
src = builtins.filterSource (
|
||||
p: t:
|
||||
let
|
||||
p' = pkgs.lib.removePrefix (toString ./docparse + "/") p;
|
||||
in
|
||||
p' == "Cargo.lock" ||
|
||||
p' == "Cargo.toml" ||
|
||||
p' == "src" ||
|
||||
p' == "src/main.rs"
|
||||
) ./docparse;
|
||||
};
|
||||
|
||||
readme_test = pkgs.runCommand "readme-test" {}
|
||||
''
|
||||
diff ${./README.md} ${readme}
|
||||
touch $out
|
||||
'';
|
||||
|
||||
# error[E0554]: `#![feature]` may not be used on the stable release channel
|
||||
# rustfmt = naersk.buildPackage sources.rustfmt { doDocFail = false; };
|
||||
# rustfmt_test = pkgs.runCommand "rustfmt-test"
|
||||
# { buildInputs = [ rustfmt ]; }
|
||||
# "rustfmt --help && cargo-fmt --help && touch $out";
|
||||
|
||||
# error: evaluation aborted with the following error message: 'Not implemented: type int'
|
||||
# ripgrep = naersk.buildPackage sources.ripgrep { usePureFromTOML = false; };
|
||||
# XXX: the `rg` executable is missing because we don't do `cargo install
|
||||
# --path .`.
|
||||
# ripgrep_test = pkgs.runCommand "ripgrep-test"
|
||||
# { buildInputs = [ ripgrep ]; }
|
||||
# "rg --help && touch $out";
|
||||
|
||||
ripgrep-all = naersk.buildPackage
|
||||
{ src = sources.ripgrep-all;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
ripgrep-all_test = pkgs.runCommand "ripgrep-all-test"
|
||||
{ buildInputs = [ ripgrep-all ]; }
|
||||
"rga --help && touch $out";
|
||||
|
||||
lorri = naersk.buildPackage {
|
||||
src = sources.lorri;
|
||||
BUILD_REV_COUNT = 1;
|
||||
RUN_TIME_CLOSURE = "${sources.lorri}/nix/runtime.nix";
|
||||
};
|
||||
|
||||
lorri_test = pkgs.runCommand "lorri-test" { buildInputs = [ lorri ]; }
|
||||
"lorri --help && touch $out";
|
||||
|
||||
talent-plan-1 = naersk.buildPackage {
|
||||
src = "${sources.talent-plan}/rust/projects/project-1";
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
talent-plan-2 = naersk.buildPackage {
|
||||
doCheck = true;
|
||||
src = "${sources.talent-plan}/rust/projects/project-2";
|
||||
};
|
||||
|
||||
talent-plan-3 = naersk.buildPackage "${sources.talent-plan}/rust/projects/project-3";
|
||||
|
||||
# TODO: support for git deps
|
||||
#test_talent-plan-4 = buildPackage "${sources.talent-plan}/rust/projects/project-4" {};
|
||||
#test_talent-plan-5 = buildPackage "${sources.talent-plan}/rust/projects/project-5" {};
|
||||
|
||||
# TODO: change this when niv finally supports submodules
|
||||
# lucetSrc = pkgs.fetchFromGitHub
|
||||
# { inherit (sources.lucet) owner repo rev;
|
||||
# fetchSubmodules = true;
|
||||
# sha256 = "1vwz7gijq4pcs2dvaazmzcdyb8d64y5qss6s4j2wwigsgqmpfdvs";
|
||||
# } ;
|
||||
|
||||
# "targets" is broken
|
||||
#lucet = naersk.buildPackage lucetSrc
|
||||
#{ nativeBuildInputs = [ pkgs.cmake pkgs.python3 ] ;
|
||||
#doCheck = false;
|
||||
#targets =
|
||||
#[ "lucetc"
|
||||
#"lucet-runtime"
|
||||
#"lucet-runtime-internals"
|
||||
#"lucet-module-data"
|
||||
#];
|
||||
#};
|
||||
|
||||
# error in readTOML (remarshal):
|
||||
# Error: Cannot parse as TOML (<string>(92, 14): msg)
|
||||
#rust = naersk.buildPackage sources.rust {};
|
||||
|
||||
rustlings = naersk.buildPackage sources.rustlings;
|
||||
|
||||
simple-dep = naersk.buildPackage {
|
||||
src = ./test/simple-dep;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
simple-dep-doc = naersk.buildPackage
|
||||
{ src = ./test/simple-dep;
|
||||
doDoc = true;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
simple-dep-patched = naersk.buildPackage {
|
||||
src = ./test/simple-dep-patched;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
dummyfication = naersk.buildPackage {
|
||||
src = ./test/dummyfication;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
dummyfication_test = pkgs.runCommand
|
||||
"dummyfication-test"
|
||||
{ buildInputs = [ dummyfication ]; }
|
||||
"my-bin > $out";
|
||||
|
||||
git-dep = naersk.buildPackage {
|
||||
doCheck = true;
|
||||
src = ./test/git-dep;
|
||||
cargoOptions = (opts: opts ++ [ "--locked" ]);
|
||||
};
|
||||
|
||||
git-dep-dup = naersk.buildPackage {
|
||||
doCheck = true;
|
||||
src = ./test/git-dep-dup;
|
||||
cargoOptions = (opts: opts ++ [ "--locked" ]);
|
||||
};
|
||||
|
||||
cargo-wildcard = naersk.buildPackage {
|
||||
src = ./test/cargo-wildcard;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace = naersk.buildPackage {
|
||||
src = ./test/workspace;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace-patched = naersk.buildPackage {
|
||||
src = ./test/workspace-patched;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace-doc = naersk.buildPackage
|
||||
{ src = ./test/workspace;
|
||||
doDoc = true;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
workspace-build-rs = naersk.buildPackage {
|
||||
src = ./test/workspace-build-rs;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
# Fails with some remarshal error
|
||||
#servo = naersk.buildPackage
|
||||
#sources.servo
|
||||
#{ inherit cargo; };
|
||||
|
||||
# TODO: error: no matching package named `rustc-workspace-hack` found
|
||||
# cargo =
|
||||
# with rec
|
||||
# # error: no matching package named `rustc-workspace-hack` found
|
||||
# { cargoSrc = pkgs.runCommand "cargo-src"
|
||||
# {}
|
||||
# ''
|
||||
# mkdir -p $out
|
||||
# cp -r ${sources.cargo}/* $out
|
||||
# chmod -R +w $out
|
||||
# cp ${builtinz.writeTOML "Cargo.toml" cargoCargoToml} $out/Cargo.toml
|
||||
# cp ${builtinz.writeTOML "Cargo.lock" cargoCargoLock} $out/Cargo.lock
|
||||
# '';
|
||||
# #sources.cargo;
|
||||
# # cannot use the pure readTOML
|
||||
# cargoCargoToml = builtinz.readTOML false "${sources.cargo}/Cargo.toml";
|
||||
|
||||
# # XXX: this works around some hack that breaks the build. For more info
|
||||
# # on the hack, see
|
||||
# # https://github.com/rust-lang/rust/blob/b43eb4235ac43c822d903ad26ed806f34cc1a14a/Cargo.toml#L63-L65
|
||||
# cargoCargoToml' = cargoCargoToml //
|
||||
# { dependencies = pkgs.lib.filterAttrs (k: _:
|
||||
# k != "rustc-workspace-hack")
|
||||
# cargoCargoToml.dependencies;
|
||||
# };
|
||||
|
||||
# cargoCargoLock = builtinz.readTOML true "${sources.rust}/Cargo.lock";
|
||||
# };
|
||||
# naersk.buildPackage cargoSrc
|
||||
# {
|
||||
# # Tests fail, although cargo seems to operate normally
|
||||
# doCheck = false;
|
||||
|
||||
# override = oldAttrs:
|
||||
# { buildInputs = oldAttrs.buildInputs ++
|
||||
# [ pkgs.pkgconfig
|
||||
# pkgs.openssl
|
||||
# pkgs.libgit2
|
||||
# pkgs.libiconv
|
||||
# pkgs.curl
|
||||
# pkgs.git
|
||||
# ];
|
||||
# LIBGIT2_SYS_USE_PKG_CONFIG = 1;
|
||||
# } // pkgs.lib.optionalAttrs pkgs.stdenv.isDarwin
|
||||
# {
|
||||
# NIX_LDFLAGS="-F${pkgs.darwin.apple_sdk.frameworks.CoreFoundation}/Library/Frameworks -framework CoreFoundation ";
|
||||
|
||||
# };
|
||||
# };
|
||||
}
|
||||
fastTests // pkgs.lib.optionalAttrs (! fast) heavyTests
|
||||
|
|
Loading…
Reference in a new issue