Skip to content

Commit

Permalink
Refactor: Enhance CI workflow by skipping config packages during endp…
Browse files Browse the repository at this point in the history
…oint tests; update Flake8 configuration and linting scripts
  • Loading branch information
Luisotee committed Jan 22, 2025
1 parent 26b7f45 commit b5080b0
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 21 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/stacks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,15 @@ jobs:
- name: Test endpoints
run: |
while IFS= read -r dir; do
service_name=$(basename "$dir")
echo "Testing endpoints for $dir"
service_name=$(basename "$dir")
# Skip config packages
if [[ "$service_name" == *"config"* ]]; then
echo "Skipping config package: $service_name"
continue
fi
port=$(bun run @eda/config getPorts $service_name)
if [ -z "$port" ]; then
Expand Down
4 changes: 3 additions & 1 deletion apps/ai_api/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ hang-closing = True
# E133 - closing bracket is missing indentation (conflicts with black)
# E203 - whitespace before ‘:’ (conflicts with black)
# W503 - line break before binary operator
# W504 - line break after binary operator
# F401 - module imported but unused
# F403 - ‘from module import *’ used; unable to detect undefined names
#
Expand All @@ -95,7 +96,8 @@ hang-closing = True
ignore =
E133,
E203,
W503
W503,
W504
# Specify the list of error codes you wish Flake8 to report.
select =
E,
Expand Down
9 changes: 4 additions & 5 deletions apps/ai_api/eda_ai_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ def run_server() -> None:

# Use localhost for development, configure via config for production
host = "127.0.0.1" # Default to localhost
if (
allow_external = (
hasattr(config.services.ai_api, "allow_external")
and config.services.ai_api.allow_external
):
)
if allow_external:
host = "0.0.0.0" # nosec B104 # Explicitly allowed in config

uvicorn.run(
"eda_ai_api.main:app", host=host, port=config.ports.ai_api, reload=True
)
uvicorn.run("eda_ai_api.main:app", host=host, port=config.ports.ai_api, reload=True)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion apps/ai_api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"scripts": {
"dev": "uv run python -m eda_ai_api.main",
"start": "uv run python -m eda_ai_api.main",
"lint": "bash ./scripts/linting.sh",
"lint": "uvx flake8 eda_ai_api --config=setup.cfg",
"test": "bash ./scripts/test.sh"
}
}
6 changes: 6 additions & 0 deletions apps/ai_api/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ branch = True

[coverage:report]
precision = 2

[flake8]
ignore = E133,E203,W503,W504
max-line-length = 100
extend-ignore = W503
per-file-ignores = __init__.py:F401
2 changes: 1 addition & 1 deletion apps/messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "bun run dist/index.js",
"test": "bun test",
"clean": "rm -rf .turbo node_modules dist",
"lint": "biome lint",
"lint": "biome lint ./src",
"format": "biome format --write .",
"typecheck": "tsc-files --noEmit"
},
Expand Down
28 changes: 16 additions & 12 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,26 @@
"enabled": true
},
"files": {
"ignore": ["src/components/ui"]
"ignore": [
"src/components/ui",
"**/dist/**",
"dist",
"**/dist",
"apps/messaging/dist"
],
"maxSize": 3145728
},
"linter": {
"ignore": ["node_modules", ".next", "packages/tsconfig"],
"ignore": [
"node_modules",
".next",
"packages/tsconfig",
"**/dist/**",
"dist"
],
"enabled": true,
"rules": {
"recommended": true,
"a11y": {
"noSvgWithoutTitle": "off"
},
"style": {
"noNonNullAssertion": "off"
},
"correctness": {
"useExhaustiveDependencies": "off"
}
"recommended": true
}
},
"formatter": {
Expand Down

0 comments on commit b5080b0

Please sign in to comment.