Skip to content

Commit

Permalink
Switch to GHA; use CARGO_HOME
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Feb 28, 2021
1 parent 5aeec17 commit 8d909cd
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 38 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
\.png$
\.gif$
src/Makevars$
\.github$
1 change: 1 addition & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html
72 changes: 72 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag.
# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions
on:
push:
pull_request:

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}
- {os: ubuntu-20.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1
with:
r-version: ${{ matrix.config.r }}

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Add more rust targets
if: runner.os == 'Windows'
run: |
rustup target add i686-pc-windows-gnu
rustup target add x86_64-pc-windows-gnu
- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0.8.6.1
- CRAN nonsense

0.8.6
- Update gifski crate to 0.8.6
- save_gif() now properly closes graphics device when expr errors
Expand Down
9 changes: 1 addition & 8 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,11 @@ if [ $? -eq 0 ]; then
VERSION=$($CARGO --version)
echo "Using $CARGO ($VERSION)"
sed -e "s|@cargobin@|$CARGO|" src/Makevars.in > src/Makevars

# CRAN forbids using $HOME during CMD check; try to override CARGO_HOME
if [ "$CARGO" == "/usr/bin/cargo" ] && [ "$_R_CHECK_SIZE_OF_TARBALL_" ]; then
if [ -z "$CARGO_HOME" ] && [ ! -e "$HOME/.cargo" ]; then
sed -i.bak "s|#export|export|" src/Makevars
fi
fi
exit 0
fi

# Try local version on MacOS, otherwise error
[[ $OSTYPE == "darwin"* ]] && curl "https://jeroen.github.io/autobrew/rust" -sSf | sh && exit 0
[[ $OSTYPE == "darwin"* ]] && curl "https://autobrew.github.io/scripts/rust" -sSf | sh && exit 0
echo "------------------ RUST COMPILER NOT FOUND --------------------"
echo ""
echo "Cargo was not found on the PATH. Please install cargo / rustc:"
Expand Down
2 changes: 1 addition & 1 deletion src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PKG_LIBS = -L$(LIBDIR) -lmyrustlib -lresolv -pthread
CARGO = @cargobin@

# CRAN policy forbids using $HOME
#export CARGO_HOME=$(R_PACKAGE_DIR)
export CARGO_HOME=$(R_PACKAGE_DIR)

#all: clean

Expand Down

0 comments on commit 8d909cd

Please sign in to comment.