Skip to content

Commit

Permalink
Merge pull request #98 from ESIPFed/master
Browse files Browse the repository at this point in the history
sync
  • Loading branch information
ZihengSun authored Jan 13, 2024
2 parents 54d863d + 52bc2eb commit 9474a82
Show file tree
Hide file tree
Showing 23 changed files with 1,128 additions and 392 deletions.
37 changes: 0 additions & 37 deletions .circleci/config.yml

This file was deleted.

156 changes: 138 additions & 18 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,34 @@ on:
workflow_dispatch:

jobs:
build:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
architecture: x64

- name: Run Tests
run: |
mvn test jacoco:report
working-directory: ${{ github.workspace }}

- name: Check Test Results
run: |
if [ $? -eq 0 ]; then
echo "Tests passed successfully."
else
echo "Tests failed."
exit 1 # Exit with an error code to stop the workflow
fi
build-jar:
runs-on: ubuntu-latest
needs: tests

steps:
- name: Checkout code
Expand All @@ -36,22 +62,19 @@ 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

- name: Build deb package
run: |
cd $GITHUB_WORKSPACE/linux-deployment
cat DEBIAN/control
dpkg-deb --build . geoweaver.deb
- name: Upload Geoweaver Artifacts
Expand All @@ -62,9 +85,84 @@ jobs:
target/*.jar
pom.xml
linux-deployment/*.deb
build-windows:
needs: build-jar
runs-on: windows-latest

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

- name: Download Geoweaver Artifacts
uses: actions/download-artifact@v2
with:
name: geoweaver-artifacts
path: artifact

- name: Prepare Deployment Directory
run: |
cp artifact/target/geoweaver.jar windows-deployment/geoweaver.jar
- name: Install NSIS
run: choco install nsis

- name: Install PyInstaller
run: pip install pyinstaller

- name: Build Executable with PyInstaller
run: pyinstaller windows-deployment/pyinstaller.spec

- name: Build NSIS Installer
run: '& "C:\Program Files (x86)\NSIS\makensis.exe" windows-deployment/installer.nsi'

- name: Upload Windows Installer to Release
uses: actions/upload-artifact@v2
with:
name: geoweaver-windows-installer
path: D:\a\Geoweaver\Geoweaver\windows-deployment\GeoweaverInstaller.exe

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, build-windows]
runs-on: ubuntu-latest

steps:
Expand All @@ -79,22 +177,24 @@ jobs:
with:
name: geoweaver-artifacts

- name: Download .dmg file
uses: actions/download-artifact@v2
with:
name: geoweaver-dmg

- name: Download Windows Installer Artifact
uses: actions/download-artifact@v2
with:
name: geoweaver-windows-installer


- 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")
UPLOAD_URL=$(echo "$RESPONSE" | jq -r .upload_url)
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: |
Expand All @@ -108,7 +208,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:
Expand All @@ -118,8 +218,28 @@ 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 }}

- name: Upload Windows Installer to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: GeoweaverInstaller.exe
asset_name: GeoweaverInstaller.exe
asset_content_type: application/vnd.microsoft.portable-executable
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
66 changes: 66 additions & 0 deletions macos-deployment/make-app.sh
Original file line number Diff line number Diff line change
@@ -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}" <<EOF
#!/bin/bash
DIR=\$(dirname "\$0")
nohup java -jar "\$DIR/../Java/geoweaver.jar" > /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}" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>${APP_NAME}</string>
<key>CFBundleIconFile</key>
<string>AppIcon</string>
<key>CFBundleIdentifier</key>
<string>com.gokulprathin.geoweaver</string>
<key>CFBundleName</key>
<string>${APP_NAME}</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
</dict>
</plist>
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."
14 changes: 14 additions & 0 deletions src/main/java/com/gw/database/CheckpointRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.gw.database;

import com.gw.jpa.Checkpoint;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.UUID;

public interface CheckpointRepository extends JpaRepository<Checkpoint, UUID> {
List<Checkpoint> findByWorkflowId(String workflowId);

List<Checkpoint> findCheckpointByExecutionId(String executionId);
}
3 changes: 3 additions & 0 deletions src/main/java/com/gw/database/HistoryRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public interface HistoryRepository extends JpaRepository<History, String> {
* @param history_id The ID of the history record.
* @return A list containing a history record and additional information about the associated process.
*/
@Query(value = "select * from history where history.history_id = ?1 and history.history_process=?2", nativeQuery = true)
List<History> findHistoryWithExecutionId(String history_id, String workflowId);

@Query(value = "select * from history, gwprocess where history.history_id = ?1 and history.history_process=gwprocess.id", nativeQuery = true)
List<Object[]> findOneHistoryofProcess(String history_id);
}
23 changes: 23 additions & 0 deletions src/main/java/com/gw/dto/checkpoint/CheckpointCreateRequest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.gw.dto.checkpoint;

public class CheckpointCreateRequest {
private String workflowId;

private String executionId;

public String getExecutionId() {
return executionId;
}

public void setExecutionId(String executionId) {
this.executionId = executionId;
}

public String getWorkflowId() {
return workflowId;
}

public void setWorkflowId(String workflowId) {
this.workflowId = workflowId;
}
}
Loading

0 comments on commit 9474a82

Please sign in to comment.