Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
vogelino committed Mar 15, 2024
2 parents 17788fe + 3ecd2c6 commit 1c157e9
Show file tree
Hide file tree
Showing 49 changed files with 9,170 additions and 10 deletions.
55 changes: 55 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"projectName": "media-impact-monitor-website",
"projectOwner": "SocialChangeLab",
"repoType": "github",
"repoHost": "https://github.com",
"files": [
"README.md"
],
"imageSize": 64,
"commit": false,
"commitConvention": "angular",
"contributors": [
{
"login": "vogelino",
"name": "Lucas Vogel",
"avatar_url": "https://avatars.githubusercontent.com/u/2759340?v=4",
"profile": "https://github.com/vogelino",
"contributions": [
"code",
"design",
"doc",
"projectManagement"
]
},
{
"login": "davidpomerenke",
"name": "David Pomerenke",
"avatar_url": "https://avatars.githubusercontent.com/u/46022183?v=4",
"profile": "https://github.com/davidpomerenke",
"contributions": [
"code",
"content",
"data",
"doc",
"projectManagement",
"research"
]
},
{
"login": "kleinlennart",
"name": "Lennart Klein",
"avatar_url": "https://avatars.githubusercontent.com/u/31488915?v=4",
"profile": "https://www.kleinbutsignificant.com/",
"contributions": [
"code",
"data",
"doc",
"projectManagement",
"research"
]
}
],
"contributorsPerLine": 10,
"linkToUsage": true
}
3 changes: 3 additions & 0 deletions .devcontainer/R/.Renviron
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Global .Renviron

RENV_PATHS_CACHE="/renv/cache"
6 changes: 6 additions & 0 deletions .devcontainer/R/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Copy to '/home/vscode/.Rprofile' in postCreateCommand.sh

cat("Loading global R presets from '/home/vscode/.Rprofile'....\n")

setwd("/workspaces/media-impact-monitor/backend-R")
renv::load(project = "/workspaces/media-impact-monitor/backend-R")
3 changes: 3 additions & 0 deletions .devcontainer/R/addins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"styler::style_active_file": "Shift+Cmd+F"
}
2 changes: 2 additions & 0 deletions .devcontainer/R/r.snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
snippet tidy
library(tidyverse)
10 changes: 10 additions & 0 deletions .devcontainer/R/rstudio-prefs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"always_save_history": false,
"save_workspace": "never",
"load_workspace": false,
"initial_working_directory": "/workspaces/media-impact-monitor/backend-R",
"restore_last_project": true,
"jobs_tab_visibility": "shown",
"rainbow_parentheses": true,
"auto_append_newline": true
}
147 changes: 147 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
// Web Dev Stack –--------------------------------------------------------

// https://github.com/devcontainers/features/tree/main/src/node
"ghcr.io/devcontainers/features/node:1": {
"version": "lts" // Node.js version
},

"ghcr.io/devcontainers/features/azure-cli:1": { },
"ghcr.io/stuartleeks/dev-container-features/azure-cli-persistence:0": { },
"ghcr.io/dhoeric/features/google-cloud-cli:1": { },
"ghcr.io/joshuanianji/devcontainer-features/gcloud-cli-persistence:1": { },

// Python Stack –--------------------------------------------------------

"ghcr.io/devcontainers/features/python:1": {
"installTools": true,
"version": "3.10"
},
"ghcr.io/devcontainers-contrib/features/poetry:2": { },
"ghcr.io/nikobockerman/devcontainer-features/poetry-persistent-cache:1": { },
"ghcr.io/devcontainers-contrib/features/ruff:1": { },
"ghcr.io/devcontainers-contrib/features/starship:1": { },

// R Stack –--------------------------------------------------------

// System dependencies
// "ghcr.io/devcontainers-contrib/features/apt-get-packages:1": {
// "packages": "libfribidi-dev,libharfbuzz-dev,cmake"
// },

// https://github.com/rocker-org/devcontainer-features/tree/main/src/r-apt
// NOTE: always installs the latest R Version (not fixed!)
"ghcr.io/rocker-org/devcontainer-features/r-apt:0": {
"vscodeRSupport": "full",
"installDevTools": true, // for debugging
"installREnv": false, // -> install with renv cache feature
"installRMarkdown": false, // needed?
"installJupyterlab": false,
"installRadian": true, // better R console
"installVscDebugger": true,
"useTesting": true, // for Debian, default: true
"installBspm": false
},
// https://github.com/rocker-org/devcontainer-features/tree/main/src/rstudio-server
"ghcr.io/rocker-org/devcontainer-features/rstudio-server:0": {
"singleUser": true,
"version": "stable"
},
// https://github.com/rocker-org/devcontainer-features/tree/main/src/quarto-cli
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
"installTinyTex": false,
"installChromium": false // https://github.com/rocker-org/devcontainer-features/tree/main/src/quarto-cli#install-chromium
},
// https://github.com/rocker-org/devcontainer-features/tree/main/src/renv-cache
"ghcr.io/rocker-org/devcontainer-features/renv-cache:0": { },

// Misc –-----------------------------------------------------------------------------------

"ghcr.io/stuartleeks/dev-container-features/shell-history:0": { },
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers-contrib/features/act:1": {},
"ghcr.io/devcontainers/features/terraform:1": {}
},
// Ports & Server ----------------------------------------------------------------------------
// start RStudio Server process in container, not needed automatically
// "postAttachCommand": {
// "rstudio-start": "rserver"
// },
// https://containers.dev/implementors/json_reference/#port-attributes
"forwardPorts": [
8787
],
"portsAttributes": {
"8787": {
"label": "RStudio IDE",
"requireLocalPort": true, // defaults to false
"onAutoForward": "ignore" // defaults to notify
}
},
// Lifecycle Scripts ----------------------------------------------------------------------------
// https://containers.dev/implementors/json_reference/#lifecycle-scripts
// run after the container is created.
"postCreateCommand": "sh ./.devcontainer/postCreateCommand.sh",
// run every time the container starts
"postStartCommand": "sh ./.devcontainer/postStartCommand.sh",
// Configure tool-specific properties
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}/",
"customizations": {
"vscode": {
"extensions": [
// General
"eamodio.gitlens",
"mhutchie.git-graph",
"knisterpeter.vscode-commitizen",
"github.vscode-github-actions",
"ms-vscode-remote.vscode-remote-extensionpack",
"ms-vsliveshare.vsliveshare",
"github.copilot",
"github.copilot-chat",
"visualstudioexptteam.vscodeintellicode",
"hashicorp.terraform",
// R
"quarto.quarto",
"REditorSupport.r",
// Python
"ms-python.python",
"ms-toolsai.jupyter",
"charliermarsh.ruff",
"tamasfe.even-better-toml"
],
// "codespaces": {
// "openFiles": [ "README.md" ]
// },
"settings": {
"editor.codeActionsOnSave": {
"source.fixAll": "always",
"source.organizeImports": "always"
},
"editor.formatOnSave": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff"
},
"[toml]": {
"editor.formatOnSave": false
},
"editor.rulers": [
100
],
"files.autoSave": "onFocusChange",
"mypy-type-checker.importStrategy": "fromEnvironment",
"python.defaultInterpreterPath": "/opt/greenwashing-env/bin/python",
"python.terminal.activateEnvironment": false,
"python.testing.pytestEnabled": true,
"ruff.importStrategy": "fromEnvironment"
}
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
51 changes: 51 additions & 0 deletions .devcontainer/postCreateCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/bash
## postCreateCommand.sh

## Node Startup
# https://github.com/devcontainers/features/tree/main/src/node#using-nvm-from-postcreatecommand-or-another-lifecycle-command
# . ${NVM_DIR}/nvm.sh && nvm install --lts

## R ------------------------------------

## R system dependencies
sudo apt-get update
sudo apt-get install -y \
cmake

## tidyverse dependencies (from https://packagemanager.posit.co/client/#/repos/cran/packages/overview?search=tidyverse)
sudo apt-get install -y \
libicu-dev \
make \
libcurl4-openssl-dev \
libssl-dev \
zlib1g-dev \
libfontconfig1-dev \
libfreetype6-dev \
libfribidi-dev \
libharfbuzz-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
pandoc \
libxml2-dev

## setup R env prefs
# ~ = /home/vscode/ for Codespaces
cp /workspaces/media-impact-monitor/.devcontainer/R/.Rprofile ~/.Rprofile
cp /workspaces/media-impact-monitor/.devcontainer/R/.Renviron ~/.Renviron

# https://docs.rstudio.com/ide/server-pro/session-user-settings.html
cp /workspaces/media-impact-monitor/.devcontainer/R/rstudio-prefs.json ~/.config/rstudio/rstudio-prefs.json

mkdir -p ~/.config/rstudio/keybindings
cp /workspaces/media-impact-monitor/.devcontainer/R/addins.json ~/.config/rstudio/keybindings/addins.json
mkdir -p ~/.config/rstudio/snippets
cp /workspaces/media-impact-monitor/.devcontainer/R/r.snippets ~/.config/rstudio/snippets/r.snippets

## Restore renv library from lockfile
Rscript -e 'renv::restore(project = "/workspaces/media-impact-monitor/backend-R")'

####

echo 'eval "$(starship init bash)"' >> ~/.bashrc
cd backend-python && poetry install # install everything once at setup
5 changes: 5 additions & 0 deletions .devcontainer/postStartCommand.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/bash
## postStartCommand.sh

cd backend-python && poetry install # install changed packages
# bash
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
Loading

0 comments on commit 1c157e9

Please sign in to comment.