Skip to content

Commit

Permalink
Merge pull request #86 from albersonmiranda/dev
Browse files Browse the repository at this point in the history
chore: Update R package build configuration and install necessary packages
  • Loading branch information
albersonmiranda authored Aug 11, 2024
2 parents b447135 + c50c226 commit 5ec8902
Show file tree
Hide file tree
Showing 19 changed files with 230 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ RUN install2.r --error --skipinstalled -n -1 \
# pacotes R
leontief \
microbenchmark \
Rdpack \
emoji \
&& rm -rf /tmp/downloaded_packages

# Pacotes Python (digitar nomes em requirements.txt)
Expand Down
164 changes: 157 additions & 7 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
branches: [main]
pull_request:
branches: [main, master]
branches: [main]
types:
- opened
- reopened
Expand All @@ -26,11 +26,30 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}
- {os: macos-14, r: 'release'}
- {os: macos-14, r: 'devel'}
- {os: macos-14, r: 'oldrel-1'}
- {os: macos-13, r: 'release'}
- {os: macos-13, r: 'devel'}
- {os: macos-13, r: 'oldrel-1'}
- {os: macos-12, r: 'release'}
- {os: macos-12, r: 'devel'}
- {os: macos-12, r: 'oldrel-1'}
- {os: windows-2022, r: 'release'}
- {os: windows-2022, r: 'devel'}
- {os: windows-2022, r: 'oldrel-1'}
- {os: windows-2019, r: 'release'}
- {os: windows-2019, r: 'devel'}
- {os: windows-2019, r: 'oldrel-1'}
- {os: ubuntu-24.04, r: 'devel'}
- {os: ubuntu-24.04, r: 'release'}
- {os: ubuntu-24.04, r: 'oldrel-1'}
- {os: ubuntu-22.04, r: 'devel'}
- {os: ubuntu-22.04, r: 'release'}
- {os: ubuntu-22.04, r: 'oldrel-1'}
- {os: ubuntu-20.04, r: 'devel'}
- {os: ubuntu-20.04, r: 'release'}
- {os: ubuntu-20.04, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -56,3 +75,134 @@ jobs:
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

Fedora-36:
runs-on: ubuntu-latest
container:
image: fedora:36

steps:
- name: Install Fedora dependencies
run: |
sudo dnf install -y --allowerasing pip rust gcc llvm libxml2-devel libcurl-devel harfbuzz-devel \
fribidi-devel openssl-devel freetype-devel libpng-devel libtiff-devel libjpeg-devel qpdf xz \
glibc-langpack-en devscripts-checkbashisms gcc-c++ gcc-gfortran readline-devel xz-devel bzip2-devel \
zlib-devel pcre2-devel cairo-devel libgit2-devel libX11-devel libXt-devel which
- name: Compile R from source
run: |
# download R 4.2.0
curl https://cran.r-project.org/src/base/R-4/R-4.2.0.tar.gz -O
# extract R 4.2.0
tar -xvf R-4.2.0.tar.gz
# build R 4.2.0
cd R-4.2.0 && ./configure --prefix=/usr/local && make && make install
# back to the root directory
cd ~
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

Fedora-37:
runs-on: ubuntu-latest
container:
image: fedora:37

steps:
- uses: actions/checkout@v4

- name: Install Fedora dependencies
run: |
sudo dnf install -y rust libxml2-devel libcurl-devel harfbuzz-devel fribidi-devel openssl-devel freetype-devel libpng-devel libtiff-devel libjpeg-devel qpdf xz devscripts glibc-langpack-en
- name: Setup R
run: |
sudo dnf install -y R
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

Fedora-38:
runs-on: ubuntu-latest
container:
image: fedora:38

steps:
- uses: actions/checkout@v4

- name: Install Fedora dependencies
run: |
sudo dnf install -y rust cargo libxml2-devel libcurl-devel harfbuzz-devel fribidi-devel openssl-devel freetype-devel libpng-devel libtiff-devel libjpeg-devel qpdf xz devscripts glibc-langpack-en pandoc
- name: Setup R
run: |
sudo dnf install -y R
# install R packages
R -e 'install.packages(c("remotes", "rcmdcheck", "emoji", "Rdpack", "readxl", "clipr", "fs", "miniUI", "shiny", "knitr", "rmarkdown", "spelling", "microbenchmark", "leontief", "ggplot2", "writexl", "testthat"), repos = "http://cloud.r-project.org")'
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

Fedora-39:
runs-on: ubuntu-latest
container:
image: fedora:39

steps:
- uses: actions/checkout@v4

- name: Install Fedora dependencies
run: |
sudo dnf install -y rust cargo libxml2-devel libcurl-devel harfbuzz-devel fribidi-devel openssl-devel freetype-devel libpng-devel libtiff-devel libjpeg-devel qpdf xz devscripts glibc-langpack-en pandoc
- name: Setup R
run: |
sudo dnf install -y R
# install R packages
R -e 'install.packages(c("remotes", "rcmdcheck", "emoji", "Rdpack", "readxl", "clipr", "fs", "miniUI", "shiny", "knitr", "rmarkdown", "spelling", "microbenchmark", "leontief", "ggplot2", "writexl", "testthat"), repos = "http://cloud.r-project.org")'
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'

Fedora-40:
runs-on: ubuntu-latest
container:
image: fedora:40

steps:
- uses: actions/checkout@v4

- name: Install Fedora dependencies
run: |
sudo dnf install -y rust cargo libxml2-devel libcurl-devel harfbuzz-devel fribidi-devel openssl-devel freetype-devel libpng-devel libtiff-devel libjpeg-devel qpdf xz devscripts glibc-langpack-en pandoc
- name: Setup R
run: |
sudo dnf install -y R
# install R packages
R -e 'install.packages(c("remotes", "rcmdcheck", "emoji", "Rdpack", "readxl", "clipr", "fs", "miniUI", "shiny", "knitr", "rmarkdown", "spelling", "microbenchmark", "leontief", "ggplot2", "writexl", "testthat"), repos = "http://cloud.r-project.org")'
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
inst/doc
docs
revdep/
src/vendor
src/rust/vendor
.vscode/
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rust-analyzer.linkedProjects": [
"${workspaceFolder}/src/rust/Cargo.toml"
],
}
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: fio
Title: Friendly Input-Output Analysis
Version: 0.1.0
Version: 0.1.1
Authors@R: c(
person(
given = "Alberson",
Expand Down Expand Up @@ -29,7 +29,7 @@ Roxygen: list(markdown = TRUE, r6 = TRUE)
RoxygenNote: 7.3.2
Depends:
R (>= 4.0)
SystemRequirements: Cargo (Rust's package manager), rustc >= 1.67
SystemRequirements: Cargo (Rust's package manager), rustc >= 1.67.1
LazyData: true
Imports:
cli,
Expand All @@ -42,7 +42,7 @@ Imports:
shiny,
Rdpack
License: MIT + file LICENSE
Config/rextendr/version: 0.3.1
Config/rextendr/version: 0.3.1.9000
Suggests:
knitr,
rmarkdown,
Expand Down
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# fio 0.1.1

## 🛠️ Other improvements

* Update `extraction.rs`and `multipliers.rs` in order to lower minimum supported Rust version from 1.71 to 1.67.
* Set minimum version of rustc >= 1.67.1 in `SystemRequirements`.
* Add system checks to rustc and prompt users either install, if missing, or update when version is lower than specified in `DESCRIPTION`.

# fio 0.1.0

## ✨ Enhancements
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ You can install the released version of `{fio}` from CRAN with:
```r
install.packages("fio")
```
For the latest development version, you'll find precompiled binaries at [R-universe](https://albersonmiranda.r-universe.dev/fio):
For the latest tested but unreleased version ([main branch](https://github.com/albersonmiranda/fio/tree/main)), you'll find precompiled binaries at [R-universe](https://albersonmiranda.r-universe.dev/fio):

```r
install.packages("fio", repos = c("https://albersonmiranda.r-universe.dev", "https://cloud.r-project.org"))
```

If you wish to compile the latest development version from source, you'll need [Rust](https://www.rust-lang.org/) installed on your system. You can install Rust with the following commands:
For the development version, you can compile the [dev branch](https://github.com/albersonmiranda/fio/tree/dev) from source, you'll need [Rust](https://www.rust-lang.org/) installed on your system. You can install Rust with the following commands:

- Debian/Ubuntu: `apt-get install cargo`
- Fedora/CentOS: `dnf install cargo`
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ You can install the released version of `{fio}` from CRAN with:
install.packages("fio")
```

For the latest development version, you’ll find precompiled binaries at
For the latest tested but unreleased version ([main
branch](https://github.com/albersonmiranda/fio/tree/main)), you’ll find
precompiled binaries at
[R-universe](https://albersonmiranda.r-universe.dev/fio):

``` r
install.packages("fio", repos = c("https://albersonmiranda.r-universe.dev", "https://cloud.r-project.org"))
```

If you wish to compile the latest development version from source,
For the development version, you can compile the [dev
branch](https://github.com/albersonmiranda/fio/tree/dev) from source,
you’ll need [Rust](https://www.rust-lang.org/) installed on your system.
You can install Rust with the following commands:

Expand Down
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh
: "${R_HOME=`R RHOME`}"
"${R_HOME}/bin/Rscript" tools/msrv.R
"${R_HOME}/bin/Rscript" tools/msrv.R
2 changes: 1 addition & 1 deletion configure.win
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env sh
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" tools/msrv.R
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" tools/msrv.R
43 changes: 14 additions & 29 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,19 @@
## Third ressubmission

In this version I have:
## R CMD check results

* Updated `import_iom()` example so it does not require `dontrun` nor `donttest` tag.
* Added missing `return` tag to `iom` class (previously only on methods).
0 errors | 0 warnings | 1 notes

## Second Ressubmission
* NOTE:
- installed size is 8.2Mb due to vendored Rust dependencies as per CRAN policy.

In this version I have:

* Rewrite `r6.R` documentation to address Konstanze's instructions.
* Refactor `$set_max_threads()` method for better parallelism control and error handling.
* Comply with CRAN's policies by building offline:
* Pass "--offline" flag to `cargo build` to avoid online compilation.
* Included compressed Rust dependencies in order to compile offline.
* Added `configure` and `configure.win` files with 'Cargo' installation instructions when needed but not found.

## Ressubmission

This is a resubmission. Previous submission failed due to parallelization by default.
In this version I have:

* Added "-j 2" flag to `cargo build` to avoid parallelism during building (`makevars` and `makevars.win`).
* Added `$set_max_threads()` method to provide parallelism control to the user.
* Added tests.

## R CMD check results

0 errors | 0 warnings | 2 notes

* Check on Ubuntu
- Installed size is 9.3Mb: Rust code and dependencies are compiled and statically linked into the shared library `fio.so`.
- Build on Ubuntu 24.04 raises non-portable flag due to `-mno-omit-leaf-frame-pointer` which is [set by default in 24.04](https://ubuntu.com/blog/ubuntu-performance-engineering-with-frame-pointers-by-default).
* Addressed CRAN removal:
- Update `extraction.rs`and `multipliers.rs` in order to lower MSRV from 1.71 to 1.67. That fixes previous failure, assuming CRAN lowest 'rustc' version is 1.69.0 (last release in Fedora 36 default repository).
- Set minimum version of rustc >= 1.67.1 in `SystemRequirements`. That specific version is due to dependency `faer-entity v0.19.0`.
- Update `configure` and `configure.win` to check `SystemRequirements` field in `DESCRIPTION` and performe a system check for both `Rust` and `Cargo` tools. If any of them is not found, build fails with a message to install them. If they are found, it checks for the minimum version of `rustc`. If it is lower than specified in `SystemRequirements`, build fails with a message stating both installed and minimum version required. Finally, if all tests pass, it prints the version of `cargo` and `rustc` found, which will be used to build the package.
- CI tests include (all passed R CMD check):
- macOS 12, 13 and 14; R release, devel and oldrel-1.
- Windows Server 2019, 2022; R release, devel and oldrel-1.
- Ubuntu 20.04, 22.04, 24.04; R release, devel and oldrel-1.
- Fedora 36; R 4.2 built from source. `cargo` and other dependencies installed from Fedora 36 default repository (`dnf install`).
- Fedora 37, 38, 39, 40; R and all dependencies installed from default repository (`dnf install`).
3 changes: 2 additions & 1 deletion src/Makevars
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ $(STATLIB):
fi && \
export PATH="$(PATH):$(HOME)/.cargo/bin" && \
cargo build $(CRAN_FLAGS) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) && \
echo `cargo --version` && echo `rustc --version`;
echo "Rust version:" `rustc --version` && \
echo "Cargo version:" `cargo --version`;
rm -Rf $(CARGOTMP) $(VENDOR_DIR) $(LIBDIR)/build; \

C_clean:
Expand Down
10 changes: 2 additions & 8 deletions src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ CRAN_FLAGS=-j 2 --offline
CARGOTMP = $(CURDIR)/.cargo
VENDOR_DIR = $(CURDIR)/vendor

all: C_clean

$(SHLIB): $(STATLIB)

CRAN_FLAGS=-j 2 --offline
CARGOTMP = $(CURDIR)/.cargo

$(STATLIB):
# uncompress vendored deps
if [ -f ./rust/vendor.tar.xz ]; then \
Expand All @@ -43,7 +36,8 @@ $(STATLIB):
export CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER="$(CARGO_LINKER)" && \
export LIBRARY_PATH="$${LIBRARY_PATH};$(CURDIR)/$(TARGET_DIR)/libgcc_mock"; \
cargo build $(CRAN_FLAGS) --target=$(TARGET) --lib --release --manifest-path=./rust/Cargo.toml --target-dir $(TARGET_DIR) && \
echo `cargo --version` && echo `rustc --version`;
echo "Rust version:" `rustc --version` && \
echo "Cargo version:" `cargo --version`;
if [ "$(NOT_CRAN)" != "true" ]; then \
rm -Rf $(CARGOTMP) $(VENDOR_DIR) $(LIBDIR)/build; \
fi
Expand Down
5 changes: 2 additions & 3 deletions src/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5ec8902

Please sign in to comment.