Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/smoke-test/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pushd "${SRC_DIR}"
# Configure templates only if `devcontainer-template.json` contains the `options` property.
OPTION_PROPERTY=( $(jq -r '.options' devcontainer-template.json) )

if [ "${OPTION_PROPERTY}" != "" ] && [ "${OPTION_PROPERTY}" != "null" ] ; then
if [ "${OPTION_PROPERTY}" != "" ] && [ "${OPTION_PROPERTY}" != "null" ] ; then
OPTIONS=( $(jq -r '.options | keys[]' devcontainer-template.json) )

if [ "${OPTIONS[0]}" != "" ] && [ "${OPTIONS[0]}" != "null" ] ; then
Expand Down
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Describe your changes

Briefly describe the feature being introduced.

## Checklist before requesting a review
- [ ] I have performed a self-review of my code
- [ ] If it is a core feature, I have added thorough tests.
3 changes: 1 addition & 2 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ jobs:
id: filter
with:
filters: |
color: ./**/color/**
hello: ./**/hello/**
nix-dood: ./**/nix-dood/**

test:
needs: [detect-changes]
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CONTAINERID ?= $(shell bash -c 'read -p "Dev Container ID: " dci; echo $$dci')

build:
./.github/actions/smoke-test/build.sh $(CONTAINERID)

run-tests:
./.github/actions/smoke-test/test.sh $(CONTAINERID)
18 changes: 0 additions & 18 deletions src/color/.devcontainer/devcontainer.json

This file was deleted.

17 changes: 0 additions & 17 deletions src/color/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions src/color/devcontainer-template.json

This file was deleted.

4 changes: 0 additions & 4 deletions src/hello/.devcontainer/Dockerfile

This file was deleted.

21 changes: 0 additions & 21 deletions src/hello/.devcontainer/devcontainer.json

This file was deleted.

17 changes: 0 additions & 17 deletions src/hello/README.md

This file was deleted.

34 changes: 0 additions & 34 deletions src/hello/devcontainer-template.json

This file was deleted.

6 changes: 6 additions & 0 deletions src/nix-dood/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM ghcr.io/xtruder/nix-devcontainer:v1

RUN echo "${templateOption:greeting}" > ~/greeting.txt

# cache /nix
VOLUME /nix
23 changes: 23 additions & 0 deletions src/nix-dood/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "feenx-nix-dood",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},

"userEnvProbe": "loginShell",
"postCreateCommand": "cat ~/greeting.txt",

"customizations": {
"vscode": {
"extensions": [
"ms-azuretools.vscode-docker",
"arrterian.nix-env-selector"
]
}
},

"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
}
}
23 changes: 23 additions & 0 deletions src/nix-dood/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": "nix-dood",
"version": "1.0.0",
"name": "Nix with Docker outside of Docker",
"description": "A Template to use nix flakes and the devcontainer's docker host access.",
"documentationURL": "https://github.com/feenx-lab/feenx-devcontainers/tree/main/src/nix-dood",
"licenseURL": "https://github.com/feenx-lab/feenx-devcontainers/blob/main/LICENSE",
"options": {
"greeting": {
"type": "string",
"description": "Select a pre-made greeting, or enter your own",
"proposals": [
"Welcome to your declarative, Nix-powered, dev environment setup.",
"Dev environment ready.",
"Autobots assemble!"
],
"default": "Welcome to your declarative, Nix-powered, dev environment setup."
}
},
"platforms": [
"Any"
]
}
10 changes: 0 additions & 10 deletions test/hello/test.sh

This file was deleted.

2 changes: 1 addition & 1 deletion test/color/test.sh → test/nix-dood/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source test-utils.sh

# Template specific tests
check "distro" lsb_release -c
check "color" [ $(cat /tmp/color.txt | grep red) ]
check "greeting" [ $(cat /home/code/greeting.txt | grep dev) ]

# Report result
reportResults
4 changes: 2 additions & 2 deletions test/test-utils/test-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ check() {
LABEL=$1
shift
echo -e "\n🧪 Testing $LABEL"
if "$@"; then
if [ -n "$*" ]; then
echo "✅ Passed!"
return 0
else
Expand All @@ -25,7 +25,7 @@ reportResults() {
if [ ${#FAILED[@]} -ne 0 ]; then
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
exit 1
else
else
echo -e "\n💯 All passed!"
exit 0
fi
Expand Down