Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
match naming conventions;add import app
Browse files Browse the repository at this point in the history
  • Loading branch information
aplybeah committed Jun 26, 2024
1 parent b2dfe45 commit bc4553f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci-analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ jobs:
- name: Run tests
run: make test-audit

- name: Export GitHub data
run: make gh-data-export
# Both of these tasks are looking for github and slack auth
# - name: Export GitHub data
# run: make gh-data-export

- name: Run reports
run: make sprint-reports
# - name: Run reports
# run: make sprint-reports

vulnerability-scans:
name: Run Analytics Vulnerability Scans
Expand Down
8 changes: 3 additions & 5 deletions analytics/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,10 @@ sprint-data-export:
--project $(SPRINT_PROJECT) \
--output-file $(SPRINT_FILE)

# Import file data to database
# Takes sprint and issue and puts it in database
sprint-db-data-import:
@echo "=> Importing project data to the database"
gh-db-data-import:
@echo "=> Importing sprint data to the database"
@echo "====================================================="
$(POETRY) analytics export db_export \
$(POETRY) analytics import db_import \
--sprint-file $(SPRINT_FILE) \
--issue-file $(ISSUE_FILE)

Expand Down
8 changes: 5 additions & 3 deletions analytics/src/analytics/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
# instantiate sub-commands for exporting data and calculating metrics
export_app = typer.Typer()
metrics_app = typer.Typer()
import_app = typer.Typer()
# add sub-commands to main entrypoint
app.add_typer(export_app, name="export", help="Export data needed to calculate metrics")
app.add_typer(metrics_app, name="calculate", help="Calculate key project metrics")
app.add_typer(import_app, name="import", help="Import data into the database")


@app.callback()
Expand Down Expand Up @@ -126,7 +128,7 @@ def calculate_sprint_burnup(
)


@export_app.command(name="test_connection")
@import_app.command(name="test_connection")
def test_connection() -> None:
"""Test function that ensures the DB connection works."""
engine = db.get_db()
Expand All @@ -149,12 +151,12 @@ def test_connection() -> None:
result.close()


@export_app.command(name="db_export")
@import_app.command(name="db_import")
def export_json_to_database(
sprint_file: Annotated[str, SPRINT_FILE_ARG],
issue_file: Annotated[str, ISSUE_FILE_ARG],
) -> None:
"""Export JSON data to the database."""
"""Import JSON data to the database."""
# Get the database engine and establish a connection
engine = db.get_db()

Expand Down

0 comments on commit bc4553f

Please sign in to comment.