Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ESIPFed/Geoweaver into do…
Browse files Browse the repository at this point in the history
…cker-image
  • Loading branch information
saivivek116 committed May 6, 2024
2 parents 241af9c + 090d2f0 commit 3e48c6e
Show file tree
Hide file tree
Showing 24 changed files with 253 additions and 177 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/commit_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,107 @@ jobs:
with:
name: geoweaver-jacoco-coverage-report
path: target/site/jacoco
test-mysql:
runs-on: ubuntu-latest

services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: geoweaver
MYSQL_DATABASE: geoweaver
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5

steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
architecture: x64

- name: Create geoweaver directory and application.properties
run: |
mkdir -p ~/geoweaver
echo "spring.datasource.url=jdbc:mysql://localhost:3306/geoweaver" >> ~/geoweaver/application.properties
echo "spring.datasource.username=root" >> ~/geoweaver/application.properties
echo "spring.datasource.password=geoweaver" >> ~/geoweaver/application.properties
echo "spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver" >> ~/geoweaver/application.properties
echo "spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect" >> ~/geoweaver/application.properties
- name: Run Tests
run: |
mvn test jacoco:report
working-directory: ${{ github.workspace }}

- name: Check If All Tests Pass
run: |
if [ $? -eq 0 ]; then
echo "All tests passed successfully."
else
echo "Tests failed."
exit 1 # Exit with an error code to stop the workflow
fi
- name: Save Geoweaver JaCoCo HTML Report
uses: actions/upload-artifact@v2
with:
name: geoweaver-jacoco-coverage-report
path: target/site/jacoco

test-postgresql:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_PASSWORD: geoweaver
POSTGRES_DB: geoweaver
ports:
- 5432:5432
options: --health-cmd="pg_isready -U postgres" --health-interval=10s --health-timeout=5s --health-retries=5

steps:
- uses: actions/checkout@v4

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
architecture: x64

- name: Create geoweaver directory and application.properties
run: |
mkdir -p ~/geoweaver
echo "spring.datasource.url=jdbc:postgresql://localhost:5432/geoweaver" >> ~/geoweaver/application.properties
echo "spring.datasource.username=postgres" >> ~/geoweaver/application.properties
echo "spring.datasource.password=geoweaver" >> ~/geoweaver/application.properties
echo "spring.datasource.driver-class-name=org.postgresql.Driver" >> ~/geoweaver/application.properties
echo "spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect" >> ~/geoweaver/application.properties
- name: Run Tests
run: |
mvn test jacoco:report
working-directory: ${{ github.workspace }}

- name: Check If All Tests Pass
run: |
if [ $? -eq 0 ]; then
echo "All tests passed successfully."
else
echo "Tests failed."
exit 1 # Exit with an error code to stop the workflow
fi
- name: Save Geoweaver JaCoCo HTML Report
uses: actions/upload-artifact@v2
with:
name: geoweaver-jacoco-coverage-report
path: target/site/jacoco

15 changes: 14 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</parent>
<groupId>com.gw</groupId>
<artifactId>geoweaver</artifactId>
<version>1.4.8</version>
<version>1.4.9</version>
<name>geoweaver</name>
<description>A lightweight workflow management software for organizing data analysis workflows,
preserving history of every workflow run, and improving scientist producitvity and workflow FAIRness,
Expand Down Expand Up @@ -79,6 +79,19 @@
</dependency>


<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.8</version>
</dependency>

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.3.0</version>
</dependency>


<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/gw/database/CheckpointRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import java.util.UUID;
import org.springframework.data.jpa.repository.JpaRepository;

import javax.transaction.Transactional;

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

Expand Down
17 changes: 8 additions & 9 deletions src/main/java/com/gw/database/EnvironmentRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import javax.transaction.Transactional;

/**
* The EnvironmentRepository interface provides methods for querying environment configurations from
* a database. It extends the CrudRepository interface to handle database operations for the
* Environment entity.
*/
@Transactional
public interface EnvironmentRepository extends CrudRepository<Environment, String> {

/**
Expand All @@ -22,13 +25,8 @@ public interface EnvironmentRepository extends CrudRepository<Environment, Strin
* @param basedir The base directory.
* @return A collection of environment configurations matching the specified criteria.
*/
@Query(
value =
"select * from environment where hostid = ?1 and bin = ?2 and pyenv = ?3 and basedir ="
+ " ?4",
nativeQuery = true)
Collection<Environment> findEnvByID_BIN_ENV_BaseDir(
String hostid, String bin, String pyenv, String basedir);
@Query("SELECT e FROM Environment e WHERE e.hostobj.id = :hostid AND e.bin = :bin AND e.pyenv = :pyenv AND e.basedir = :basedir")
Collection<Environment> findEnvByID_BIN_ENV_BaseDir(String hostid, String bin, String pyenv, String basedir);

/**
* Find environment configurations based on the provided host ID and binary path.
Expand All @@ -37,7 +35,7 @@ Collection<Environment> findEnvByID_BIN_ENV_BaseDir(
* @param bin The binary path.
* @return A collection of environment configurations matching the specified host and binary path.
*/
@Query(value = "select * from environment where hostid = ?1 and bin = ?2", nativeQuery = true)
@Query("SELECT e FROM Environment e WHERE e.hostobj.id = :hostid AND e.bin = :bin")
Collection<Environment> findEnvByID_BIN(String hostid, String bin);

/**
Expand All @@ -46,6 +44,7 @@ Collection<Environment> findEnvByID_BIN_ENV_BaseDir(
* @param hostid The ID of the host.
* @return A collection of environment configurations associated with the specified host.
*/
@Query(value = "select * from environment where hostid = ?1", nativeQuery = true)
@Query("SELECT e FROM Environment e WHERE e.hostobj.id = :hostid")
Collection<Environment> findEnvByHost(String hostid);

}
Loading

0 comments on commit 3e48c6e

Please sign in to comment.