MD-Anderson-Bioinformatics / NG-CHM

A dynamic, graphical environment for exploration of clustered or non-clustered heat map data in a web browser.
https://bioinformatics.mdanderson.org/main/NG-CHM-V2:Overview
GNU General Public License v2.0
10 stars 9 forks source link

Build actions only work with ubuntu #513

Open marohrdanz opened 1 year ago

marohrdanz commented 1 year ago

We have several GitHub Action workflows to build artifacts from this repository. For unknown reasons, they only work with

runs-on: ubuntu-<version or 'latest'>

On both macOS and windows, an error occurs when running ant -f build_ngchmApp.xml in the target create_server_app_dir. The code appears to be reading in file custom.js as a string, and crashes when it gets to the part of the string:

logo: "https://www.cbioportal.org/images/cbioportal_logo.png",

Because this part contains the substrings "images/" and ".png", the function CompilerUtilities.copyLineAndImages() attempts to copy a file "cbioportal_logo.png", which of course doesn't exist in our repo. Here is that function for quick reference:

public static void copyLineAndImages (String line, String inputDir, String outputDir)
        throws Exception
{   
        if (line.contains("images/")) {
                // Copy any images on line to output directory.
                String toks[] = line.split(" ");
                for (String tok : toks) {
                        if (tok.contains("images/")) {
                                int start = tok.indexOf("images/");
                                int stop = tok.indexOf(".png");
                                String fileName;
                                if (start < 0 || stop < 0) {
                                        System.out.println ("Bad image string: '" + tok + "' on line " + line);
                                }   
                                stop = stop + 4;  // Stop at end of .png
                                fileName = tok.substring(start,stop);
                                if (!imageFiles.contains(fileName)) {
                                        System.out.println("Copying image file " + fileName);
                                         CompilerUtilities.copyFile (inputDir + "/" + fileName, outputDir + "/" + fileName)
                                        imageFiles.add (fileName);
                                        imageCounts.add (0);
                                }   
                                int idx = imageFiles.indexOf(fileName);
                                imageCounts.set (idx, imageCounts.get (idx) + 1); 
                        }   
                }   
        }   
}   

A few mysteries:

As a stab in the dark, we wondered if updating the closure compiler jar file would address the issue. I tried updating from closure-compiler-v20200204.jar -> closure-compiler-v20230502.jar, and compiling with the required java 11. However the issue remains.

jmelott commented 1 year ago

In addition to the issues mentioned above, perhaps the code shouldn't be including anything with an image with an absolute URL? Maybe if (tok.contains("images/")) { should be if (tok.contains("images/") && !tok.startsWith("http")) {

jmelott commented 1 year ago

I looked around an noticed that different people were having issues a recently with code sometimes not being run on ubuntu systems after some changes on github's side regarding which builds are being used for the runners. https://github.com/actions/runner-images/issues/7733

Is there anything in our action that we can use to verify that that code is actually being run when we use the runs-on: ubuntu-<version or 'latest'> setting. Perhaps the code should be failing consistently for all systems, but it just isn't actually being run on the ubuntu system at all so therefore we don't get an error from it?

marohrdanz commented 1 year ago

@jmelott we can look into it. For reference: ant -f build_ngchmApp.xml runs just fine manually on RedHat linux also.