diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a47848f..14a4ef3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,10 +28,21 @@ jobs: # Runs a set of commands using the runners shell - name: Download ACE image run: | + ######################################################################## + # + # We move the source to the build directory to make sure it is not in + # the same directory as the downloaded install image. If the source + # stays where it is, then ibmint tries to scan it for projects! + # + ######################################################################## + echo "Moving source to the build directory" + mkdir build + mv * build || /bin/true + ######################################################################## # # Download ace-minimal image; could use ace-minimal-build but in our - # case we already have Maven and the various utilities contained in + # case we already have Gradle and the various utilities contained in # the build image, so we download the base image because it's smaller. # ######################################################################## @@ -40,8 +51,10 @@ jobs: bash moby-download-frozen-image-v2.sh ace-minimal-download tdolby/experimental:ace-minimal-12.0.2.0-alpine mkdir ace-minimal-image-unzip cd ace-minimal-download && grep layer.tar manifest.json | tr -d '"' | tr -d ',' | xargs -n 1 tar -C ../ace-minimal-image-unzip -xf && cd - && rm -rf ace-minimal-download + # Not actually running on Alpine, so we undo a hack sed -i 's/\/bin\/mksh/\/bin\/bash/g' ace-minimal-image-unzip/opt/ibm/ace-12/ace ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsicreateworkdir ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsipackagebar + ######################################################################## # # Set up ACE environment and ensure downloaded image works @@ -63,14 +76,15 @@ jobs: export LICENSE=accept export MQSI_WORKPATH=$PWD/ace-minimal-image-unzip/var/mqsi . ace-minimal-image-unzip/opt/ibm/ace-12/server/bin/mqsiprofile + # Using ace-minimal without WXS support export MQSI_NO_CACHE_SUPPORT=1 - # Make sure Maven and others can find the correct javac - export PATH=$PWD/ace-minimal-image-unzip/opt/ibm/ace-12/common/jdk/bin:$PATH + ######################################################################## # - # Run the Maven build and unit test phases + # Run the Gradle build and unit test phases # ######################################################################## - echo "Running Maven install to $PWD/ace-server . . ." - mvn --no-transfer-progress verify + cd build + echo "Running Gradle build and unit test" + gradle -PCLASSPATH=$CLASSPATH diff --git a/.gitignore b/.gitignore index 6dba2b0..bfd3dbd 100644 --- a/.gitignore +++ b/.gitignore @@ -19,5 +19,10 @@ TeaSharedLibrary/TeaSharedLibraryJava.jar **/maven-archiver/* **/*-maven.jar +TeaRESTApplication_UnitTest/TeaRESTApplication_UnitTest.jar + # This shouldn't be needed! TeaRESTApplication_UnitTest/resources + + +.gradle diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..48d970f --- /dev/null +++ b/build.gradle @@ -0,0 +1,46 @@ +// +// Gradle build file for the ACE demo pipeline +// +// Usage: +// +// gradle -PCLASSPATH=$CLASSPATH [-Pinstall.work.directory=] +// +// + +def baseFilePath = System.getenv("MQSI_BASE_FILEPATH") +def fileSep = System.getProperty("file.separator") +def installWorkDir = "/home/aceuser/ace-server" + +if ( project.hasProperty("install.work.directory") ) { + installWorkDir = project.getProperty("install.work.directory") +} + +task deleteTestWorkDirectory(type: Delete) { + delete '/tmp/gradle-test-work-dir' +} + +task createTestWorkDirectory(type: Exec) { + commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/mqsicreateworkdir', '/tmp/gradle-test-work-dir' +} + +task buildWithUnitTests(type: Exec) { + commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/ibmint', 'deploy', '--input-path', "$projectDir", '--output-work-directory', '/tmp/gradle-test-work-dir', '--project', 'TeaSharedLibraryJava', '--project', 'TeaSharedLibrary', '--project', 'TeaRESTApplication', '--project', 'TeaRESTApplication_UnitTest' +} + +task runUnitTests(type: Exec) { + // Gradle throws away the CLASSPATH setting we need :( + // + // Without this setting, errors of the form occur: + // + // 2021-10-19 15:32:51.428952: BIP9320E: Message Flow 'gen.TeaRESTApplication', 'gen.TeaRESTApplication' encountered a failure and could not start. + // 2021-10-19 15:32:51.429000: BIP3944E: Failed to generate the map for mapping routine '{default}:oldToNew_Mapping', with the following details: Location: '' Internal Error Number: 'NoClassDefFoundError' Error Message: 'com.fasterxml.jackson.core.JsonProcessingException'. + // 2021-10-19 15:32:51.429016: BIP3946E: Failed to generate mapping routine 'com.fasterxml.jackson.core.JsonProcessingException + // ', with the following details: '{1}'. + + environment CLASSPATH: project.getProperty("CLASSPATH") + + // Exclude node.js for ace-minimal build + commandLine baseFilePath + fileSep + 'server' + fileSep + 'bin/IntegrationServer', '-w', '/tmp/gradle-test-work-dir', '--test-project', 'TeaRESTApplication_UnitTest', '--admin-rest-api', '-1', '--no-nodejs' +} + +defaultTasks 'deleteTestWorkDirectory', 'createTestWorkDirectory', 'buildWithUnitTests', 'runUnitTests' diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..07d21de --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'ace-demo-pipeline'