diff --git a/.github/.devcontainer/devcontainer-light.json b/.github/.devcontainer/devcontainer-light.json new file mode 100644 index 0000000..e28e417 --- /dev/null +++ b/.github/.devcontainer/devcontainer-light.json @@ -0,0 +1,54 @@ +{ + "name": "Quarto", + "build": { + "dockerfile": "./Dockerfile", + "context": ".", + "args": { + "IMAGE": "${localEnv:IMAGE}" + }, + "options": [ + "--label", "org.opencontainers.image.title=${localEnv:ANNOTATION_TITLE}", + "--annotation", "org.opencontainers.image.title=${localEnv:ANNOTATION_TITLE}", + "--label", "org.opencontainers.image.description=${localEnv:ANNOTATION_DESCRIPTION}", + "--annotation", "org.opencontainers.image.description=${localEnv:ANNOTATION_DESCRIPTION}", + "--label", "org.opencontainers.image.authors=${localEnv:ANNOTATION_AUTHORS}", + "--annotation", "org.opencontainers.image.authors=${localEnv:ANNOTATION_AUTHORS}", + "--label", "org.opencontainers.image.url=${localEnv:ANNOTATION_URL}", + "--annotation", "org.opencontainers.image.url=${localEnv:ANNOTATION_URL}", + "--label", "org.opencontainers.image.source=${localEnv:ANNOTATION_URL}", + "--annotation", "org.opencontainers.image.source=${localEnv:ANNOTATION_URL}", + "--label", "org.opencontainers.image.version=${localEnv:ANNOTATION_VERSION}", + "--annotation", "org.opencontainers.image.version=${localEnv:ANNOTATION_VERSION}", + "--label", "org.opencontainers.image.licenses=${localEnv:ANNOTATION_LICENSE}", + "--annotation", "org.opencontainers.image.licenses=${localEnv:ANNOTATION_LICENSE}" + ] + }, + "remoteUser": "${localEnv:USER}", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "${localEnv:USER}", + // "userUid": "1000", + // "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": "false" + }, + "./quarto-computing-dependencies": { + "installOnPlatforms": "amd64", + "rDeps": "false", + "pythonDeps": "false", + "juliaDeps": "false" + }, + "./uv": { + "version": "latest" + }, + "ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": { + "version": "${localEnv:QUARTO_VERSION}", + "installTinyTex": "false", + "installChromium": "false" + } + } +} diff --git a/.github/.devcontainer/quarto-computing-dependencies/install.sh b/.github/.devcontainer/quarto-computing-dependencies/install.sh index d00dd04..f99fb7b 100755 --- a/.github/.devcontainer/quarto-computing-dependencies/install.sh +++ b/.github/.devcontainer/quarto-computing-dependencies/install.sh @@ -42,18 +42,27 @@ fi quarto_r_deps() { local deps=$1 + if [ "${deps}" = "false" ]; then + return + fi deps=$(echo "${deps}" | sed 's/,/","/g') su "${USERNAME}" -c "Rscript -e 'pak::pkg_install(c(\"${deps}\"))'" } quarto_python_deps() { local deps=$1 + if [ "${deps}" = "false" ]; then + return + fi deps=$(echo "${deps}" | sed 's/,/ /g') python3 -m pip install ${deps} } quarto_julia_deps() { local deps=$1 + if [ "${deps}" = "false" ]; then + return + fi deps=$(echo "${deps}" | sed 's/,/","/g') su "${USERNAME}" -c "~/.juliaup/bin/julia -e 'using Pkg; Pkg.add.([\"${deps}\"])'" } diff --git a/.github/workflows/devcontainer.yml b/.github/workflows/devcontainer.yml index 9576f12..8af878c 100644 --- a/.github/workflows/devcontainer.yml +++ b/.github/workflows/devcontainer.yml @@ -32,8 +32,16 @@ jobs: include: - QUARTO_VERSION: release IMAGE_TAG: release,release-jammy,latest + CONFIG_FILE: .devcontainer/devcontainer.json - QUARTO_VERSION: prerelease IMAGE_TAG: prerelease,prerelease-jammy + CONFIG_FILE: .devcontainer/devcontainer.json + - QUARTO_VERSION: release + IMAGE_TAG: release-light,release-light-jammy + CONFIG_FILE: .devcontainer/devcontainer-light.json + - QUARTO_VERSION: prerelease + IMAGE_TAG: prerelease-light,prerelease-light-jammy + CONFIG_FILE: .devcontainer/devcontainer-light.json steps: - name: Checkout code uses: actions/checkout@v4 @@ -68,6 +76,7 @@ jobs: eventFilterForPush: "release" platform: linux/amd64 runCmd: echo "$(CI=true quarto check 2>&1)" | sed '/^(/d; s/\x1b\[[0-9;]*[mGK]//g' + configFile: ${{ matrix.CONFIG_FILE }} env: IMAGE: "buildpack-deps:jammy-curl" QUARTO_VERSION: ${{ matrix.QUARTO_VERSION }} @@ -80,14 +89,14 @@ jobs: ANNOTATION_LICENSE: "MIT" - name: Test Dev Container env: - QUARTO_VERSION: ${{ matrix.QUARTO_VERSION }} + IMAGE_TAG: ${{ matrix.IMAGE_TAG }} DEVCONTAINER_RUN_CMD: ${{ steps.devcontainer-ci.outputs.runCmdOutput }} run: | echo "::group::Quarto Check" echo "${DEVCONTAINER_RUN_CMD}" echo "::endgroup::" - echo "## Quarto Check Results: ${QUARTO_VERSION}" >>$GITHUB_STEP_SUMMARY + echo "## Quarto Check Results: ${IMAGE_TAG}" >>$GITHUB_STEP_SUMMARY echo "
Quarto Check Results" >>$GITHUB_STEP_SUMMARY echo "" >>$GITHUB_STEP_SUMMARY echo '```txt' >>$GITHUB_STEP_SUMMARY diff --git a/init-env.sh b/init-env.sh index aa7674d..b3f6d1b 100755 --- a/init-env.sh +++ b/init-env.sh @@ -18,6 +18,7 @@ initialise_r() { if [ -f ".Rprofile" ] && grep -q 'source("renv/activate.R")' .Rprofile; then sed -i '' '/source("renv\/activate.R")/d' .Rprofile fi + Rscript -e 'if (!requireNamespace("renv", quietly = TRUE)) pak::pkg_install("renv")' Rscript -e 'renv::init(bare = FALSE)' Rscript -e "renv::install(c('${deps}'))" Rscript -e 'renv::snapshot(type = "all")'