Skip to content

Commit

Permalink
Merge pull request #36 from TanguyBarthelemy/master
Browse files Browse the repository at this point in the history
CRAN
  • Loading branch information
TanguyBarthelemy authored May 15, 2024
2 parents 7646225 + 35646e0 commit 26cd701
Show file tree
Hide file tree
Showing 27 changed files with 610 additions and 65 deletions.
33 changes: 23 additions & 10 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
^Meta$
^docs$
^_pkgdown\.yml$

^.*\.Rproj$
^\.Rproj\.user$

^\.git$
^\.github$

^README\.Rmd$
^README-.*\.png$
.travis.yml
^pkgdown$

^Meta$
^docs$
^doc$
^pkgdown$
^_pkgdown\.yml$

^\.lintr$

^appveyor\.yml$
.travis.yml

cran-comments.md
^\.github$
^LICENCE$
^LICENCE_en$

TO_DO
.lintr
^\.DS_Store$

^revdep$
^reconf\.sh$

^LICENCE$
^LICENSE$
166 changes: 166 additions & 0 deletions .github/workflows/R-CMD-check2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
workflow_dispatch

name: R-CMD-check

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

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

strategy:
fail-fast: false
matrix:
# os: [ 'ubuntu-latest', 'windows-latest', 'macOS-latest' ]
# r: [ 'devel', 'release', 'oldrel-1', '4.2.1', '4.1.1', '4.1.3', '4.0.5', '3.6.1' ]
# java: [ '11', '13', '17', '19', '21' ]
os: [ 'windows-latest' ]
r: [ 'devel', 'release' ]
# Pb with Java 8
java: [ '11' ]
include:
- http-user-agent: 'release'
r: 'devel'

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

# Set-up java

- name: Setup java (x64)
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
java-package: jdk
distribution: 'zulu'
architecture: x64

- name: Setup java (x86)
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
java-package: jdk
distribution: 'zulu'
architecture: x86


#
# - name: Setup java (x64)
# uses: actions/setup-java@v4
# if: matrix.java != '19'
# with:
# java-version: ${{ matrix.java }}
# java-package: jdk
# distribution: 'zulu'
# architecture: x64
#
# - name: Setup java 19 (x64)
# uses: actions/setup-java@v4
# if: matrix.java == '19'
# with:
# java-version: ${{ matrix.java }}
# java-package: jdk
# distribution: 'temurin'
# architecture: x64
#
# - name: Setup java (x86)
# uses: actions/setup-java@v4
# if: runner.os == 'Windows' && matrix.java != '19'
# with:
# java-version: ${{ matrix.java }}
# java-package: jdk
# distribution: 'zulu'
# architecture: x86
#
# - name: Setup java 19 (x86)
# uses: actions/setup-java@v4
# if: runner.os == 'Windows' && matrix.java == '19'
# with:
# java-version: ${{ matrix.java }}
# java-package: jdk
# distribution: 'temurin'
# architecture: x86

# Some additionnal set up for ubuntu
# - name: Installation de libcurl4-openssl-dev
# if: runner.os == 'Linux'
# run: |
# sudo apt-get update
# sudo apt-get install -y libcurl4-openssl-dev
# sudo apt-get install -y default-jre
# sudo find / -name libjvm.so
#
# - name: Définir LD_LIBRARY_PATH
# if: runner.os == 'Linux'
# run: |
# sudo bash -c 'export LD_LIBRARY_PATH=/usr/lib/jvm/temurin-11-jdk-amd64/lib/server:$LD_LIBRARY_PATH'
# sudo bash -c "echo 'export LD_LIBRARY_PATH=/usr/lib/jvm/temurin-11-jdk-amd64/lib/server:$LD_LIBRARY_PATH' >> $HOME/.profile"
#
# - name: Afficher le chemin de bibliothèque Java
# if: runner.os == 'Linux'
# run: echo $LD_LIBRARY_PATH
#
# - name: Vérifier la version de Java
# if: runner.os == 'Linux'
# run: java -version
#
# - name: Vérifier la valeur de JAVA_HOME
# if: runner.os == 'Linux'
# run: echo $JAVA_HOME

# Set up R
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r }}
http-user-agent: ${{ matrix.http-user-agent }}
use-public-rspm: true

# Pour MacOS et ubuntu, qqs installation supplémentaires
- name: "[Stage] [macOS] Install libgit2"
if: runner.os == 'macOS'
run: brew install libgit2

- name: "[Stage] [macOS] Install system libs for pkgdown"
if: runner.os == 'macOS'
run: brew install harfbuzz fribidi

- name: "Configure java pour ubuntu et macos"
if: runner.os != 'Windows'
run: sudo R CMD javareconf

- name: "[macOS] Install textshaping"
run: install.packages('textshaping')
shell: Rscript {0}
if: ${{ runner.os == 'macOS' && matrix.r == 'devel' }}

- name: "[macOS] Install systemfonts"
run: install.packages('systemfonts')
shell: Rscript {0}
if: ${{ runner.os == 'macOS' && matrix.r == '3.6.1' }}

# Dépendances

- uses: r-lib/actions/setup-r-dependencies@v2
if: ${{ matrix.r != '3.6.1' }}
with:
packages: knitr, kableExtra, rmarkdown
extra-packages: any::rcmdcheck

# Pour R 3.6.1 qqs installations supplémentaires
- name: "[R 3.6.1] Install dependency"
run: install.packages(c("rJava", "XML", "RJDemetra", "rcmdcheck"))
shell: Rscript {0}
if: ${{ matrix.r == '3.6.1' || matrix.java == '11' }}

- uses: r-lib/actions/setup-tinytex@v2

- uses: r-lib/actions/check-r-package@v2
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
Expand Down
139 changes: 139 additions & 0 deletions .github/workflows/pr-commands.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
issue_comment:
types: [created]

name: Commands

jobs:
document:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }}
name: document
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-java@v4
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Set up for RProtoBuf
run: sudo apt-get update -y && sudo apt-get install protobuf-compiler libprotobuf-dev libprotoc-dev

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::roxygen2
needs: pr-document

- name: Document
run: roxygen2::roxygenise()
shell: Rscript {0}

- name: Config git
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
# Check if there are any changes
- name: Check for changes
id: check-changes
run: |
if git diff --quiet -- NAMESPACE man/; then
echo "has-changed=false" >> "$GITHUB_OUTPUT"
else
echo "has-changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit the changes
if: ${{ steps.check-changes.outputs.has-changed == 'true' }}
run: |
git add man/\* NAMESPACE
git commit -m '[GHA] Document package'
# Commit changes or a placeholder commit if no changes
- name: Commit no changes
if: ${{ steps.check-changes.outputs.has-changed == 'false' }}
run: |
git commit --allow-empty -m '[GHA] Package already documented'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

style:
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }}
name: style
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/setup-java@v4
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Set up for RProtoBuf
run: sudo apt-get update -y && sudo apt-get install protobuf-compiler libprotobuf-dev libprotoc-dev

- name: Install dependencies
run: install.packages("styler")
shell: Rscript {0}

- name: Style
run: styler::style_pkg(transformers = styler::tidyverse_style(indent_by = 4))
shell: Rscript {0}

- name: Config git
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
# Check if there are any changes
- name: Check for changes
id: check-changes
run: |
if git diff --quiet -- '*.R'; then
echo "has-changed=false" >> "$GITHUB_OUTPUT"
else
echo "has-changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Commit the changes
if: ${{ steps.check-changes.outputs.has-changed == 'true' }}
run: |
git add \*.R
git commit -m '[GHA] Style package'
# Commit changes or a placeholder commit if no changes
- name: Commit no changes
if: ${{ steps.check-changes.outputs.has-changed == 'false' }}
run: |
git commit --allow-empty -m '[GHA] Package already styled'
- uses: r-lib/actions/pr-push@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 26cd701

Please sign in to comment.