Skip to content

setup-r-dependencies: set JAVA_HOME on Windows runners from Java 21 env vars - #1100

Open
jeroen with Copilot wants to merge 3 commits into
v2-branchfrom
copilot/set-java-home-windows
Open

setup-r-dependencies: set JAVA_HOME on Windows runners from Java 21 env vars#1100
jeroen with Copilot wants to merge 3 commits into
v2-branchfrom
copilot/set-java-home-windows

Conversation

Copilot AI commented Jul 23, 2026

Copy link
Copy Markdown

rJava builds on Windows can fail because JAVA_HOME is not set by default on GitHub-hosted runners. This updates setup-r-dependencies to export JAVA_HOME automatically from the runner’s Java 21 variables when it is missing.

  • Action behavior change (Windows only)

    • Added a dedicated Set JAVA_HOME (Windows) step in setup-r-dependencies/action.yaml.
    • When JAVA_HOME is unset, the step maps by runner arch:
      • X64JAVA_HOME_21_X64
      • ARM64JAVA_HOME_21_AARCH64
    • Leaves pre-set JAVA_HOME untouched.
    • Emits a warning for unexpected Windows architectures.
  • Docs update

    • Documented the new automatic Java configuration behavior in setup-r-dependencies/README.md.
- name: Set JAVA_HOME (Windows)
  if: ${{ runner.os == 'Windows' }}
  shell: bash
  run: |
    if [ -z "${JAVA_HOME:-}" ]; then
      arch="${RUNNER_ARCH^^}"
      case "${arch}" in
        X64) echo "JAVA_HOME=${JAVA_HOME_21_X64}" >> $GITHUB_ENV ;;
        ARM64) echo "JAVA_HOME=${JAVA_HOME_21_AARCH64}" >> $GITHUB_ENV ;;
      esac
    fi

Copilot AI linked an issue Jul 23, 2026 that may be closed by this pull request
@jeroen
jeroen marked this pull request as ready for review July 23, 2026 11:35
Copilot AI changed the title [WIP] Set JAVA_HOME environment variable for rJava package on Windows setup-r-dependencies: set JAVA_HOME on Windows runners from Java 21 env vars Jul 23, 2026
Copilot AI requested a review from jeroen July 23, 2026 11:35
@gaborcsardi

Copy link
Copy Markdown
Member

Thanks! Why doesn't this belong in setup-r?

@jeroen

jeroen commented Aug 1, 2026

Copy link
Copy Markdown
Member

Thanks! Why doesn't this belong in setup-r?

Either will work, I figured rJava is part of the dependencies instead of base?

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.33%. Comparing base (b7484da) to head (d273325).
⚠️ Report is 1 commits behind head on v2-branch.

Additional details and impacted files
@@            Coverage Diff             @@
##           v2-branch    #1100   +/-   ##
==========================================
  Coverage      83.33%   83.33%           
==========================================
  Files              3        3           
  Lines             12       12           
==========================================
  Hits              10       10           
  Misses             2        2           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Set JAVA_HOME on Windows

3 participants