diff --git a/.github/workflows/test-pr.yaml b/.github/workflows/test-pr.yaml index 52b4036..a6bbce7 100644 --- a/.github/workflows/test-pr.yaml +++ b/.github/workflows/test-pr.yaml @@ -12,9 +12,8 @@ jobs: id: filter with: filters: | - color: ./**/color/** - hello: ./**/hello/** scicloj: ./**/scicloj/** + basecloj: ./**/basecloj/** test: diff --git a/.gitignore b/.gitignore index 78a9ceb..779c037 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ src/scicloj/.clj-kondo src/scicloj/poetry.lock src/scicloj/.lsp/ src/scicloj/.devcontainer/.devpod-internal +.clj-kondo/ +.lsp/ + diff --git a/src/basecloj/.devcontainer/Dockerfile b/src/basecloj/.devcontainer/Dockerfile new file mode 100644 index 0000000..bc53fad --- /dev/null +++ b/src/basecloj/.devcontainer/Dockerfile @@ -0,0 +1,31 @@ +FROM clojure:${templateOption:imageTag} + +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Create the user +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + # + # [Optional] Add sudo support. Omit if you don't need to install software after connecting. + && apt-get update \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME + + +# [Optional] Set the default user. Omit if you want to keep the default as root. +USER $USERNAME +SHELL ["/bin/bash", "-ec"] +ENTRYPOINT ["bash"] + + +# Prepare clojure tools +RUN clojure -Ttools list && \ +clojure -Ttools install io.github.seancorfield/clj-new '{:git/tag "v1.2.404" :git/sha "d4a6508"}' :as clj-new && \ +clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new && \ +clojure -Ttools list + +RUN sudo apt-get update && \ + sudo apt-get install -y lsb-release diff --git a/src/basecloj/.devcontainer/devcontainer.json b/src/basecloj/.devcontainer/devcontainer.json new file mode 100644 index 0000000..be0bf81 --- /dev/null +++ b/src/basecloj/.devcontainer/devcontainer.json @@ -0,0 +1,23 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/scicloj/devcontainer-templates/tree/main/src/basecloj +{ + "name": "Base clojure dev env", + "build": { + "dockerfile": "Dockerfile", + "args": { + "USERNAME": "${localEnv:USER}" + } + }, + "remoteUser": "${localEnv:USER}", + "containerUser": "${localEnv:USER}", + "features": { + "ghcr.io/devcontainers/features/git:1": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "betterthantomorrow.calva" + ] + } + } +} diff --git a/src/basecloj/README.md b/src/basecloj/README.md new file mode 100644 index 0000000..8017498 --- /dev/null +++ b/src/basecloj/README.md @@ -0,0 +1,31 @@ + + + +## Options + +| Options Id | Description | Type | Default Value | +|-----|-----|-----|-----| + +>Note: comming soon + +# A minimal devcontainer with JAVA, Clojure and minimal clj tools + +It sets up a minimal dev container environment with green fields minimal tools for Clojure. + +# Quickstart + +0. Install [devcontainer cli](https://github.com/devcontainers/cli) +1. Run `devcontainer templates apply -t ghcr.io/scicloj/devcontainer-templates/basecloj` to create a devcontainer setup + with default settings in your current directoty +2. Open folder with VSCode / devcontainer / devpod / Codespaces and trigger/wait for container build +3. [Start the Calva repl](https://calva.io/getting-started/) + + +4. Create a new app, lib, template and more: + * Read [deps-new](https://github.com/seancorfield/deps-new) + * Read [clj-new docs](https://github.com/seancorfield/clj-new) + +## Customization +5. Install more features in devcontainer: https://containers.dev/features + +--- diff --git a/src/basecloj/devcontainer-template.json b/src/basecloj/devcontainer-template.json new file mode 100644 index 0000000..8134c5c --- /dev/null +++ b/src/basecloj/devcontainer-template.json @@ -0,0 +1,24 @@ +{ + "id": "basecloj", + "version": "1.0.0", + "name": "Base clojure development environment", + "description": "A devcontainer template with the minimum clojure tools and configuration, this template is intended to create new greenfield clojure project that should be further customised on specific project needs. ", + "documentationURL": "https://github.com/scicloj/devcontainer-templates/tree/main/src/basecloj", + "licenseURL": "https://github.com/scicloj/devcontainer-templates/blob/main/LICENSE", + "options": { + "imageTag": { + "type": "string", + "description": "Tag of official Clojure image", + "proposals": [ + "temurin-8-tools-deps-jammy", + "temurin-11-tools-deps-jammy", + "temurin-17-tools-deps-jammy", + "temurin-21-tools-deps-jammy" + ], + "default": "temurin-21-tools-deps-jammy" + } + }, + "platforms": [ + "Any" + ] +} \ No newline at end of file diff --git a/src/color/.devcontainer/devcontainer.json b/src/color/.devcontainer/devcontainer.json deleted file mode 100644 index 0c20573..0000000 --- a/src/color/.devcontainer/devcontainer.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "Favorite color", - "image": "mcr.microsoft.com/devcontainers/base:${templateOption:imageVariant}", - - // 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/features. - // "features": {}, - - // 👇 Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - "postCreateCommand": "echo '${templateOption:favorite}' > /tmp/color.txt" - - // 👇 Configure tool-specific properties. - // "customizations": {}, - - // 👇 Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" -} diff --git a/src/color/README.md b/src/color/README.md deleted file mode 100644 index 82bc5d1..0000000 --- a/src/color/README.md +++ /dev/null @@ -1,17 +0,0 @@ - -# My Favorite Color (color) - -A Template to remind you of your favorite color - -## Options - -| Options Id | Description | Type | Default Value | -|-----|-----|-----|-----| -| imageVariant | Debian version (use bullseye on local arm64/Apple Silicon): | string | bullseye | -| favorite | Choose your favorite color. | string | red | - - - ---- - -_Note: This file was auto-generated from the [devcontainer-template.json](https://github.com/scicloj/devcontainer-templates/blob/main/src/color/devcontainer-template.json). Add additional notes to a `NOTES.md`._ diff --git a/src/color/devcontainer-template.json b/src/color/devcontainer-template.json deleted file mode 100644 index a64d31c..0000000 --- a/src/color/devcontainer-template.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "id": "color", - "version": "1.0.0", - "name": "My Favorite Color", - "description": "A Template to remind you of your favorite color", - "documentationURL": "https://github.com/devcontainers/template-starter/tree/main/src/color", - "licenseURL": "https://github.com/devcontainers/template-starter/blob/main/LICENSE", - "options": { - "imageVariant": { - "type": "string", - "description": "Debian version (use bullseye on local arm64/Apple Silicon):", - "proposals": [ - "bullseye", - "buster" - ], - "default": "bullseye" - }, - "favorite": { - "type": "string", - "description": "Choose your favorite color.", - "proposals": [ - "red", - "gold", - "green" - ], - "default": "red" - } - }, - "platforms": [ - "Any" - ] -} diff --git a/src/hello/.devcontainer/Dockerfile b/src/hello/.devcontainer/Dockerfile deleted file mode 100644 index 9c45c4c..0000000 --- a/src/hello/.devcontainer/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM mcr.microsoft.com/devcontainers/base:${templateOption:imageVariant} - -RUN mkdir -p /usr/local/etc \ - && echo "${templateOption:greeting}" > /usr/local/etc/greeting.txt \ No newline at end of file diff --git a/src/hello/.devcontainer/devcontainer.json b/src/hello/.devcontainer/devcontainer.json deleted file mode 100644 index fc33f83..0000000 --- a/src/hello/.devcontainer/devcontainer.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "Hello, World", - "build": { - "dockerfile": "Dockerfile" - }, - - // 👇 Features to add to the Dev Container. More info: https://containers.dev/implementors/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": "cat /usr/local/etc/greeting.txt" - - // 👇 Configure tool-specific properties. - // "customizations": {}, - - // 👇 Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" -} diff --git a/src/hello/README.md b/src/hello/README.md deleted file mode 100644 index 341ba33..0000000 --- a/src/hello/README.md +++ /dev/null @@ -1,17 +0,0 @@ - -# Hello, World (hello) - -A hello world Template - -## Options - -| Options Id | Description | Type | Default Value | -|-----|-----|-----|-----| -| imageVariant | Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): | string | jammy | -| greeting | Select a pre-made greeting, or enter your own | string | hey | - - - ---- - -_Note: This file was auto-generated from the [devcontainer-template.json](https://github.com/scicloj/devcontainer-templates/blob/main/src/hello/devcontainer-template.json). Add additional notes to a `NOTES.md`._ diff --git a/src/hello/devcontainer-template.json b/src/hello/devcontainer-template.json deleted file mode 100644 index 342c75e..0000000 --- a/src/hello/devcontainer-template.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "id": "hello", - "version": "1.0.0", - "name": "Hello, World", - "description": "A hello world Template", - "documentationURL": "https://github.com/devcontainers/template-starter/tree/main/src/hello", - "licenseURL": "https://github.com/devcontainers/template-starter/blob/main/LICENSE", - "options": { - "imageVariant": { - "type": "string", - "description": "Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon):", - "proposals": [ - "jammy", - "focal", - "bionic" - ], - "default": "jammy" - }, - "greeting": { - "type": "string", - "description": "Select a pre-made greeting, or enter your own", - "proposals": [ - "hey", - "hello", - "hi", - "howdy" - ], - "default": "hey" - } - }, - "platforms": [ - "Any" - ] -} diff --git a/test/basecloj/test.sh b/test/basecloj/test.sh new file mode 100644 index 0000000..93be67c --- /dev/null +++ b/test/basecloj/test.sh @@ -0,0 +1,13 @@ +#!/bin/bash +cd $(dirname "$0") +source test-utils.sh + +# Template specific tests +check "distro" lsb_release -a +check "java_jdk" java --version +check "clojure" clojure --version +check "clj" clj --version +check "user" id + +# Report result +reportResults diff --git a/test/color/test.sh b/test/color/test.sh deleted file mode 100644 index b75ba5b..0000000 --- a/test/color/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -cd $(dirname "$0") -source test-utils.sh - -# Template specific tests -check "distro" lsb_release -c -check "color" [ $(cat /tmp/color.txt | grep red) ] - -# Report result -reportResults diff --git a/test/hello/test.sh b/test/hello/test.sh deleted file mode 100644 index 0428c34..0000000 --- a/test/hello/test.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -cd $(dirname "$0") -source test-utils.sh - -# Template specific tests -check "distro" lsb_release -c -check "greeting" [ $(cat /usr/local/etc/greeting.txt | grep hey) ] - -# Report result -reportResults