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
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# See here for image contents: https://github.com/devcontainers/images/tree/main/src/base-ubuntu

# [Choice] Ubuntu version: noble, jammy, focal
ARG VARIANT="jammy"
FROM mcr.microsoft.com/devcontainers/base:${VARIANT}

# [Optional] Uncomment this section to install additional OS packages.
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
# && apt-get -y install --no-install-recommends <your-package-list-here>
12 changes: 12 additions & 0 deletions .devcontainer/apt-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
coreutils
direnv
figlet
findutils
gh
git
links
mawk
minizinc
sed
time
vim
97 changes: 54 additions & 43 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,58 @@
// 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
{
// "build": {
// "dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon.
// "args": { "VARIANT": "ubuntu-22.04" }
// },
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"DavidAnson.vscode-markdownlint",
"GitHub.copilot",
"GitHub.copilot-chat",
"elagil.pre-commit-helper",
"formulahendry.code-runner",
"formulahendry.code-runner-copilot",
"github.vscode-github-actions",
"ms-python.python",
"vscodevim.vim"
],
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
// "ghcr.io/maks1ms/devcontainers-features/wine:0": {},
"ghcr.io/devcontainers-contrib/features/actionlint:1": {},
"ghcr.io/devcontainers-extra/features/pipx-package:1": {},
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/guiyomh/features/vim:0": {},
"ghcr.io/jungaretti/features/ripgrep:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
// 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": "uname -a",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"name": "dotfiles",
// Install dependencies and pre-commit hooks.
"postCreateCommand": "pip install -r .devcontainer/requirements.txt && pre-commit install",
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode"
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "noble"
}
},

// Configure tool-specific properties.
// Note: Keep the list in alphabetical order.
"customizations": {
"vscode": {
"extensions": [
"bierner.markdown-mermaid",
"DavidAnson.vscode-markdownlint",
"GitHub.copilot",
"GitHub.copilot-chat",
"GitHub.vscode-github-actions",
"ms-vscode.vscode-chat-customizations-evaluations",
"vscodevim.vim",
"vsls-contrib.codetour",
"xaver.clang-format"
]
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers-contrib/features/actionlint:1": {},
"ghcr.io/devcontainers-contrib/features/node-asdf:0": {},
"ghcr.io/devcontainers-extra/features/pipx-package:1": {},
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/guiyomh/features/vim:0": {},
"ghcr.io/jungaretti/features/make:1": {},
"ghcr.io/jungaretti/features/ripgrep:1": {},
"ghcr.io/prulloac/devcontainer-features/pre-commit:1": {},
"ghcr.io/sliekens/devcontainer-features/opencode:1": {}
},

// Pre-create host directories so OpenCode can bind-mount persistent config and cache data into the container
"initializeCommand": "mkdir -p \"$HOME/.local/share/opencode\" \"$HOME/.config/opencode\"",

// 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": "uname -a",

// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// "image": "mcr.microsoft.com/devcontainers/base:jammy",

// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
// Note: Python dependencies can be added in the `requirements.txt` file.
"onCreateCommand": "sudo apt-get update && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y ansible && ansible-playbook .devcontainer/provision.yml"
}
51 changes: 51 additions & 0 deletions .devcontainer/provision.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
# Ansible playbook file.
# Usage: ansible-playbook .devcontainer/provision.yml
# Note: Keep keys and lists in alphabetical order.
- name: Provision dev container
hosts: localhost
connection: local
become: true
tasks:
- name: Load apt packages from file
ansible.builtin.set_fact:
apt_packages: >-
{{ lookup('file', playbook_dir + '/apt-packages.txt').splitlines()
| map('trim') | reject('equalto', '') | reject('match', '^#') | list }}
- name: Update apt cache
ansible.builtin.apt:
update_cache: true
- name: Install apt packages
ansible.builtin.apt:
name: '{{ apt_packages }}'
state: present
- name: Install ansible via pipx
ansible.builtin.command: pipx install --include-deps ansible
args:
creates: '{{ ansible_env.HOME }}/.local/bin/ansible'
become: false
- name: Inject ansible python requirements
ansible.builtin.command:
argv:
- pipx
- runpip
- ansible
- install
- -r
- '{{ playbook_dir }}/requirements-ansible.txt'
become: false
register: pipx_runpip
changed_when: "'Successfully installed' in (pipx_runpip.stdout + pipx_runpip.stderr)"
failed_when: pipx_runpip.rc != 0
- name: Install python requirements
ansible.builtin.pip:
requirements: '{{ playbook_dir }}/requirements.txt'
extra_args: --break-system-packages --user
state: present
become: false
- name: Install pre-commit hooks
ansible.builtin.command: pre-commit install
args:
chdir: '{{ playbook_dir }}/..'
creates: .git/hooks/pre-commit
become: false
4 changes: 4 additions & 0 deletions .devcontainer/requirements-ansible.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Python packages injected into the pipx-managed Ansible environment.
# Keep dependencies sorted alphabetically.
docker>=7.1
requests==2.32.5
7 changes: 6 additions & 1 deletion .devcontainer/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Python's requirements
# Usage: pip install -r requirements.txt
# Note: Keep dependencies sorted alphabetically.
ansible
ansible-lint
argcomplete>=1.9.4
docker>=7.1
jinja2-cli
molecule
molecule-docker
pipenv
pre-commit
requests==2.31.0
requests==2.32.5
uv
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
- uses: actions/setup-python@v5
- name: Installs shfmt
run: >
sudo install /dev/stdin /usr/local/bin/shfmt
< <(curl -L "$SHFMT_URL")
curl -fsSL "$SHFMT_URL" | sudo tee /usr/local/bin/shfmt >/dev/null &&
sudo chmod +x /usr/local/bin/shfmt
env:
# yamllint disable rule:line-length
SHFMT_URL: https://github.com/mvdan/sh/releases/download/v3.1.1/shfmt_v3.1.1_linux_amd64
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
# GitHub Copilot cloud agent customization.
# <https://docs.github.com/en/copilot/how-tos/use-copilot-agents/cloud-agent/customize-the-agent-environment>
name: Copilot Setup Steps
env:
# Pin external repositories to specific SHAs for reproducibility.
COGNI_AI_AGENTS_REF: main
COGNI_AI_AGENT_INSTRUCTIONS_REF: main
COGNI_AI_AGENT_SKILLS_REF: main
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
- .devcontainer/requirements.txt
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
- .devcontainer/requirements.txt
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): actions/* versions here are also pinned to non-existent majors.

These actions/* versions (e.g. actions/checkout@v6, actions/setup-python@v6.2.0, possibly actions/cache@v5.0.5) do not exist and will cause the workflow to fail. Please update them to currently published majors (for example actions/checkout@v4, actions/setup-python@v5, actions/cache@v4) and optionally add tighter pinning if deterministic behavior is required.

- name: Clone agents
run: |
git clone --branch "$COGNI_AI_AGENTS_REF" --depth=1 \
https://github.com/Cogni-AI-OU/cogni-ai-agents \
"$HOME/.copilot/agents"
- name: Clone instructions
run: |
git clone --branch "$COGNI_AI_AGENT_INSTRUCTIONS_REF" --depth=1 \
https://github.com/Cogni-AI-OU/cogni-ai-agent-instructions \
"$HOME/.copilot/instructions"
- name: Clone skills
run: |
git clone --branch "$COGNI_AI_AGENT_SKILLS_REF" --depth=1 \
https://github.com/Cogni-AI-OU/cogni-ai-agent-skills \
"$HOME/.copilot/skills"
- uses: actions/setup-python@v6.2.0
with:
cache: >-
${{ hashFiles('.devcontainer/requirements.txt', 'requirements.txt',
'**/pyproject.toml') != '' && 'pip' || '' }}
cache-dependency-path: |
.devcontainer/requirements.txt
requirements.txt
**/pyproject.toml
python-version: '3.12'
- name: Restore Python user site
id: python-user-site
uses: actions/cache@v5.0.5
with:
path: ~/.local
key: ${{ runner.os }}-pip-${{ hashFiles('.devcontainer/requirements.txt') }}
- name: Install Python dependencies
run: |
if [ -f .devcontainer/requirements.txt ]; then
pip install -r .devcontainer/requirements.txt
elif [ -f requirements.txt ]; then
pip install -r requirements.txt
fi
- name: Ensure local bin on PATH
run: echo "$HOME/.local/bin" >> "$GITHUB_PATH"
Loading
Loading