From e22288df1d8186d11dc58c3724691e1a50317327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 30 Nov 2024 18:24:25 +0100 Subject: [PATCH] ci: Change `Makevars` only after installation of R --- .github/workflows/R-CMD-check.yaml | 7 ++++--- .github/workflows/custom/after-install/action.yml | 10 ++++++++++ .github/workflows/custom/before-install/action.yml | 3 +-- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/custom/after-install/action.yml diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 41ae8a5b56..7233be430e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -108,14 +108,15 @@ jobs: # Beware of using dev pkgdown here, has brought in dev dependencies in the past extra-packages: any::rcmdcheck r-lib/roxygen2 any::decor r-lib/styler r-lib/pkgdown deps::. + - uses: ./.github/workflows/custom/after-install + if: hashFiles('.github/workflows/custom/after-install/action.yml') != '' + + # Must come after the custom after-install workflow - name: Install package run: | _R_SHLIB_STRIP_=true R CMD INSTALL . shell: bash - - uses: ./.github/workflows/custom/after-install - if: hashFiles('.github/workflows/custom/after-install/action.yml') != '' - - id: versions-matrix # Only run for pull requests if the base repo is different from the head repo, not for workflow_dispatch if not requested, always run for other events if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository) && (github.event_name != 'workflow_dispatch' || inputs.versions-matrix) diff --git a/.github/workflows/custom/after-install/action.yml b/.github/workflows/custom/after-install/action.yml new file mode 100644 index 0000000000..9d910822d7 --- /dev/null +++ b/.github/workflows/custom/after-install/action.yml @@ -0,0 +1,10 @@ +name: 'Custom steps to run after R packages are installed' + +runs: + using: "composite" + steps: + - name: Use GLPK on macOS + if: runner.os == 'macOS' + run: | + echo -e 'CPPFLAGS = -I/opt/homebrew/include\nLDFLAGS = -L/opt/homebrew/lib' | tee ~/.R/Makevars + shell: bash diff --git a/.github/workflows/custom/before-install/action.yml b/.github/workflows/custom/before-install/action.yml index 76158cf5df..3778a28ca8 100644 --- a/.github/workflows/custom/before-install/action.yml +++ b/.github/workflows/custom/before-install/action.yml @@ -8,9 +8,8 @@ runs: echo '_R_CHECK_PKG_SIZES_=FALSE' | tee -a $GITHUB_ENV shell: bash - - name: Install and use GLPK on macOS + - name: Install GLPK on macOS if: runner.os == 'macOS' run: | brew install glpk - echo -e 'CPPFLAGS = -I/opt/homebrew/include\nLDFLAGS = -L/opt/homebrew/lib' | tee ~/.R/Makevars shell: bash