Skip to content

Commit

Permalink
[R-package] [ci] restore R 3.6 Windows cran CI job (fixes #5036) (#5479)
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb authored Sep 12, 2022
1 parent 952458a commit 8b105ce
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ jobs:
###############
# CRAN builds #
###############
- os: windows-latest
task: r-package
compiler: MINGW
toolchain: MINGW
r_version: 3.6
build_type: cran
- os: windows-latest
task: r-package
compiler: MINGW
Expand Down
44 changes: 26 additions & 18 deletions build-cran-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -199,25 +199,33 @@ if ${BUILD_VIGNETTES} ; then

echo "untarring ${TARBALL_NAME}"
cd _tmp
tar -xvf "${TARBALL_NAME}" > /dev/null 2>&1
rm -rf "${TARBALL_NAME}"
tar -xf "${TARBALL_NAME}" > /dev/null 2>&1
rm -f "${TARBALL_NAME}"
echo "done untarring ${TARBALL_NAME}"

# Object files are left behind from compiling the library to generate vignettes.
# Approaches like using tar --exclude=*.so to exclude them are not portable
# (for example, don't work with some versions of tar on Windows).
#
# Removing them manually here removes the need to use tar --exclude.
#
# For background, see https://github.com/microsoft/LightGBM/pull/3946#pullrequestreview-799415812.
rm -f ./lightgbm/src/*.o
rm -f ./lightgbm/src/boosting/*.o
rm -f ./lightgbm/src/io/*.o
rm -f ./lightgbm/src/metric/*.o
rm -f ./lightgbm/src/network/*.o
rm -f ./lightgbm/src/objective/*.o
rm -f ./lightgbm/src/treelearner/*.o

echo "re-tarring ${TARBALL_NAME}"
tar \
-cz \
-f "${TARBALL_NAME}" \
lightgbm \
> /dev/null 2>&1
mv "${TARBALL_NAME}" ../
cd ..
echo "done untarring ${TARBALL_NAME}"

echo "re-tarring ${TARBALL_NAME}"
tar \
-czv \
-C ./_tmp \
--exclude=*.a \
--exclude=*.dll \
--exclude=*.o \
--exclude=*.so \
--exclude=*.tar.gz \
--exclude=**/conftest.c \
--exclude=**/conftest.exe \
-f "${TARBALL_NAME}" \
lightgbm \
> /dev/null 2>&1
echo "Done creating ${TARBALL_NAME}"

rm -rf ./_tmp
Expand Down

0 comments on commit 8b105ce

Please sign in to comment.