From 6747d17f11ad8a140cb5096d9773c9f51874aded Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 10 Oct 2025 14:06:07 +0200 Subject: [PATCH 1/7] add devcontainer setup --- .devcontainer/Dockerfile | 12 ++++++++++++ .devcontainer/devcontainer.json | 14 ++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..7021efdd1f --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,12 @@ +# Use a base image with Ubuntu +FROM mcr.microsoft.com/devcontainers/base:ubuntu + +# Install R +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + r-base \ + r-base-dev \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Set default shell +SHELL ["/bin/bash", "-c"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..4202675d3d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,14 @@ +{ + "name": "R Environment", + "build": { + "dockerfile": "Dockerfile" + }, + "settings": { + "terminal.integrated.defaultProfile.linux": "bash" + }, + "extensions": [ + "Ikuyadeu.r", // R language support in VS Code + "REditorSupport.r-lsp" // R Language Server + ], + "postCreateCommand": "Rscript -e 'install.packages(c(\"languageserver\"), repos=\"https://cloud.r-project.org\")'" +} From 79aac1845fcbe3c9f7f1c0d9716b0492c46c024c Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 9 Dec 2025 10:24:45 +0100 Subject: [PATCH 2/7] devcontainer test --- .devcontainer/devcontainer.json | 45 +++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4202675d3d..a1f5f7ca64 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,14 +1,37 @@ { - "name": "R Environment", - "build": { - "dockerfile": "Dockerfile" + "image": "ghcr.io/insightsengineering/rstudio:latest", + "name": "RStudio Dev Container", + + // 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": "uname -a", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "REditorSupport.r", + "Ikuyadeu.r", + "quarto-dev.quarto", + "RDebugger.r-debugger" + ], + "settings": { + // Try radian first if available, otherwise fall back to R + "r.rterm.linux": "/usr/local/bin/radian", + "r.rpath.linux": "/usr/bin/R", + "r.alwaysUseActiveTerminal": true, + "r.bracketedPaste": true, + "r.plot.useHttpgd": true + } + } }, - "settings": { - "terminal.integrated.defaultProfile.linux": "bash" - }, - "extensions": [ - "Ikuyadeu.r", // R language support in VS Code - "REditorSupport.r-lsp" // R Language Server - ], - "postCreateCommand": "Rscript -e 'install.packages(c(\"languageserver\"), repos=\"https://cloud.r-project.org\")'" + + // Mount the workspace folder + "workspaceFolder": "/workspace", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind" } From 1e9ae4abd53032ea710f00a0f429e42feec8eaea Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:25:50 +0100 Subject: [PATCH 3/7] Delete .devcontainer/Dockerfile Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- .devcontainer/Dockerfile | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 7021efdd1f..0000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# Use a base image with Ubuntu -FROM mcr.microsoft.com/devcontainers/base:ubuntu - -# Install R -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - r-base \ - r-base-dev \ - && apt-get clean && rm -rf /var/lib/apt/lists/* - -# Set default shell -SHELL ["/bin/bash", "-c"] From 971e481fc8baa7a05b02c38af3dfcd698ce551da Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:57:39 +0100 Subject: [PATCH 4/7] Setup `.devcontainer` and GitHub Copilot agent environment for R development (#1657) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Pull Request Configures development environments to provide consistent R development setup using pre-built Docker images and GitHub Actions. ## Development Container - Uses `ghcr.io/insightsengineering/rstudio:latest` image with R pre-installed - Configures VS Code with R extensions (language support, debugger, Quarto) - Sets up R terminal preferences (radian, httpgd plotting) - Mounts workspace to `/workspace` for consistent paths ## GitHub Copilot Agent Configuration - Adds `.github/copilot-setup-steps.yml` workflow to configure the Copilot agent environment - Uses Docker container with `ghcr.io/insightsengineering/rstudio:latest` image (same as devcontainer) - Verifies R installation with version check and `sessionInfo()` - Ensures R is available when GitHub Copilot agent works on this repository - File must exist in each repository (cannot be referenced from `r.pkg.template` due to GitHub limitations) Enables reproducible development environments without local R installation for both human developers (via devcontainer) and AI agents (via workflow configuration). Both configurations use the same Docker image to ensure consistency. --- ✨ Let Copilot coding agent [set things up for you](https://github.com/insightsengineering/teal/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: m7pr <133694481+m7pr@users.noreply.github.com> --- .github/copilot-setup-steps.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/copilot-setup-steps.yml diff --git a/.github/copilot-setup-steps.yml b/.github/copilot-setup-steps.yml new file mode 100644 index 0000000000..05f24dc1ee --- /dev/null +++ b/.github/copilot-setup-steps.yml @@ -0,0 +1,27 @@ +name: Copilot Agent Setup + +# Configure the environment for GitHub Copilot coding agent +# This ensures R is available when the agent works on this repository +# Uses the same Docker image as the devcontainer for consistency + +on: + pull_request: + workflow_dispatch: + +jobs: + copilot-agent: + runs-on: ubuntu-latest + container: + image: ghcr.io/insightsengineering/rstudio:latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Verify R installation + run: | + R --version + R -e "sessionInfo()" + + # Additional steps for the Copilot agent would be invoked here + # The agent will have access to R in this environment From 0abe8a7c1a587487c8d925f4c7c2a68b9eb66198 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Wed, 17 Dec 2025 16:41:49 +0100 Subject: [PATCH 5/7] Delete .github/copilot-setup-steps.yml Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- .github/copilot-setup-steps.yml | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/copilot-setup-steps.yml diff --git a/.github/copilot-setup-steps.yml b/.github/copilot-setup-steps.yml deleted file mode 100644 index 05f24dc1ee..0000000000 --- a/.github/copilot-setup-steps.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Copilot Agent Setup - -# Configure the environment for GitHub Copilot coding agent -# This ensures R is available when the agent works on this repository -# Uses the same Docker image as the devcontainer for consistency - -on: - pull_request: - workflow_dispatch: - -jobs: - copilot-agent: - runs-on: ubuntu-latest - container: - image: ghcr.io/insightsengineering/rstudio:latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Verify R installation - run: | - R --version - R -e "sessionInfo()" - - # Additional steps for the Copilot agent would be invoked here - # The agent will have access to R in this environment From 6f5dc180a27ff776ebdad1c9895d35b92c5848bd Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 22 Dec 2025 14:04:02 +0100 Subject: [PATCH 6/7] add draw.io, python, pre-commit and air formatter --- .devcontainer/devcontainer.json | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a1f5f7ca64..15bca5bc78 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,13 +3,17 @@ "name": "RStudio Dev Container", // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, + "features": { + "ghcr.io/devcontainers/features/python:1": { + "version": "latest" + } + }, // 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": "uname -a", + "postCreateCommand": "apt-get update && apt-get install -y python3-pip pipx && pipx ensurepath && pipx install pre-commit", // Configure tool-specific properties. "customizations": { @@ -18,7 +22,9 @@ "REditorSupport.r", "Ikuyadeu.r", "quarto-dev.quarto", - "RDebugger.r-debugger" + "RDebugger.r-debugger", + "hediet.vscode-drawio", + "Posit.air-vscode" ], "settings": { // Try radian first if available, otherwise fall back to R From e40754769699ce9b5368bfd70e2142cd2aae52f3 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 22 Dec 2025 14:42:55 +0100 Subject: [PATCH 7/7] add radian installation --- .devcontainer/devcontainer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 15bca5bc78..3cd281a9cc 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,7 +13,7 @@ // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "apt-get update && apt-get install -y python3-pip pipx && pipx ensurepath && pipx install pre-commit", + "postCreateCommand": "apt-get update && apt-get install -y python3-pip pipx && pipx ensurepath && pipx install pre-commit && pip install -U radian && (which radian > /dev/null 2>&1 && ln -sf $(which radian) /usr/local/bin/radian || true)", // Configure tool-specific properties. "customizations": {