Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] automate building CRAN package #3497

Merged
merged 7 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/r_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: R artifact builds

on:
pull_request_review_comment:
types: [created]

jobs:
cran-package:
name: cran-package
StrikerRUS marked this conversation as resolved.
Show resolved Hide resolved
if: github.event.comment.body == '/gha build r-artifacts' && contains('OWNER,MEMBER,COLLABORATOR', github.event.comment.author_association)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/gha build r-artifacts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok this created this job: https://github.com/microsoft/LightGBM/actions/runs/332889387

which failed like this:

No files were found with the provided path: /__w/LightGBM/LightGBM/lightgbm-3.0.0.99-r-cran.tar.gz\n. No artifacts will be uploaded.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/gha build-r-artifacts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/gha build r-artifacts

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this kicked off https://github.com/microsoft/LightGBM/actions/runs/332893223

which produced one artifact

image

this creates a zip of the file, which is a little annoying, and it looks like you can't get around that (https://github.com/actions/upload-artifact#zipped-artifact-downloads):

when a workflow run finishes and an artifact is downloaded from either the UI or through the download api, a zip is dynamically created with all the file contents that were uploaded. There is currently no way to download artifacts after a workflow run finishes in a format other than a zip or to download artifact contents individually

But I don't think it's too bad. So for releases, the workflow would be:

  1. comment with /gha build r-artifacts
  2. go to https://github.com/microsoft/LightGBM/actions, then to the artifacts action
  3. once it's done running, download the .zip
  4. unzip it, to get the artifact
  5. manually upload artifacts to the release

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I think this is ready for review!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good idea. Added in bd895bf

timeout-minutes: 120
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
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
jameslamb marked this conversation as resolved.
Show resolved Hide resolved
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 }}
8 changes: 7 additions & 1 deletion R-package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.

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

After building the package, install it with a command like the following:
Expand Down Expand Up @@ -461,7 +467,7 @@ RDvalgrind \
| 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

Expand Down