Skip to content
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

Gestion des dépendances avec renv #543

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
^renv$
^renv\.lock$
^LICENSE\.md$
^\.github$
40 changes: 31 additions & 9 deletions .github/workflows/bookdown-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,45 @@ on:
- main
- master

name: preview bookdown
name: Preview website

jobs:
build:
if: "!contains(github.event.commits[0].message, '[skip ci]')"
runs-on: ubuntu-latest
container: inseefrlab/utilitr:latest
steps:
- name: Checkout Repository
if: ${{ github.repository == 'inseefrlab/utilitr' }}
env:
GITHUB_PAT: ${{ secrets.PAT }}
uses: actions/checkout@master
- name: Install Dependencies
if: ${{ github.repository == 'inseefrlab/utilitr' }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Configure safe repository
run: |
git config --global --add safe.directory /__w/utilitR/utilitR
- name: Set RENV_PATHS_ROOT
shell: bash
run: |
Rscript -e "install.packages(c('remotes', 'htmltools', 'sf'))"
echo "RENV_PATHS_ROOT=${{ runner.temp }}/renv" >> $GITHUB_ENV
- name: Install and activate renv
run: |
install.packages("yaml")
install.packages("renv")
renv::status()
renv::activate()
shell: Rscript {0}
- name: Get R and OS version
id: get-version
run: |
cat("##[set-output name=os-version;]", sessionInfo()$running, "\n", sep = "")
cat("##[set-output name=r-version;]", R.Version()$version.string, sep = "")
shell: Rscript {0}
- name: Restore Renv package cache
uses: actions/cache@v4
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{ inputs.cache-version }}-${{ hashFiles('renv.lock') }}
restore-keys: ${{ steps.get-version.outputs.os-version }}-${{ steps.get-version.outputs.r-version }}-${{inputs.cache-version }}-
env:
GITHUB_PAT: ${{ secrets.PAT }}
- name: Render Book
Expand Down
104 changes: 32 additions & 72 deletions .github/workflows/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,82 +1,42 @@
name: Production de la documentation


on:
workflow_dispatch:
push:
branches:
- main
- master
- test
branches: renv

name: Quarto Publish

jobs:
docker:
if: "!contains(github.event.commits[0].message, '[skip ci]')"
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
if: ${{ github.repository == 'inseefrlab/utilitr' }}
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
if: ${{ github.repository == 'inseefrlab/utilitr' }}
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
if: ${{ github.repository == 'inseefrlab/utilitr' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
if: ${{ github.repository == 'inseefrlab/utilitr' }}
id: docker_build
uses: docker/build-push-action@v2
env:
GITHUB_PAT: ${{ secrets.PAT }}
with:
push: true
context: .
tags: |
inseefrlab/utilitr:latest
inseefrlab/utilitr:0.9.1
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
website:
name: Render website
if: "!contains(github.event.commits[0].message, '[skip ci]')"
needs: docker
runs-on: ubuntu-latest
container: inseefrlab/utilitr:latest
steps:
- uses: actions/checkout@v4
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Quarto environement
uses: quarto-dev/quarto-actions/setup@v2

- name: Install R dependency
run: |
Rscript -e "install.packages('yaml')"

- name: Install R
uses: r-lib/actions/setup-r@v2
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
r-version: '4.4.1'

- name: Install dependencies
run: |
git config --global --add safe.directory /__w/utilitR/utilitR
Rscript -e "install.packages(c('remotes'))"
Rscript -e "remotes::install_github('rstudio/htmltools')"
Rscript -e "remotes::install_github('r-spatial/sf', dependencies = TRUE)"
env:
GITHUB_PAT: ${{ secrets.PAT }}
- name: Render Book
run: |
ls
git remote -v
git config --global user.email [email protected]
git config --global user.name "Quarto GHA Workflow Runner"
quarto render --to html
quarto publish gh-pages --no-render --no-browser
- uses: actions/upload-artifact@v2
sudo ./docker/dependencies.sh
- name: Install R Dependencies
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 1

- name: Render and Publish
uses: quarto-dev/quarto-actions/publish@v2
with:
name: _public
path: _public/
retention-days: 5
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111 changes: 0 additions & 111 deletions DESCRIPTION

This file was deleted.

9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
FROM inseefrlab/onyxia-rstudio:r4.3.2-2024.02.13
FROM inseefrlab/onyxia-rstudio:r4.4.1-2024.10.14

# R packages
COPY ./DESCRIPTION /tmp/build_image/
RUN Rscript -e "install.packages(c('xfun','knitr', 'insee', 'OECD', 'htmltools'))"
RUN Rscript -e "remotes::install_deps('/tmp/build_image', dependencies = TRUE, upgrade = FALSE)"
RUN Rscript -e "remotes::install_github('kevinushey/rex')"
RUN Rscript -e "remotes::install_github('inseefrlab/inseelocaldata')"
RUN Rscript -e "install.packages(c('renv','yaml'))"

RUN apt-get update \
&& apt-get -qq install gnupg

RUN sh -c 'echo "deb http://http.us.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list' \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138 \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9 \
Expand Down
43 changes: 43 additions & 0 deletions docker/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Update package lists
apt-get update && apt-get -qq install gnupg

# Add Debian sources to apt and import necessary GPG keys
sh -c 'echo "deb http://http.us.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list'
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 648ACFD622F3D138
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 0E98404D386FA1D9
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 605C66F00D6C9793

# Update package lists and set debconf selections for mscorefonts installer
apt-get update
echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections

# Install necessary packages without recommended dependencies
apt-get -qq install --no-install-recommends \
ttf-mscorefonts-installer \
fonts-liberation \
fonts-freefont-ttf \
libssl-dev

apt-get -qq install --no-install-recommends \
imagemagick \
libmagick++-dev \
ghostscript \
libglpk40

apt-get -qq install --no-install-recommends \
libgs-dev \
librsvg2-dev \
libwebp-dev \
jq

# Clean up apt cache
rm -rf /var/lib/apt/lists/* && rm -rf /src/*.deb

# Upgrade packages
apt-get upgrade -y

# Install mc (MinIO Client)
wget https://dl.min.io/client/mc/release/linux-amd64/mc -O /usr/local/bin/mc && \
chmod +x /usr/local/bin/mc
2 changes: 1 addition & 1 deletion index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
::::: {.headline .g-col-lg-9 .g-col-12 .g-col-md-12}

:::::: h1
`utilitR`
utilitR
::::::


Expand Down
Loading
Loading