-
Notifications
You must be signed in to change notification settings - Fork 24
Using rtools to test precomputed bindings on Windows #51
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dbdf137
Reordered stepps
Ilia-Kosenkov 7038699
Grouped logging
Ilia-Kosenkov a8c21a8
Setting up rtools path
Ilia-Kosenkov 2d2281d
Amending libgcc_eh for rtools
Ilia-Kosenkov bbd2d85
Setting up MSYS2 for binding generation on Windows
Ilia-Kosenkov 5b52d21
Cleanup
Ilia-Kosenkov ca6a75b
Setting rtools as a separate job
Ilia-Kosenkov d7feb0f
Restoring log groups
Ilia-Kosenkov 945ce92
::endgroup:: no longer swallows exit status of cargo
Ilia-Kosenkov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,12 +135,13 @@ jobs: | |
id: build | ||
run: | | ||
foreach ($target in ($env:RUST_TARGETS).Split(",")) { | ||
echo "Building for target: $target" | ||
echo "::group::Building for target: $target" | ||
cargo build -vv --features use-bindgen $(if ($target -ne 'default') {"--target=$target"} ) | ||
if (!$?) { | ||
echo "::error::$target" ; | ||
echo "::error::Building for target: $target" ; | ||
throw "Last exit code $LASTEXITCODE" | ||
} | ||
echo "::endgroup::" | ||
} | ||
env: | ||
LIBRSYS_BINDINGS_OUTPUT_PATH: generated_bindings | ||
|
@@ -154,12 +155,13 @@ jobs: | |
echo "::warning:: Skipping bindgen tests for target: $target" | ||
} | ||
else { | ||
echo "Running bindgen tests for target: $target" | ||
echo "::group::Running bindgen tests for target: $target" | ||
cargo test -vv --features use-bindgen $(if ($target -ne 'default') {"--target=$target"} ) -- --nocapture --test-threads=1 | ||
if (!$?) { | ||
echo "::error::$target"; | ||
echo "::error::Running bindgen tests for target: $target"; | ||
throw "Last exit code $LASTEXITCODE" | ||
} | ||
echo "::endgroup::" | ||
} | ||
} | ||
env: | ||
|
@@ -190,13 +192,105 @@ jobs: | |
echo "::warning:: Skipping tests for target: $target" | ||
} | ||
else { | ||
echo "Running tests for target: $target" | ||
echo "::group::Running tests for target: $target" | ||
cargo test -vv $(if ($target -ne 'default') {"--target=$target"} ) -- --nocapture --test-threads=1 | ||
if (!$?) { | ||
echo "::error::$target"; | ||
echo "::error::Running tests for target: $target"; | ||
throw "Last exit code $LASTEXITCODE" | ||
} | ||
echo "::endgroup::" | ||
} | ||
} | ||
env: | ||
NO_TEST_TARGETS: ${{ join(matrix.config.no-test-targets, ',') }} | ||
|
||
test_windows_rtools: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (R-${{ matrix.config.r }} rust-${{ matrix.config.rust-version }}) \w RTOOLS | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: windows-latest, r: 'release', rust-version: 'stable-msvc', targets: ['x86_64-pc-windows-gnu', 'i686-pc-windows-gnu']} | ||
|
||
env: | ||
RSPM: ${{ matrix.config.rspm }} | ||
|
||
# PowerShell core is available on all platforms and can be used to unify scripts | ||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up R | ||
uses: r-lib/actions/setup-r@v1 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ matrix.config.rust-version }} | ||
default: true | ||
components: rustfmt, clippy | ||
|
||
- name: Configure targets | ||
run: | | ||
if ($env:RUST_TARGETS -eq '') { | ||
$env:RUST_TARGETS = "default" | ||
} | ||
foreach ($target in ($env:RUST_TARGETS).Split(",")) { | ||
if ($target -ne "default") { | ||
rustup target add $target | ||
} | ||
} | ||
echo "RUST_TARGETS=$env:RUST_TARGETS" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
env: | ||
RUST_TARGETS: ${{ join(matrix.config.targets, ',')}} | ||
|
||
# All configurations for Windows go here | ||
# Rust toolchain is used to determine target architecture | ||
- name: Configure Windows | ||
if: runner.os == 'Windows' | ||
# 1. Configure path to libclang | ||
# 2. Add path to mingw32/mingw64 -- otherwise library is linked to rtools | ||
# 3. Add path to R's i386/x64 -- to solve x86 build/test issue | ||
run: | | ||
if ($env:RUST_TARGETS -like "*x86_64*") { | ||
<# Amend rtools libgcc_eh.a #> | ||
cp C:\rtools40\mingw64\lib\gcc\x86_64-w64-mingw32\8.3.0\libgcc.a C:\rtools40\mingw64\lib\gcc\x86_64-w64-mingw32\8.3.0\libgcc_eh.a | ||
echo "C:\rtools40\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ; | ||
echo "$(Rscript.exe -e 'cat(normalizePath(R.home()))')\bin\x64" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ; | ||
} | ||
if ($env:RUST_TARGETS -like "*i686*") { | ||
echo "C:\rtools40\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ; | ||
echo "$(Rscript.exe -e 'cat(normalizePath(R.home()))')\bin\i386" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append ; | ||
} | ||
|
||
|
||
# Run tests again using different bindings | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here: comment looks wrong. |
||
- name: Run tests on precomputed bindings shipped with libR-sys | ||
run: | | ||
foreach ($target in ($env:RUST_TARGETS).Split(",")) { | ||
if(($env:NO_TEST_TARGETS).Split(",").Contains($target)) { | ||
echo "::warning:: Skipping tests for target: $target" | ||
} | ||
else { | ||
echo "::group::Running tests for target: $target" | ||
cargo test -vv $(if ($target -ne 'default') {"--target=$target"} ) -- --nocapture --test-threads=1 | ||
if (!$?) { | ||
echo "::error::Running tests for target: $target"; | ||
throw "Last exit code $LASTEXITCODE" | ||
} | ||
echo "::endgroup::" | ||
} | ||
} | ||
env: | ||
NO_TEST_TARGETS: ${{ join(matrix.config.no-test-targets, ',') }} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, missed this earlier: The comments look like they need updating.