Skip to content

Commit

Permalink
Updating actions to create a build/test matrix. Report version when s…
Browse files Browse the repository at this point in the history
…tarting kb-sdk. Add release notes. Fix KBase report class name error in Java version.
  • Loading branch information
ialarmedalien committed Jun 16, 2020
1 parent 835b9cc commit 9ac1aba
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 63 deletions.
132 changes: 105 additions & 27 deletions .github/workflows/kb_sdk-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ on:

jobs:

kb_sdk_build:
runs-on: ubuntu-latest
test_kb-sdk_builds:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
language: [perl, python, java]
test_type: [base, example]

steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -16,43 +24,113 @@ jobs:
with:
java-version: 1.8

- name: Build with Ant
run: |
make
- name: Add bin to $PATH
run: |
echo "::add-path::$GITHUB_WORKSPACE/bin"
- name: checking kb-sdk functions
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
LANGUAGE_TOKEN: ${{ matrix.language }}
run: |
env
kb-sdk help
kb-sdk version
- name: init base repo
if: matrix.test_type == 'base'
env:
LANGUAGE_TOKEN: ${{ matrix.language }}
run: |
kb-sdk init -l $LANGUAGE_TOKEN -u user SampleApp
- name: init example repo
if: matrix.test_type == 'example'
env:
LANGUAGE_TOKEN: ${{ matrix.language }}
run: |
kb-sdk init -l $LANGUAGE_TOKEN -u user --example SampleApp
- name: test ${{ matrix.test_type }} repo
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
LANGUAGE_TOKEN: ${{ matrix.language }}
run: |
cd SampleApp
kb-sdk test || true
sed -i "s/test_token=/test_token=$KBASE_TEST_TOKEN/" test_local/test.cfg
kb-sdk test
- name: make resulting app available as artefact in case of failure
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: kbaseapp-${{ matrix.language }}-${{ matrix.test_type }}-${{ matrix.os }}
path: SampleApp


test_existing_repos:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
app: [WsLargeDataIO, KBaseReport]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build with Ant
run: |
make
- name: Add bin to $PATH
run: |
echo "::add-path::$GITHUB_WORKSPACE/bin"
- name: checking basic kb-sdk functions
run: |
env
kb-sdk help
kb-sdk version
- name: Upload kb-sdk build
uses: actions/upload-artifact@v2
- name: Checkout existing kbase module ${{ matrix.app }}
uses: actions/checkout@v2
with:
name: kb-sdk_build
path: bin/kb-sdk
repository: kbaseapps/${{ matrix.app }}
path: kbase_app

- name: checking kb-sdk functions
- name: prep for repo tests
run: |
cd kbase_app
kb-sdk test || true
- name: edit test.cfg
env:
KBASE_TEST_TOKEN: ${{ secrets.KBASE_TEST_TOKEN }}
run: |
kb-sdk help
kb-sdk version
kb-sdk init -l perl -u user PerlBase
cd PerlBase
kb-sdk test
cd ..
rm -rf PerlBase
kb-sdk init -l perl -u user --example PerlExample
cd PerlExample
kb-sdk test
cd ..
rm -rf PerlExample
kb-sdk init -l python -u user --example PythonExample
cd PythonExample
make
kb-sdk test
cd ..
rm -rf PythonExample
kb-sdk init -l java -u user --example JavaExample
cd JavaExample
cd kbase_app
sed -i "s/test_token=/test_token=$KBASE_TEST_TOKEN/" test_local/test.cfg
- name: run test
run: |
cd kbase_app
kb-sdk test
- name: make resulting app available as artefact in case of failure
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: kbaseapp-${{ matrix.app }}-${{ matrix.os }}
path: kbase_app
20 changes: 15 additions & 5 deletions RELEASE_NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
OVERVIEW
-----------------------------------------
The KBase SDK is a set of tools for developing new modules
that can be dynamically registered and run on the KBase
platform. Modules include all code, specification files, and
documentation needed to define and run a set of methods
The KBase SDK is a set of tools for developing new modules
that can be dynamically registered and run on the KBase
platform. Modules include all code, specification files, and
documentation needed to define and run a set of methods
in the KBase Narrative interface.

VERSION: 1.2.2 (Released 06/xx/2020)
------------------------------------
NEW FEATURES:
- kb-sdk version reports the build time and date of the instance
- kb-sdk can use the environment variable KBASE_TEST_TOKEN if a test token is not present in the test.cfg file
- GitHub Actions now used to run basic tests on initialising and testing new base and sample repos.

BUG FIXES:
- Java client uses the correct name for KBase report

VERSION: 1.2.0 (Released 11/14/2018)
------------------------------------
NEW FEATURES:
Expand Down Expand Up @@ -74,7 +84,7 @@ VERSION: 1.0.0 (Released 11/19/2015)
------------------------------------------
NEW FEATURES:
- R language is now supported for generation of clients and server stubs.
- Test sub-command is fully implemented for all 4 languages (perl,
- Test sub-command is fully implemented for all 4 languages (perl,
python, java and R).
- Version sub-command was added

Expand Down
8 changes: 5 additions & 3 deletions src/java/us/kbase/mobu/ModuleBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class ModuleBuilder {
public static final String GLOBAL_SDK_HOME_ENV_VAR = "KB_SDK_HOME";
public static final String DEFAULT_METHOD_STORE_URL = "https://appdev.kbase.us/services/narrative_method_store/rpc";

public static final String VERSION = "1.2.0";
public static final String VERSION = "1.2.2";

public static void main(String[] args) throws Exception {

Expand All @@ -58,7 +58,6 @@ public static void main(String[] args) throws Exception {
JCommander jc = new JCommander(gArgs);
jc.setProgramName(MODULE_BUILDER_SH_NAME);


// add the 'init' command
InitCommandArgs initArgs = new InitCommandArgs();
jc.addCommand(INIT_COMMAND, initArgs);
Expand Down Expand Up @@ -95,6 +94,9 @@ public static void main(String[] args) throws Exception {
RunCommandArgs runArgs = new RunCommandArgs();
jc.addCommand(RUN_COMMAND, runArgs);

// print name and version
printVersion();

// parse the arguments and gracefully catch any errors
try {
jc.parse(args);
Expand Down Expand Up @@ -383,7 +385,7 @@ public static String getGitProp(String propertyToGet) {


private static int runVersionCommand(VersionCommandArgs testArgs, JCommander jc) {
printVersion();
// version was printed at start up, so just exit
return 0;
}

Expand Down
26 changes: 13 additions & 13 deletions src/java/us/kbase/templates/module_java_impl.vm.properties
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import assemblyutil.GetAssemblyParams;
import assemblyutil.SaveAssemblyParams;
import kbasereport.CreateParams;
import kbasereport.KBaseReportClient;
import kbasereport.Report;
import kbasereport.SimpleReport;
import kbasereport.ReportInfo;
import kbasereport.WorkspaceObject;
import net.sf.jfasta.FASTAElement;
Expand Down Expand Up @@ -73,11 +73,11 @@ public class ${java_module_name}Server extends JsonServerServlet {
public FilterContigsResults filterContigs(FilterContigsParams params, AuthToken authPart, RpcContext jsonRpcContext) throws Exception {
FilterContigsResults returnVal = null;
//BEGIN run_${module_name}

// Print statements to stdout/stderr are captured and available as the App log
System.out.println("Starting filter contigs. Parameters:");
System.out.println(params);

/* Step 1 - Parse/examine the parameters and catch any errors
* It is important to check that parameters exist and are defined, and that nice error
* messages are returned to users. Parameter values go through basic validation when
Expand All @@ -103,7 +103,7 @@ public class ${java_module_name}Server extends JsonServerServlet {
throw new IllegalArgumentException("min_length parameter cannot be negative (" +
minLength + ")");
}

/* Step 2 - Download the input data as a Fasta file
* We can use the AssemblyUtils module to download a FASTA file from our Assembly data
* object. The return object gives us the path to the file that was created.
Expand Down Expand Up @@ -142,26 +142,26 @@ public class ${java_module_name}Server extends JsonServerServlet {
final String resultText = String.format("Filtered assembly to %s contigs out of %s",
remaining, total);
System.out.println(resultText);

// Step 4 - Save the new Assembly back to the system

final String newAssyRef = assyUtil.saveAssemblyFromFasta(new SaveAssemblyParams()
.withAssemblyName(fileobj.getAssemblyName())
.withWorkspaceName(workspaceName)
.withFile(new FastaAssemblyFile().withPath(out.toString())));

// Step 5 - Build a Report and return

final KBaseReportClient kbr = new KBaseReportClient(callbackURL, authPart);
// see note above about bad practice
kbr.setIsInsecureHttpConnectionAllowed(true);
final ReportInfo report = kbr.create(new CreateParams().withWorkspaceName(workspaceName)
.withReport(new Report().withTextMessage(resultText)
.withReport(new SimpleReport().withTextMessage(resultText)
.withObjectsCreated(Arrays.asList(new WorkspaceObject()
.withDescription("Filtered contigs")
.withRef(newAssyRef)))));
// Step 6: contruct the output to send back

returnVal = new ReportResults()
.withReportName(report.getName())
.withReportRef(report.getRef());
Expand Down Expand Up @@ -195,7 +195,7 @@ import java.net.MalformedURLException;

import kbasereport.CreateParams;
import kbasereport.KBaseReportClient;
import kbasereport.Report;
import kbasereport.SimpleReport;
import kbasereport.ReportInfo;
import kbasereport.WorkspaceObject;
import ${java_package}.ReportResults;
Expand All @@ -221,7 +221,7 @@ import ${java_package}.ReportResults;
final String parameter_1 = params.get("parameter_1").asInstance();
final ReportInfo report = kbr.create(new CreateParams()
.withWorkspaceName(ws_name)
.withReport(new Report()
.withReport(new SimpleReport()
.withTextMessage(parameter_1)
.withObjectsCreated(new java.util.ArrayList<WorkspaceObject>())));

Expand All @@ -230,4 +230,4 @@ import ${java_package}.ReportResults;
.withReportRef(report.getRef());

//END run_${module_name}
#end
#end
Loading

0 comments on commit 9ac1aba

Please sign in to comment.