Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codespaces] Launch Configurations #8412

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
120 changes: 112 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,126 @@
{
"name": "moto",
"image": "mcr.microsoft.com/devcontainers/python:0-3.11",
"remoteUser": "root",
"image": "mcr.microsoft.com/devcontainers/python:3.11",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"portsAttributes": {
"5000": {
"onAutoForward": "silent",
"elevateIfNeeded": true,
"protocol": "http",
"requireLocalPort": false
}
},
"postCreateCommand": "python -m venv .venv",
"postStartCommand": ". .venv/bin/activate && make init",
"customizations": {
"vscode": {
"extensions": ["ms-vscode.makefile-tools", "ms-python.python", "ms-python.black-formatter"],
"extensions": [
"ms-vscode.makefile-tools",
"ms-python.python",
"ms-python.black-formatter"
],
"settings": {
"editor.formatOnSave": true,
"python.defaultInterpreterPath": "${workspaceFolder}/.venv",
"python.formatting.provider": "none",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
},
"tasks": {
"version": "2.0.0",
"tasks": [
{
"label": "Open Port 5000",
"type": "shell",
"command": "bash",
"args": [
"-c",
"until gh codespace ports visibility 5000:public --codespace ${CODESPACE_NAME} 2>/dev/null; do sleep 1; done"
],
"presentation": {
"reveal": "silent",
"focus": false
}
},
{
"label": "Kill MotoServer",
"type": "shell",
"command": "pkill -f '${workspaceFolder}/moto/server.py'",
"problemMatcher": [],
"presentation": {
"reveal": "silent",
"focus": false
}
}
]
},
"launch": {
"version": "0.2.0",
"configurations": [
{
"name": "Run MotoServer",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/moto/server.py",
"args": [
"--reload"
],
"console": "internalConsole",
"presentation": {
"order": 11
}
},
{
"name": "Run MotoServer Tests",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"console": "integratedTerminal",
"preLaunchTask": "Open Port 5000",
"postDebugTask": "Kill MotoServer",
"env": {
"TEST_SERVER_MODE": "true",
"TEST_SERVER_MODE_ENDPOINT": "https://${env:CODESPACE_NAME}-5000.${env:GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN}"
},
"presentation": {
"order": 12
},
"args": [
"-sv",
"--cov=moto",
"--cov-report=xml",
"${workspaceFolder}/tests/",
"-k",
"${input:pytestFilter}"
]
}
],
"inputs": [
{
"id": "pytestFilter",
"type": "promptString",
"description": "pytest -k filter (leave empty to run all tests)",
"default": ""
}
],
"compounds": [
{
"name": "MotoServer Tests",
"configurations": [
"Run MotoServer Tests",
"Run MotoServer"
],
"presentation": {
"order": 1
},
"stopAll": true
}
]
}
}
}
},
"postCreateCommand": "python -m venv .venv",
"postStartCommand": ". .venv/bin/activate && make init"
}
}
}
Loading