Skip to content

Update Github Actions for Windows #34

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

Merged
merged 36 commits into from
Dec 22, 2020

Conversation

Ilia-Kosenkov
Copy link
Member

Using insights from #9 we can now more or less reliably generate bindings for both 32- and 64-bit Windows.
With the path trick discussed in #29 i386/i686 tests can be run (though most of the tests are disabled).

I suggest to split Windows job into two separate ones and build bindings separately for each architecture.
I am not sure if I correctly copied the binding upload process, this should be checked.

@clauswilke
Copy link
Member

Thanks for your efforts on this one. I have two comments:

1. I'm not a big fan of breaking the windows builds into two separate runs because most of their time is spent setting up the R and Rust environments, so there's a lot of wasted compute. I know we get the GH Action hours for free but we should still be cognizant of resource use.

2. The action scripts need to be completely reworked along the lines of the extendr scripts so we can target specific R versions:
https://github.com/extendr/extendr/blob/master/.github/workflows/test.yml
We will eventually need at least release, devel, and oldrel for all architectures, I think. See e.g. here:
https://github.com/r-lib/actions/blob/master/examples/README.md#tidyverse-ci-workflow

It may make sense to put everything into one single matrix or to have two matrices, one for unix-like builds and one for windows builds. Not sure about that one, depends on how much special casing is needed.

If you'd like to take a stab at this, you're welcome to do so.

@clauswilke
Copy link
Member

To be clear: It's the following part of the extendr test script that would make a good starting point for libR-sys:
https://github.com/extendr/extendr/blob/d27585f43f900c49f7a805be6ce3cd83a196ab6d/.github/workflows/test.yml#L112-L149
We don't need to install and cache R packages.

@Ilia-Kosenkov
Copy link
Member Author

@clauswilke ,
I was thinking about merging everything into a single job, but decided to progress in small steps.

I can try to rewrite script following extendras an example. If I fail or someone else does this faster, we can safely discard this PR.

@Ilia-Kosenkov
Copy link
Member Author

So this is a template for a new GH Actions script, inspired by extendr.
There are two things to address: first, ubuntu::r-devel fails tests, which I presume also happens for other repos and is not our fault; second -- I am not sure how bindings and artifacts are now generated -- before we had one job for each os, now -- multiple. Perhaps there should be some condition on which to generate bindings -- for instance, only for rust-stable.

@clauswilke
Copy link
Member

To make tests work on r-devel you need to set LD_LIBRARY_PATH, see here:
https://github.com/extendr/extendr/blob/06bd2a400894eb8fe9a43360afb6da1a1c8d7a30/.github/workflows/test.yml#L155-L156
(This is most likely the reason why you'll have to treat Unix and Windows separately.)

For the artifacts, there's nothing to worry about, generating and saving the artifacts costs practically nothing. I think it's good to have artifacts for all settings we test. This allows us to check whether anything changes, e.g., whether bindings under nightly look different from those under stable.

uses: actions/upload-artifact@main
r-version: ${{ matrix.config.r }}

- name: Set up `rust`
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be Rust instead of `rust`. In general, I think names of programming languages should not be set in backticks, but more specifically here I don't think the backticks are converted into code font.

- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
# This step is only needed for Windows
- name: Set up `msys2` for Windows
Copy link
Member

Choose a reason for hiding this comment

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

I would similarly delete backticks here.


# Run tests again using different bindings
- name: Run tests on precomputed bindings shipped with libR-sys
run: cargo test -vv $env:CARGO_BUILD_FLAGS -- --nocapture --test-threads=1
Copy link
Member

Choose a reason for hiding this comment

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

Please add a newline at the end of the file.

@Ilia-Kosenkov
Copy link
Member Author

I noticed I screwed up with matrix.config. I will check everything is working correctly and fix all issues.

@Ilia-Kosenkov
Copy link
Member Author

Ilia-Kosenkov commented Dec 21, 2020

Debugging GitHub actions is a real pain.
@clauswilke, I think I fixed everything you mentioned, take a look when you have time.

Should I squash commits? GHA requires a lot of small commits to fine-tune the script, unfortunately.

Copy link
Member

@clauswilke clauswilke left a comment

Choose a reason for hiding this comment

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

Overall looks good. Just a few remaining items while you're at it.

Don't worry about squashing the commits, GitHub does that automatically when merging.

- {os: ubuntu-20.04, r: 'release', rust-version: 'stable', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'release', rust-version: 'nightly', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
# R-devel requires LD_LIBRARY_PATH
- {os: ubuntu-20.04, r: 'devel', rust-version: 'nightly', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
Copy link
Member

Choose a reason for hiding this comment

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

I think R devel should be tested with rust stable, so if something breaks we know whether it's R devel or rust nightly that is the problem. Also, could you expand the matrix so there is an R oldrel run for each OS/architecture? I'd like to have bindings for those versions as well (I realize this will break the test of precompiled bindings; don't worry about that or download the artifacts and add them, as you wish).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, we now test three versions of R for each architecture. I also added R-release rust-nightly generating no bindings to test rust features.

Actually, you were wrong about tests -- you (or someone else) implemented a fallback to default bindings if the exact version is missing, so tests were successful (and a warning was logged). I downloaded new bindings, now we have fallback, 4.0 release, 4.1 devel, and 3.6 oldrel versions for each target.

uses: actions/upload-artifact@main
with:
name: Windows generated bindings
name: ${{ matrix.config.os }} ${{ matrix.config.rust-version }} generated bindings
Copy link
Member

Choose a reason for hiding this comment

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

The generated bindings need to have the R version in the name also.

Copy link
Member Author

Choose a reason for hiding this comment

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

Artifact names are now identical to job names

@clauswilke
Copy link
Member

You're correct. I added the fallback if bindings are missing. Thanks!

@clauswilke clauswilke merged commit 1251100 into extendr:master Dec 22, 2020
@Ilia-Kosenkov Ilia-Kosenkov deleted the gha-win-i686-build branch December 22, 2020 18:30
CGMossa pushed a commit to CGMossa/libR-sys that referenced this pull request Jan 21, 2024
* Split Windows jobs in two

* Setting up GH actions environment

* Fixing indentation

* Fixing indentation #2

* Testing environment

* Fixe incorrect rustup command

* Checking CARGO_BUILD_FLAGS

* Running test build

* Probing environment

* Testing new build

* Fixing GITHUB_ENV/GITHUB_PATH

* Enabling tests

* Enabling macOS

* Enabling tests of precomputed bindings

* Exporting bindings on success

* Checking Windows paths

* Trying Win-i686 build

* Temporary disable ubuntu::r-devel

* Comment

* Upload bindings if both build and test succeed

* Added RSPM

* Disabled ubuntu::r-devel; generate bindings only for stable rust

* Removed old code

* Fixed rust version comparison string

* Testing 'if:' condition

* Fixed config

* Testing ubuntu::r-devel

* Bypassing R alias

* Debugging environment

* Cleaning

* Removed unused R_HOME

* Changed generated bindings name

* Adding Windows/MacOS workflows

* New bindings for Windows/MacOS

* Adding Ubuntu jobs

* Bindings for Linux
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.

2 participants