From 5ed0371ee36d2681518c94d5bd0394fdd794375d Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Thu, 2 Nov 2023 02:55:08 -0400 Subject: [PATCH 1/3] make the import process faster with bulk insert --- src/main/java/com/gw/tools/WorkflowTool.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/gw/tools/WorkflowTool.java b/src/main/java/com/gw/tools/WorkflowTool.java index 0a4d611b8..3f3939a46 100644 --- a/src/main/java/com/gw/tools/WorkflowTool.java +++ b/src/main/java/com/gw/tools/WorkflowTool.java @@ -971,31 +971,24 @@ public String saveWorkflowFromFolder(String wid, String foldername) throws Parse this.save(w); - // save history - File[] files = new File(historyfolder).listFiles(); + List historyList = new ArrayList<>(); + File[] files = new File(historyfolder).listFiles(); if (files != null) { - for (File file : files) { - String historyjson = bt.readStringFromFile(file.getAbsolutePath()); - JSONArray historyarray = (JSONArray) jsonparser.parse(historyjson); historyarray.forEach((obj) -> { - String jsonobj = ((JSONObject) obj).toJSONString(); - History hist = historyFromJSON(jsonobj); - - historyrepository.save(hist); - // historyrepository.saveJSON(jsonobj); + historyList.add(hist); }); - } - } + historyrepository.saveAll(historyList); + // save process String processjson = bt.readStringFromFile(codefolder + "process.json"); From a29f01e66b15a4c055f9008160a9f8ea691a80d4 Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Mon, 13 Nov 2023 06:54:40 -0500 Subject: [PATCH 2/3] added make-app.sh script --- macos-deployment/make-app.sh | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 macos-deployment/make-app.sh diff --git a/macos-deployment/make-app.sh b/macos-deployment/make-app.sh new file mode 100644 index 000000000..dcfc31f54 --- /dev/null +++ b/macos-deployment/make-app.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +APP_NAME="Geoweaver" +REPO_NAME="Geoweaver" +APP_DIR="${GITHUB_WORKSPACE}/${APP_NAME}.app" +JAR_PATH="${GITHUB_WORKSPACE}/target/geoweaver.jar" +ICON_PATH="${GITHUB_WORKSPACE}/linux-deployment/usr/local/bin/geoweaver.png" + +mkdir -p "${APP_DIR}/Contents/MacOS" +mkdir -p "${APP_DIR}/Contents/Resources" +mkdir -p "${APP_DIR}/Contents/Java" + +cp "${JAR_PATH}" "${APP_DIR}/Contents/Java/" + +EXECUTABLE_SCRIPT="${APP_DIR}/Contents/MacOS/${APP_NAME}" +cat > "${EXECUTABLE_SCRIPT}" < /dev/null 2>&1 & +sleep 7 +open http://localhost:8070/Geoweaver +EOF + +chmod +x "${EXECUTABLE_SCRIPT}" + +INFO_PLIST="${APP_DIR}/Contents/Info.plist" +cat > "${INFO_PLIST}" < + + + + CFBundleExecutable + ${APP_NAME} + CFBundleIconFile + AppIcon + CFBundleIdentifier + com.gokulprathin.geoweaver + CFBundleName + ${APP_NAME} + CFBundleVersion + 1.0.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleInfoDictionaryVersion + 6.0 + CFBundleShortVersionString + 1.0 + + +EOF + +ICONSET="${APP_DIR}/Contents/Resources/${APP_NAME}.iconset" +mkdir "${ICONSET}" + +sips -z 16 16 "${ICON_PATH}" --out "${ICONSET}/icon_16x16.png" +sips -z 32 32 "${ICON_PATH}" --out "${ICONSET}/icon_32x32.png" +sips -z 128 128 "${ICON_PATH}" --out "${ICONSET}/icon_128x128.png" +sips -z 256 256 "${ICON_PATH}" --out "${ICONSET}/icon_256x256.png" +sips -z 512 512 "${ICON_PATH}" --out "${ICONSET}/icon_512x512.png" +cp "${ICON_PATH}" "${ICONSET}/icon_1024x1024.png" # Assuming the original PNG is at least 1024x1024 + +iconutil -c icns "${ICONSET}" --output "${APP_DIR}/Contents/Resources/AppIcon.icns" +rm -rf "${ICONSET}" +echo "${APP_NAME}.app has been created on your Desktop." From 4b1fac6c878d028cbca65542a7b8494f0f672c51 Mon Sep 17 00:00:00 2001 From: Gokul Prathin Date: Mon, 13 Nov 2023 06:56:18 -0500 Subject: [PATCH 3/3] added osx config to github actions --- .github/workflows/main.yml | 77 +++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 18 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf2068a9b..fedbcb6f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: jobs: - build: + build-jar: runs-on: ubuntu-latest steps: @@ -36,14 +36,12 @@ jobs: - name: Append version to DEBIAN/control run: | echo "Version: ${{ env.VERSION }}" >> $GITHUB_WORKSPACE/linux-deployment/DEBIAN/control - + - name: Set execute permissions for postinst script run: chmod 755 $GITHUB_WORKSPACE/linux-deployment/DEBIAN/postinst - name: Copy geoweaver.jar to linux-deployment directory - run: | - ls $GITHUB_WORKSPACE/target/ - cp $GITHUB_WORKSPACE/target/geoweaver.jar $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/ + run: cp $GITHUB_WORKSPACE/target/geoweaver.jar $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/ - name: Make geoweaver.sh executable run: chmod +x $GITHUB_WORKSPACE/linux-deployment/usr/local/bin/geoweaver.sh @@ -51,7 +49,6 @@ jobs: - name: Build deb package run: | cd $GITHUB_WORKSPACE/linux-deployment - cat DEBIAN/control dpkg-deb --build . geoweaver.deb - name: Upload Geoweaver Artifacts @@ -63,8 +60,46 @@ jobs: pom.xml linux-deployment/*.deb + build-macos: + needs: build-jar + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Download Geoweaver Artifacts + uses: actions/download-artifact@v2 + with: + name: geoweaver-artifacts + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + + - name: Build .app file + run: | + chmod +x ${GITHUB_WORKSPACE}/macos-deployment/make-app.sh + ${GITHUB_WORKSPACE}/macos-deployment/make-app.sh + + - name: Create .dmg file with Applications shortcut + run: | + APP_NAME="Geoweaver" + DMG_TEMP_DIR="${GITHUB_WORKSPACE}/dmg_temp" + mkdir -p "${DMG_TEMP_DIR}" + cp -r "${GITHUB_WORKSPACE}/geoweaver.app" "${DMG_TEMP_DIR}" + ln -s /Applications "${DMG_TEMP_DIR}/Applications" + hdiutil create -volname "$APP_NAME" -srcfolder "${DMG_TEMP_DIR}" -ov -format UDZO "${GITHUB_WORKSPACE}/${APP_NAME}.dmg" + - name: Upload .dmg file as an artifact + uses: actions/upload-artifact@v2 + with: + name: geoweaver-dmg + path: /Users/runner/work/Geoweaver/Geoweaver/Geoweaver.dmg + release: - needs: build + needs: [build-jar, build-macos] runs-on: ubuntu-latest steps: @@ -79,6 +114,11 @@ jobs: with: name: geoweaver-artifacts + - name: Download .dmg file + uses: actions/download-artifact@v2 + with: + name: geoweaver-dmg + - name: Get ID and upload URL of the latest release run: | RESPONSE=$(curl -s -H "Authorization: token ${{ secrets.PAT }}" "https://api.github.com/repos/${{ github.repository }}/releases/latest") @@ -86,15 +126,6 @@ jobs: RELEASE_ID=$(echo "$RESPONSE" | jq -r .id) echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV echo "RELEASE_ID=$RELEASE_ID" >> $GITHUB_ENV - # Use the 'find' command to list all subfolders within the specified folder - folder_path=$GITHUB_WORKSPACE - # The '-type d' flag ensures that only directories are selected - subfolders=$(find "$folder_path" -type d) - - # Loop through the subfolders and print their names - for subfolder in $subfolders; do - echo "$subfolder" - done - name: Set release title to version run: | @@ -108,7 +139,7 @@ jobs: uses: actions/upload-release-asset@v1 with: upload_url: ${{ env.UPLOAD_URL }} - asset_path: /home/runner/work/geoweaver-deployment-test/geoweaver-deployment-test/target/geoweaver.jar + asset_path: /home/runner/work/Geoweaver/Geoweaver/target/geoweaver.jar asset_name: geoweaver.jar asset_content_type: application/java-archive env: @@ -118,8 +149,18 @@ jobs: uses: actions/upload-release-asset@v1 with: upload_url: ${{ env.UPLOAD_URL }} - asset_path: /home/runner/work/geoweaver-deployment-test/geoweaver-deployment-test/linux-deployment/geoweaver.deb + asset_path: /home/runner/work/Geoweaver/Geoweaver/linux-deployment/geoweaver.deb asset_name: geoweaver.deb asset_content_type: application/vnd.debian.binary-package env: GITHUB_TOKEN: ${{ secrets.PAT }} + + - name: Upload .dmg file to Release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ env.UPLOAD_URL }} + asset_path: Geoweaver.dmg + asset_name: Geoweaver.dmg + asset_content_type: application/x-diskcopy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}