-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci][R-package] run R CRAN checks on Solaris by optional workflow (#3913
) * run R CRAN checks on Solaris by optional workflow * Update triggering_comments.yml * Update r_solaris.yml * Update optional_checks.yml * Update triggering_comments.yml * Update run_rhub_solaris_checks.R * Update r_solaris.yml * Update run_rhub_solaris_checks.R * Update r_solaris.yml * simplify code * fix lint and address review comments
- Loading branch information
1 parent
fc6b71e
commit ffebc43
Showing
5 changed files
with
172 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
args <- commandArgs( | ||
trailingOnly = TRUE | ||
) | ||
package_tarball <- args[[1L]] | ||
log_file <- args[[2L]] | ||
dir.create(dirname(log_file), recursive = TRUE, showWarnings = FALSE) | ||
|
||
email <- c( | ||
150L, 147L, 145L, 146L, 158L, 145L, 140L, 151L, 137L, 158L, 143L, 157L, 158L, 137L, 143L, 151L, | ||
139L, 147L, 150L, 106L, 163L, 153L, 154L, 151L, 139L, 147L, 150L, 88L, 141L, 153L, 151L | ||
) | ||
rhub::validate_email( | ||
email = intToUtf8(email - 42L) | ||
, token = "6bc89147c8fc4824bce09f8454e4ab8e" | ||
) | ||
|
||
if (Sys.info()["sysname"] == "Windows") { | ||
null_file <- "NUL" | ||
} else { | ||
null_file <- "/dev/null" | ||
} | ||
sink(file = null_file) | ||
checks_succeeded <- TRUE | ||
platforms <- c( | ||
"solaris-x86-patched" | ||
, "solaris-x86-patched-ods" | ||
) | ||
for (platform in platforms) { | ||
res_object <- rhub::check( | ||
path = package_tarball | ||
, email = intToUtf8(email - 42L) | ||
, check_args = "--as-cran" | ||
, platform = platform | ||
, env_vars = c( | ||
"R_COMPILE_AND_INSTALL_PACKAGES" = "always" | ||
, "_R_CHECK_SYSTEM_CLOCK_" = 0L | ||
, "_R_CHECK_CRAN_INCOMING_REMOTE_" = 0L | ||
, "_R_CHECK_PKG_SIZES_THRESHOLD_" = 60L | ||
, "_R_CHECK_TOPLEVEL_FILES_" = 0L | ||
) | ||
, show_status = TRUE | ||
) | ||
statuses <- res_object[[".__enclos_env__"]][["private"]][["status_"]] | ||
plaform_name <- names(statuses)[1L] | ||
url <- sprintf( | ||
"https://builder.r-hub.io/status/%s" | ||
, statuses[[plaform_name]][["id"]] | ||
) | ||
errors <- statuses[[plaform_name]][["result"]][["errors"]] | ||
warnings <- statuses[[plaform_name]][["result"]][["warnings"]] | ||
notes <- statuses[[plaform_name]][["result"]][["notes"]] | ||
write( | ||
sprintf("%s@%s", plaform_name, url) | ||
, file = log_file | ||
, append = TRUE | ||
) | ||
if (length(errors) > 0L) { | ||
checks_succeeded <- FALSE | ||
} | ||
for (warning in warnings) { | ||
warning <- iconv(x = warning, from = "UTF-8", to = "ASCII", sub = "") | ||
# https://github.com/r-hub/rhub/issues/113 | ||
if (!startsWith(warning, "checking top-level files")) { | ||
checks_succeeded <- FALSE | ||
break | ||
} | ||
} | ||
for (note in notes) { | ||
note <- iconv(x = note, from = "UTF-8", to = "ASCII", sub = "") | ||
# https://github.com/r-hub/rhub/issues/415 | ||
if (!(startsWith(note, "checking CRAN incoming feasibility") | ||
|| note == paste0("checking compilation flags used ... NOTE\n" | ||
, "Compilation used the following non-portable flag(s):\n -march=pentiumpro"))) { | ||
checks_succeeded <- FALSE | ||
break | ||
} | ||
} | ||
if (!checks_succeeded) { | ||
break | ||
} | ||
} | ||
sink() | ||
|
||
quit(save = "no", status = as.integer(!checks_succeeded)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: Solaris CRAN check | ||
|
||
on: | ||
repository_dispatch: | ||
types: [gha_run_r_solaris] | ||
|
||
jobs: | ||
test: | ||
name: solaris-cran | ||
timeout-minutes: 120 | ||
runs-on: ubuntu-latest | ||
container: rocker/r-base | ||
env: | ||
SECRETS_WORKFLOW: ${{ secrets.WORKFLOW }} | ||
steps: | ||
- name: Install essential software before checkout | ||
shell: bash | ||
run: | | ||
apt-get update | ||
apt-get install --no-install-recommends -y \ | ||
curl \ | ||
git \ | ||
jq | ||
- name: Checkout repository | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 5 | ||
submodules: true | ||
repository: microsoft/LightGBM | ||
ref: "refs/pull/${{ github.event.client_payload.pr_number }}/merge" | ||
- name: Send init status | ||
if: ${{ always() }} | ||
run: | | ||
$GITHUB_WORKSPACE/.ci/append_comment.sh \ | ||
"${{ github.event.client_payload.comment_number }}" \ | ||
"Workflow **${{ github.workflow }}** has been triggered! 🚀\r\n${GITHUB_SERVER_URL}/microsoft/LightGBM/actions/runs/${GITHUB_RUN_ID}" | ||
- name: Run tests on Solaris | ||
shell: bash | ||
run: | | ||
sh build-cran-package.sh || exit -1 | ||
apt-get install --no-install-recommends -y \ | ||
libcurl4-openssl-dev \ | ||
libxml2-dev \ | ||
libssl-dev | ||
log_file="$GITHUB_WORKSPACE/rhub_logs.txt" | ||
Rscript -e "install.packages('rhub', dependencies = c('Depends', 'Imports', 'LinkingTo'), repos = 'https://cran.r-project.org')" | ||
Rscript $GITHUB_WORKSPACE/.ci/run_rhub_solaris_checks.R $(pwd)/lightgbm_*.tar.gz $log_file || exit -1 | ||
- name: Send final status | ||
if: ${{ always() }} | ||
run: | | ||
$GITHUB_WORKSPACE/.ci/set_commit_status.sh "${{ github.workflow }}" "${{ job.status }}" "${{ github.event.client_payload.pr_sha }}" | ||
body="" | ||
while IFS= read -r line; do | ||
platform=${line%@*} | ||
url=${line#*@} | ||
body="${body}${platform}: ${url}\r\n" | ||
done < "$GITHUB_WORKSPACE/rhub_logs.txt" || true | ||
body="${body}Reports also have been sent to LightGBM public e-mail: http://www.yopmail.com/lightgbm_test_email\r\n" | ||
body="${body}Status: ${{ job.status }}." | ||
$GITHUB_WORKSPACE/.ci/append_comment.sh \ | ||
"${{ github.event.client_payload.comment_number }}" \ | ||
"$body" | ||
- name: Rerun workflow-indicator | ||
if: ${{ always() }} | ||
run: | | ||
bash $GITHUB_WORKSPACE/.ci/rerun_workflow.sh \ | ||
"optional_checks.yml" \ | ||
"${{ github.event.client_payload.pr_number }}" \ | ||
"${{ github.event.client_payload.pr_branch }}" \ | ||
|| true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters