From edfe5db411b2bf903c729c2d436c2c4972560424 Mon Sep 17 00:00:00 2001 From: MOshima-PIFSC Date: Fri, 2 Feb 2024 13:24:48 -1000 Subject: [PATCH] remove download ss from R-CMD-check.yml and download in testthat.R --- .github/workflows/R-CMD-check.yaml | 38 ------------------------------ tests/testthat.R | 4 ++-- tests/testthat/SSmase_test.R | 31 ------------------------ tests/testthat/test-HCxval.R | 3 --- 4 files changed, 2 insertions(+), 74 deletions(-) delete mode 100644 tests/testthat/SSmase_test.R diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 7b9e768..55a2379 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -28,35 +28,6 @@ jobs: steps: - uses: actions/checkout@v3 - - - name: Get the latest SS3 executable for linux and move to expected location - if: matrix.config.os == 'ubuntu-latest' - run: | - curl https://api.github.com/repos/nmfs-stock-synthesis/stock-synthesis/releases/latest | grep "browser_download_url" | grep -Eo 'https://[^\"]*' | grep "ss_linux" | xargs wget - mv ss_linux ss - sudo chmod a+x ss - cp ss inst/extdata/ss - rm ss - - - name: Get the latest SS3 executable for windows and move to expected location - if: matrix.config.os == 'windows-latest' - run: | - Invoke-WebRequest -Uri https://github.com/nmfs-stock-synthesis/stock-synthesis/releases/download/v3.30.21/ss_win.exe -Outfile "D:\a\ss3diags\ss3diags\ss_win.exe" - mv ss_win.exe ss.exe - cp ss.exe inst/extdata/ss.exe - - - uses: nick-fields/retry@v2 - if: matrix.config.os == 'macOS-latest' - with: - timeout_minutes: 3 - max_attempts: 3 - retry_on: error - command: | - curl https://api.github.com/repos/nmfs-stock-synthesis/stock-synthesis/releases/latest | grep "browser_download_url" | grep -Eo 'https://[^\"]*' | grep "ss_osx" | xargs wget - mv ss_osx ss - sudo chmod a+x ss - cp ss inst/extdata/ss - rm ss - uses: r-lib/actions/setup-pandoc@v2 @@ -76,15 +47,6 @@ jobs: with: error-on: '"error"' - - name: remove ss executable - run: | - if ["$RUNNER_OS" == "Linux" ]; then - rm inst/extdata/ss.exe - else - rm inst/extdata/ss - fi - shell: bash - diff --git a/tests/testthat.R b/tests/testthat.R index 54013a7..905f637 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -7,9 +7,9 @@ files_path <- system.file("extdata", package = "ss3diags") run_tmp <- file.path(tempdir(check = TRUE), "test-runs") dir.create(run_tmp, showWarnings = FALSE) file.copy(from = list.files(files_path, full.names = TRUE), to = run_tmp) - +r4ss::get_ss3_exe(dir = run_tmp, version = "v3.30.21") ## Run retrospectives -if (file.exists(file.path(files_path, "ss")) | file.exists(file.path(files_path, "ss.exe"))) { +if (file.exists(file.path(run_tmp, "ss3")) | file.exists(file.path(run_tmp, "ss3.exe"))) { r4ss::retro(dir = run_tmp, oldsubdir = "", newsubdir = "retrospectives", years = 0:-3, show_in_console = FALSE) # Creating retrospective object here so that multiple test files can access it without having to re-run retrospective for each test retroModels <- r4ss::SSgetoutput( diff --git a/tests/testthat/SSmase_test.R b/tests/testthat/SSmase_test.R deleted file mode 100644 index 893b116..0000000 --- a/tests/testthat/SSmase_test.R +++ /dev/null @@ -1,31 +0,0 @@ -## File is deprecated by MOshima 6/12/23 - -# library(ss3diags) -# Tests -# sma = r4ss::SSsummarize(retro.sma) -# Check joint MASE for indices -# SSmase(retro.sma) -# select indices -# SSmase(retro.sma, indexselect = c(4)) -# check for length comps -# smaL = ss3diags::SSretroComps(retro.sma) -# SSmase(retro.sma, quants = "len", indexselect = 2:4) - -# check manually -# mase <- SSmase(retro.sma, residuals = T) -# Joint mase from index 1, 3,4 -# mae <- apply( -# mase$Residuals[c("Pred.Res", "Naive.Res")], 2, -# function(x) mean(abs(x)) -# ) -# MASE -# mae[1] / mae[2] -# compare -# SSmase(retro.sma) - -# Check hake -# phk= r4ss::SSsummarize(retro.phk) -# SSmase(retro.phk, verbose = T, indexselect = 1) -# check for age comps -# phkA <- ss3diags::SSretroComps(retro.phk) -# SSmase(retro.phk, quants = "age") diff --git a/tests/testthat/test-HCxval.R b/tests/testthat/test-HCxval.R index d86dc18..c983af2 100644 --- a/tests/testthat/test-HCxval.R +++ b/tests/testthat/test-HCxval.R @@ -1,8 +1,5 @@ ## Test script for hindcast cross validation and MASE -# retroSimple <- ss3diags::retroSimple -# retrosum.simple <- r4ss::SSsummarize(retroSimple) - path <- file.path(tempdir(), "test_runs") dir.create(path, showWarnings = FALSE)