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
41 changes: 27 additions & 14 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
// For format details, see https://containers.dev/implementors/json_reference/
{
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bookworm",
"name": "Python 3 Developer Container",
"build": {
"dockerfile": "../Dockerfile",
"target": "developer"
},
"customizations": {
"vscode": {
// Set *default* container specific settings.json values on container create.
"settings": {
"json.schemas": [
{
"fileMatch": [
"*/devcontainer-feature.json"
],
"url": "https://github.com/devcontainers/spec/main/schemas/devContainerFeature.schema.json"
}
]
"python.defaultInterpreterPath": "/venv/bin/python"
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"mads-hartmann.bash-ide-vscode"
"ms-python.python",
"github.vscode-github-actions",
"tamasfe.even-better-toml",
"redhat.vscode-yaml",
"ryanluker.vscode-coverage-gutters",
"charliermarsh.ruff",
"ms-azuretools.vscode-docker"
]
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
"./features/terminalhistory": {}
},
"remoteUser": "node",
"updateContentCommand": "npm install -g @devcontainers/cli"
}
"runArgs": [
// Allow the container to access the host X11 display and EPICS CA
"--net=host",
// Make sure SELinux does not disable with access to host filesystems like tmp
"--security-opt=label=disable"
],
// Mount the parent as /workspaces so we can pip install peers as editable
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind",
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/devcontainer_rc"
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ cat > /usr/local/bin/color \
echo "my favorite color is ${FAVORITE}"
EOF

chmod +x /usr/local/bin/color
chmod +x /usr/local/bin/color
18 changes: 18 additions & 0 deletions .devcontainer/features/terminalhistory/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "BASH terminal auto history configuration",
"id": "bashconfig",
"version": "1.0.0",
"description": "Make default BASH terminal nicer",
"containerEnv": {
"CONFIG_FOLDER": "/devcontainer_rc",
"CONFIG_STAGING": "/devcontainer_staging"
},
"mounts": [
{
"source": "${localEnv:HOME}/.config/devcontainer_rc",
"target": "/devcontainer_rc",
"type": "bind"
}
],
"onCreateCommand": "bash /devcontainer_staging/onCreateCommand.sh"
}
66 changes: 66 additions & 0 deletions .devcontainer/features/terminalhistory/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

mkdir -p $CONFIG_STAGING

# -------------------------------------------------------------------------------
cat > $CONFIG_STAGING/onCreateCommand.sh \
<< EOF
#!/bin/bash

# copy in the opinionated default settings from the feature
cp $CONFIG_STAGING/feature_settings_rc $CONFIG_FOLDER/feature_settings_rc

# copy in the user editable settings unless they already exist
if [[ ! -f $CONFIG_FOLDER/bashrc ]] ; then
cp $CONFIG_STAGING/bashrc $CONFIG_FOLDER
cp $CONFIG_STAGING/inputrc $CONFIG_FOLDER
fi

# hook in the config to the root account
ln -s $CONFIG_FOLDER/inputrc /root/.inputrc
echo "source $CONFIG_FOLDER/bashrc" >> /root/.bashrc
EOF

# -------------------------------------------------------------------------------
cat > $CONFIG_STAGING/inputrc \
<< EOF
# Readline configuration for bash shell.

# Incremental history searching with up and down arrows (C-P and C-N for old
# style navigation).
"\e[A": history-search-backward
"\e[B": history-search-forward

# Control left and right for word movement
"\e[5C": forward-word
"\e[5D": backward-word
EOF

# -------------------------------------------------------------------------------
cat > $CONFIG_STAGING/bashrc \
<< EOF
#!/bin/bash

# execute default opinionated settings - delete this line to remove defaults
source $CONFIG_FOLDER/feature_settings_rc

# add your personal custom settings below
EOF

# -------------------------------------------------------------------------------
cat > $CONFIG_STAGING/feature_settings_rc \
<< EOF
#!/bin/bash

# default opinioned bash configuration

# set the prompt
export PS1="\[\033[1;34m\]\W \[\033[0m\]# "

# enable enternal shared history
export HISTCONTROL=ignoreboth:erasedups
export HISTFILESIZE=-1
export SAVEHIST=-1
export HISTFILE=$CONFIG_FOLDER/.bash_eternal_history
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
EOF
44 changes: 22 additions & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create PR for Documentation
id: push_image_info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
echo "Start."
# Configure git and Push updates
git config --global user.email github-actions[bot]@users.noreply.github.com
git config --global user.name github-actions[bot]
git config pull.rebase false
branch=automated-documentation-update-$GITHUB_RUN_ID
git checkout -b $branch
message='Automated documentation update'
# Add / update and commit
git add */**/README.md
git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true
# Push
if [ "$NO_UPDATES" != "true" ] ; then
git push origin "$branch"
gh pr create --title "$message" --body "$message"
fi
# - name: Create PR for Documentation
# id: push_image_info
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# set -e
# echo "Start."
# # Configure git and Push updates
# git config --global user.email github-actions[bot]@users.noreply.github.com
# git config --global user.name github-actions[bot]
# git config pull.rebase false
# branch=automated-documentation-update-$GITHUB_RUN_ID
# git checkout -b $branch
# message='Automated documentation update'
# # Add / update and commit
# git add */**/README.md
# git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true
# # Push
# if [ "$NO_UPDATES" != "true" ] ; then
# git push origin "$branch"
# gh pr create --title "$message" --body "$message"
# fi
66 changes: 33 additions & 33 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,46 +13,46 @@ jobs:
strategy:
matrix:
features:
- color
- hello
- terminal-history
baseImage:
- debian:latest
- ubuntu:latest
- mcr.microsoft.com/devcontainers/base:ubuntu
steps:
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

run: |
npm install -g @devcontainers/cli
mkdir -p ~/.config/devcontainer_rc

- name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'"
run: devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }} .

test-scenarios:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
features:
- color
- hello
steps:
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

- name: "Generating tests for '${{ matrix.features }}' scenarios"
run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated --skip-duplicated .

test-global:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

- name: "Testing global scenarios"
run: devcontainer features test --global-scenarios-only .
# test-scenarios:
# runs-on: ubuntu-latest
# continue-on-error: true
# strategy:
# matrix:
# features:
# - color
# - hello
# steps:
# - uses: actions/checkout@v4
#
# - name: "Install latest devcontainer CLI"
# run: npm install -g @devcontainers/cli
#
# - name: "Generating tests for '${{ matrix.features }}' scenarios"
# run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated --skip-duplicated .
#
# test-global:
# runs-on: ubuntu-latest
# continue-on-error: true
# steps:
# - uses: actions/checkout@v4
#
# - name: "Install latest devcontainer CLI"
# run: npm install -g @devcontainers/cli
#
# - name: "Testing global scenarios"
# run: devcontainer features test --global-scenarios-only .
1 change: 0 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: "Validate devcontainer-feature.json files"
on:
workflow_dispatch:
pull_request:

jobs:
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# The devcontainer should use the developer target and run as root with podman
# or docker with user namespaces.
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION} AS developer

# Set up a virtual environment and put it in PATH
RUN python -m venv /venv
ENV PATH=/venv/bin:$PATH
1 change: 1 addition & 0 deletions src
26 changes: 0 additions & 26 deletions src/color/README.md

This file was deleted.

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

This file was deleted.

22 changes: 0 additions & 22 deletions src/hello/devcontainer-feature.json

This file was deleted.

Loading