Skip to content

Commit

Permalink
get java dependencies in github actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoohafkan committed Dec 18, 2023
1 parent c799bbe commit aa9422f
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 11 deletions.
66 changes: 62 additions & 4 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
# - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
# - {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -44,9 +44,67 @@ jobs:
extra-packages: any::rcmdcheck
needs: check

- name: Import data
run: Rscript -e 'library(rJava);.jinit()'
- uses: stCarolas/setup-maven@v4.5

- uses: s4u/maven-settings-action@v2.8.0

- name: download dependencies
run: |
echo ::group::Download flogger
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='com.google.flogger:flogger-system-backend:0.7.4:jar'
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='com.google.flogger:flogger:0.7.4:jar'
echo ::endgroup::
echo ::group::Download HEC Monolith
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:hec-monolith-compat:3.3.16:jar' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:hec-monolith:3.3.16:jar' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
echo ::endgroup::
echo ::group::Download HEC Nucleus
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:hec-nucleus-data:2.0.1:jar' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:hec-nucleus-metadata:2.0.1:jar' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
echo ::endgroup::
echo ::group::Download hecnf
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:hecnf:6.0.00.100:jar' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
echo ::endgroup::
echo ::group::Download javaHeclib
if [ "$RUNNER_OS" == "Linux" ]; then
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:javaHeclib:7-IQ-11-linux-x86_64:zip' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
elif [ "$RUNNER_OS" == "Windows" ]; then
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:javaHeclib:7-IQ-11-win-x86_64:zip' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
elif [ "$RUNNER_OS" == "macOS" ]; then
mvn -Dmaven.repo.local='${{ runner.temp }}/temp_repo' dependency:get -Dartifact='mil.army.usace.hec:javaHeclib:7-IQ-11-macOS-x86_64:zip' -DremoteRepositories='https://www.hec.usace.army.mil/nexus/repository/maven-releases'
else
echo "$RUNNER_OS not supported"
exit 1
fi
echo ::endgroup::
echo ::group::Copy dependencies to directory
mkdir -p '${{ runner.temp }}/.dssrip2/jar' '${{ runner.temp }}/.dssrip2/lib'
cp \
'${{ runner.temp }}/temp_repo/mil/army/usace/hec/hec-nucleus-data/2.0.1/hec-nucleus-data-2.0.1.jar' \
'${{ runner.temp }}/temp_repo/mil/army/usace/hec/hec-nucleus-metadata/2.0.1/hec-nucleus-metadata-2.0.1.jar' \
'${{ runner.temp }}/temp_repo/mil/army/usace/hec/hec-monolith-compat/3.3.16/hec-monolith-compat-3.3.16.jar' \
'${{ runner.temp }}/temp_repo/mil/army/usace/hec/hec-monolith/3.3.16/hec-monolith-3.3.16.jar' \
'${{ runner.temp }}/temp_repo/com/google/flogger/flogger-system-backend/0.7.4/flogger-system-backend-0.7.4.jar' \
'${{ runner.temp }}/temp_repo/com/google/flogger/flogger/0.7.4/flogger-0.7.4.jar' \
'${{ runner.temp }}/temp_repo/mil/army/usace/hec/hecnf/6.0.00.100/hecnf-6.0.00.100.jar' \
'${{ runner.temp }}/.dssrip2/jar'
if [ "$RUNNER_OS" == "Linux" ]; then
7z e '${{ runner.temp }}/temp_repo/mil/army/usace/hec/javaHeclib/7-IQ-11-linux-x86_64/javaHeclib-7-IQ-11-linux-x86_64.zip' \
-o'${{ runner.temp }}/.dssrip2/lib'
elif [ "$RUNNER_OS" == "Windows" ]; then
7z e '${{ runner.temp }}/temp_repo/mil/army/usace/hec/javaHeclib/7-IQ-11-win-x86_64/javaHeclib-7-IQ-11-win-x86_64.zip' \
-o'${{ runner.temp }}/.dssrip2/lib'
elif [ "$RUNNER_OS" == "macOS" ]; then
7z e '${{ runner.temp }}/temp_repo/mil/army/usace/hec/javaHeclib/7-IQ-11-macOS-x86_64/javaHeclib-7-IQ-11-macOS-x86_64.zip' \
-o'${{ runner.temp }}/.dssrip2/lib'
else
echo "$RUNNER_OS not supported"
exit 1
fi
echo "DSS_HOME_CI=${{ runner.temp }}/.dssrip2" >> $GITHUB_ENV
echo ::endgroup::
shell: bash

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
7 changes: 0 additions & 7 deletions tests/testthat/helper.R

This file was deleted.

17 changes: 17 additions & 0 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
skip_if_no_dss = function() {
skip_on_cran()

if (isTRUE(as.logical(Sys.getenv("CI", "false")))) {
# look for .dssrip2 folder in temp directory
dss_home_ci = Sys.getenv("DSS_HOME_CI")
if (nzchar(dss_home_ci)) {
dss_connect(dss_home_ci, monolith = TRUE)
return(invisible(TRUE))
}
} else {
if (dss_require()) {
return(invisible(TRUE))
}
}
skip("Could not connect to DSS")
}

0 comments on commit aa9422f

Please sign in to comment.