mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-02-04 07:51:50 +00:00
add devcontainer+pre-commit (#11328)
* add devcontainer support * chore(devcontainer): install test requirements * chore: add pre-commit * fix format of pre-commit config file * add licenses for the new files * Apply suggestions from code review * move requirements-dev.txt to inside .devcontainer * specify files for ruff * update CONTRIBUTING.md * chore(devcontainer): use standard image, no docker build * docs: format CONTRIBUTING.md (automatic by IDE) * Update .devcontainer/devcontainer.json * remove extraneous edits in CONTRIBUTING.md
This commit is contained in:
parent
b3c066b99f
commit
18c362eef4
7 changed files with 109 additions and 1 deletions
34
.devcontainer/devcontainer.json
Normal file
34
.devcontainer/devcontainer.json
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "community.general devcontainer",
|
||||
"image": "mcr.microsoft.com/devcontainers/python:3.14-bookworm",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
|
||||
},
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash",
|
||||
"python.pythonPath": "/usr/local/bin/python",
|
||||
"editor.defaultFormatter": "charliermarsh.ruff",
|
||||
"editor.formatOnSave": true,
|
||||
"files.autoSave": "afterDelay",
|
||||
"files.eol": "\n",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.trimTrailingWhitespace": true
|
||||
},
|
||||
"extensions": [
|
||||
"charliermarsh.ruff",
|
||||
"ms-python.python",
|
||||
"ms-python.vscode-pylance",
|
||||
"redhat.ansible",
|
||||
"redhat.vscode-yaml",
|
||||
"trond-snekvik.simple-rst",
|
||||
]
|
||||
}
|
||||
},
|
||||
"remoteUser": "vscode",
|
||||
"postCreateCommand": ".devcontainer/setup.sh",
|
||||
"workspaceFolder": "/workspace/ansible_collections/community/general",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace/ansible_collections/community/general,type=bind"
|
||||
}
|
||||
3
.devcontainer/devcontainer.json.license
Normal file
3
.devcontainer/devcontainer.json.license
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https: //www.gnu.org/licenses/gpl-3.0.txt)
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
SPDX-FileCopyrightText: 2025 Alexei Znamensky <russoz@gmail.com>
|
||||
10
.devcontainer/requirements-dev.txt
Normal file
10
.devcontainer/requirements-dev.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# SPDX-FileCopyrightText: 2025 Alexei Znamensky <russoz@gmail.com>
|
||||
|
||||
nox
|
||||
ruff
|
||||
antsibull-nox
|
||||
pre-commit
|
||||
ansible-core
|
||||
andebox
|
||||
16
.devcontainer/setup.sh
Executable file
16
.devcontainer/setup.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright (c) Ansible Project
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
sudo chown -R vscode:vscode /workspace/
|
||||
|
||||
pip install -U pip
|
||||
pip install -r .devcontainer/requirements-dev.txt
|
||||
pip install -r tests/unit/requirements.txt
|
||||
|
||||
export ANSIBLE_COLLECTIONS_PATH=/workspace:${ANSIBLE_COLLECTIONS_PATH}
|
||||
ansible-galaxy collection install -v -r tests/unit/requirements.yml
|
||||
ansible-galaxy collection install -v -r tests/integration/requirements.yml
|
||||
|
||||
pre-commit install
|
||||
Loading…
Add table
Add a link
Reference in a new issue