Unverified Commit 88a7344c authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[ci] automate building CRAN package (#3497)



* [ci] automate building CRAN package

* add workflow for building CRAN package

* remove newlines

* add to R README

* Apply suggestions from code review
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>

* add timeout
Co-authored-by: default avatarNikita Titov <nekit94-08@mail.ru>
parent 0ab9f97a
name: R artifact builds
on:
pull_request_review_comment:
types: [created]
jobs:
cran-package:
name: cran-package
if: github.event.comment.body == '/gha build r-artifacts' && contains('OWNER,MEMBER,COLLABORATOR', github.event.comment.author_association)
timeout-minutes: 60
runs-on: ubuntu-latest
container: rocker/r-base
steps:
- name: Checkout repository
uses: actions/checkout@v1
with:
fetch-depth: 5
submodules: true
- name: Build package
shell: bash
id: build_package
run: |
sh build-cran-package.sh || exit -1
LGB_VERSION=$(cat VERSION.txt | sed "s/rc/-/g")
ARTIFACT_NAME=lightgbm-${LGB_VERSION}-r-cran.tar.gz
mv lightgbm_${LGB_VERSION}.tar.gz ${ARTIFACT_NAME}
echo "::set-output name=artifact_name::${ARTIFACT_NAME}"
echo "::set-output name=artifact_path::$(pwd)/${ARTIFACT_NAME}"
- name: Upload package
uses: actions/upload-artifact@v2
with:
name: ${{ steps.build_package.outputs.artifact_name }}
path: ${{ steps.build_package.outputs.artifact_path }}
...@@ -256,6 +256,12 @@ sh build-cran-package.sh ...@@ -256,6 +256,12 @@ sh build-cran-package.sh
This will create a file `lightgbm_${VERSION}.tar.gz`, where `VERSION` is the version of `LightGBM`. This will create a file `lightgbm_${VERSION}.tar.gz`, where `VERSION` is the version of `LightGBM`.
Alternatively, GitHub Actions can generate this file for you. On a pull request, go to the "Files changed" tab and create a comment with this phrase:
> /gha build r-artifacts
Go to https://github.com/microsoft/LightGBM/actions, and find the most recent run of the "R artifact builds" workflow. If it ran successfully, you'll find a download link for the package (in `.zip` format) in that run's "Artifacts" section.
### Standard Installation from CRAN Package ### Standard Installation from CRAN Package
After building the package, install it with a command like the following: After building the package, install it with a command like the following:
...@@ -461,7 +467,7 @@ RDvalgrind \ ...@@ -461,7 +467,7 @@ RDvalgrind \
| cat | cat
``` ```
These tests can also be triggered on any pull request by leaving a "Comment" review with the following comment: These tests can also be triggered on any pull request by leaving a review on the "Files changed" tab in a pull request:
> /gha run r-valgrind > /gha run r-valgrind
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment