diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/merge.d | 19 | ||||
| -rw-r--r-- | source/session.d | 45 | 
2 files changed, 58 insertions, 6 deletions
diff --git a/source/merge.d b/source/merge.d index 0b55f92..c08222f 100644 --- a/source/merge.d +++ b/source/merge.d @@ -34,6 +34,11 @@ struct testable_t {  } +/** +  Verifies configuration input +TODO: +    Change the name of this function +  */  string[string][] dmfile(string[] packages) {      string[string][] results;      foreach (line; packages) { @@ -53,6 +58,9 @@ string[string][] dmfile(string[] packages) {  } +/** +  Generate base delivery environment +  */  bool env_combine(ref Session_t session, ref Conda conda) {      if (indexOf(session.base_spec, "://", 0) < 0 && !session.base_spec.exists) {          throw new Exception(session.base_spec ~ " does not exist"); @@ -62,13 +70,11 @@ bool env_combine(ref Session_t session, ref Conda conda) {      string[] specs;      string opmode = session.base_spec.endsWith(".yml") ? "env " : ""; -    if(conda.run(opmode ~ "create -n " ~ session.delivery +    if (conda.run(opmode ~ "create -n " ~ session.delivery                   ~ " --file " ~ session.base_spec)) {          return false;      } -    //conda.activate(session.delivery); -      writeln("Delivery merge specification:");      foreach (record; dmfile(session.conda_requirements)) {          writefln("-> package: %-15s :: version: %s", @@ -85,7 +91,9 @@ bool env_combine(ref Session_t session, ref Conda conda) {      return true;  } - +/** +  Scan prefix for just-installed packages owned by `orgs` +  */  testable_t[] testable_packages(ref Conda conda, string[] inputs, string[] orgs=[]) {      testable_t[] results;      foreach (record; dmfile(inputs)) { @@ -155,6 +163,9 @@ testable_t[] testable_packages(ref Conda conda, string[] inputs, string[] orgs=[  } +/** +  Perform integration tests (brute force) +  */  int integration_test(ref Session_t session,                        ref Conda conda,                        string outdir, diff --git a/source/session.d b/source/session.d index b7e6cf2..a5f86ab 100644 --- a/source/session.d +++ b/source/session.d @@ -8,47 +8,88 @@ import std.string;  import util;  import dyaml; - +/** +  Extended test configuration structure +  */  struct TestExtended_t { +    /// Package name      string name; +    /// Runtime environment for package      string[string] runtime; +    /// Arguments to pass to `Session_t.test_program`      string test_args; +    /// Arbitrary commands to execute for package      string[] commands;  } +/** +  Global delivery configuration structure +  */  struct Session_t { +    /// Name of delivery      string delivery_name; +    /// Version of delivery      string delivery_version; +    /// Revision of delivery (disabled if `final` is `true`)      ubyte delivery_rev; +    /// Platform of delivery (automatically generated)      string delivery_platform; +    /// Python version to use for delivery      string delivery_python; +    /// Fully qualified name (automatically generated)      string delivery; +    /// A conda environment specification to inherit from      string base_spec; +    /// `exit` or `continue` on error. (NOT IMPLEMENTED)      string on_error; +    /// NOT IMPLEMENTED      string script_pre; +    /// NOT IMPLEMENTED      string script_post; +    /// runtime environment variables      string[string] runtime; +    /// conda channels (order preserved)      string[] conda_channels; +    /// conda packages to install      string[] conda_requirements; +    /// pypi index(s) to use      string[] pip_index; +    /// pypi packages to install (accepts arbitrary pip arguments)      string[] pip_requirements; +    /// Determine if integration tests will be executed      bool run_tests = false; +    /// Test framework to execute      string test_program = "pytest"; +    /// default arguments to pass to `test_program`      string test_args = "-v"; +    /// define an array of extended test configurations      TestExtended_t[] test_extended; +    /// conda packages to install globally for integration testing      string[] test_conda_requirements; +    /// pypi packages to install globally for integration testing      string[] test_pip_requirements; +    /// test packages originating from specific users (i.e. spacetelescope)      string[] test_filter_git_orgs; +    /// NOT IMPLEMENTED      string[] test_filter_git_projects;  } +/** +  Read delivery configuration file + +Params: +    filename = path to YAML configuration file + +Returns: +    populated `Session_t` struct + */  Session_t getconf(string filename) {      Node root = Loader.fromFile(filename).load();      Node data;      Session_t session; -    /// Required configuration items +    // Required configuration items      try {          session.delivery_name = root["delivery_name"].as!string;          session.delivery_version = root["delivery_version"].as!string;  | 
