-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devel' into docs/gitpod-update
- Loading branch information
Showing
12 changed files
with
299 additions
and
110 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,45 +1,31 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/cpp | ||
{ | ||
"name": "R-Dev-Env", | ||
"image": "ghcr.io/r-devel/r-dev-env:main", | ||
"hostRequirements": { | ||
"cpus": 4 | ||
}, | ||
|
||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"r.lsp.diagnostics": false, | ||
"r.plot.useHttpgd": true, | ||
"r.rpath.linux": "/usr/bin/R", | ||
"r.rterm.linux": "/usr/bin/R", | ||
"terminal.integrated.sendKeybindingsToShell": true, | ||
"svn.multipleFolders.enabled": true, | ||
"name": "R-Dev-Env", | ||
"image": "ghcr.io/r-devel/r-dev-env:devel", | ||
"hostRequirements": { | ||
"cpus": 4 | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"r.lsp.diagnostics": false, | ||
"r.plot.useHttpgd": true, | ||
"r.rpath.linux": "/usr/bin/R", | ||
"r.rterm.linux": "/usr/bin/R", | ||
"terminal.integrated.sendKeybindingsToShell": true, | ||
"svn.multipleFolders.enabled": true, | ||
"workbench.editorAssociations": { | ||
"*.md": "vscode.markdown.preview.editor" | ||
}, | ||
"workbench.welcomePage.walkthroughs.openOnInstall": false | ||
}, | ||
"extensions": [ | ||
"REditorSupport.r", | ||
"mads-hartmann.bash-ide-vscode", | ||
"johnstoncode.svn-scm", | ||
"ms-vscode.cpptools", | ||
"MS-vsliveshare.vsliveshare" | ||
] | ||
} | ||
|
||
}, | ||
"postCreateCommand":"cat /workspaces/r-dev-env/scripts/welcome_msg.sh >> ~/.bashrc && cat /workspaces/r-dev-env/scripts/set_build_r.sh >> ~/.bashrc && bash /workspaces/r-dev-env/scripts/localscript.sh" | ||
// Features to add to the dev container. More info: https://containers.dev/features. | ||
// "features": {}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "gcc -v", | ||
// Configure tool-specific properties. | ||
// "customizations": {}, | ||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
}, | ||
"extensions": [ | ||
"REditorSupport.r", | ||
"mads-hartmann.bash-ide-vscode", | ||
"johnstoncode.svn-scm", | ||
"ms-vscode.cpptools", | ||
"MS-vsliveshare.vsliveshare" | ||
] | ||
} | ||
}, | ||
"postCreateCommand": "chown -R vscode:vscode /workspaces/r-dev-env && sh /workspaces/r-dev-env/scripts/localscript.sh" | ||
} |
This file contains 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
This file contains 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Optimize Docs Images | ||
|
||
on: | ||
pull_request: | ||
branches: ["main","devel"] | ||
types: [closed] | ||
paths: | ||
- 'docs/assets/**' | ||
|
||
jobs: | ||
optimize-images: | ||
if: ${{github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true}} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2 | ||
|
||
- name: Install system dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libmagick++-dev | ||
- name: Install R packages | ||
run: | | ||
R -e 'install.packages(c("magick", "tools"), repos = "https://cloud.r-project.org/")' | ||
- name: Optimize images | ||
run: | | ||
Rscript ./scripts/optimize.R | ||
- name: Commit and push optimized images | ||
if: github.ref == 'refs/heads/devel' && github.event_name == 'push' | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git add docs/assets | ||
git commit -m 'Optimize docs images' | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM gitpod/workspace-full:latest | ||
|
||
USER root | ||
|
||
ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none" | ||
|
||
# Optionally install the cmake for vcpkg | ||
COPY ./reinstall-cmake.sh /tmp/ | ||
|
||
RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ | ||
chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \ | ||
fi \ | ||
&& rm -f /tmp/reinstall-cmake.sh | ||
|
||
RUN sed -i.bak "/^#.*deb-src.*universe$/s/^# //g" /etc/apt/sources.list \ | ||
&& echo "deb https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/" >> /etc/apt/sources.list \ | ||
&& wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc \ | ||
&& apt update \ | ||
&& apt -y install subversion \ | ||
&& apt -y build-dep r-base-dev \ | ||
&& apt -y install r-base-dev \ | ||
&& Rscript -e "install.packages('languageserver', repos='https://cran.rstudio.com')" \ | ||
&& Rscript -e "install.packages('httpgd', repos='https://cran.rstudio.com')" | ||
|
||
RUN apt install -y shellcheck | ||
RUN apt install -y ccache | ||
RUN apt install -y rsync | ||
#RUN /usr/sbin/update-ccache-symlinks | ||
#RUN echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a /home/vscode/.bashrc | ||
|
||
|
||
ARG CONTAINER_VERSION | ||
ENV CONTAINER_VERSION ${CONTAINER_VERSION} |
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
image: ghcr.io/r-devel/r-dev-env:gitpod.devel | ||
|
||
tasks: | ||
- name: Initial Setup for R-dev-env Gitpod Workspace | ||
before: | | ||
bash /workspace/r-dev-env/scripts/localscript.sh | ||
source ~/.bashrc | ||
vscode: | ||
extensions: | ||
- REditorSupport.r | ||
- johnstoncode.svn-scm |
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,13 +1,38 @@ | ||
# This script is run after the workspace is created | ||
#!/bin/bash | ||
|
||
mkdir -p /home/vscode/.local/bin | ||
local_script(){ | ||
|
||
# Workspace root is $PWD at the start | ||
WORK_DIR=$PWD | ||
VSCODE_DIR="$WORK_DIR/.vscode" | ||
DEVCONTAINER_JSON="$WORK_DIR/.devcontainer/devcontainer.json" | ||
|
||
# Create patch directory in workspace root ($PWD at start) | ||
PATCHDIR="$WORK_DIR/patches" | ||
mkdir -p $PATCHDIR | ||
mkdir -p $VSCODE_DIR | ||
|
||
chmod +x /workspaces/r-dev-env/scripts/which_r.sh | ||
chmod +x /workspaces/r-dev-env/scripts/set_build_r.sh | ||
# Copy the which_r and set_build_r function definitions to .bashrc | ||
cat $WORK_DIR/scripts/which_r.sh >> ~/.bashrc | ||
cat $WORK_DIR/scripts/set_build_r.sh >> ~/.bashrc | ||
|
||
cp /workspaces/r-dev-env/scripts/which_r.sh /home/vscode/.local/bin/which_r | ||
# cp /workspaces/r-dev-env/scripts/set_build_r.sh /home/vscode/.local/bin/set_build_r | ||
# Copy over the welcome message script to be run when bash terminal starts | ||
cat $WORK_DIR/scripts/welcome_msg.sh >> ~/.bashrc | ||
|
||
# remove git directory | ||
#bash ~/.bashrc | ||
|
||
# Remove git directory if it exists | ||
rm -rf .git | ||
|
||
# copying vscode extension settings from devcontainer json to vscode settings json using jq | ||
if [ -f "$DEVCONTAINER_JSON" ]; then | ||
jq '.customizations.vscode.settings' "$DEVCONTAINER_JSON" > "$VSCODE_DIR/settings.json" | ||
fi | ||
|
||
|
||
} | ||
|
||
|
||
# Run the main function | ||
local_script |
This file contains 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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
library(magick) | ||
library(tools) | ||
|
||
# Define the directory containing images | ||
image_dir <- file.path("docs", "assets") | ||
|
||
# Get all photos in the directory with specified extensions | ||
files <- dir(image_dir, pattern = "\\.(jpeg|jpg|png)$", ignore.case = TRUE) | ||
|
||
# Process each file | ||
for (i in seq_along(files)) { | ||
# Read the image | ||
file_path <- file.path(image_dir, files[i]) | ||
img <- tryCatch({ | ||
image_read(file_path) | ||
}, error = function(e) { | ||
message("Error reading image: ", file_path) | ||
next | ||
}) | ||
|
||
# Resize the image to 800 px width using Triangle filter for resampling | ||
img <- image_resize(img, geometry_size_pixels(width = 800), filter = "Triangle") | ||
|
||
|
||
# Define the output path (overwrite original image) | ||
output_path <- file_path | ||
|
||
# Write the optimized image (overwrite original image) | ||
tryCatch({ | ||
image_write(img, output_path, format = "jpg", quality = 82) | ||
}, error = function(e) { | ||
message("Error writing image: ", output_path) | ||
}) | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.