Skip to content

Commit

Permalink
[ci] Quality of life updates (#888)
Browse files Browse the repository at this point in the history
## Summary of Changes

- Makes the `Can Produce` field in the model coverage reports clearer by
specifying which target is being generated.
- Adds color to "✓" and "✗" characters to make it clearer at a glance if
a particular file could be ingested
- Updated the default values of Environment Variables in skema.rest to
remove dependency on Lum.AI deployment
- Adds mathjax server to ci to support tests that previously relied on
lum deployment
### Related issues
Resolves #882 
Resolves #883 
Resolves #885

---------

Co-authored-by: Gus Hahn-Powell <[email protected]>
  • Loading branch information
vincentraymond-ua and myedibleenso authored Apr 30, 2024
1 parent 6cda598 commit a6df9ef
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/tests-and-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ env:
# unfortunately, there doesn't seem to be a way
# to reference SKEMA_RS_PORT in SKEMA_RS_ADDESS ...
SKEMA_RS_ADDESS: "http://127.0.0.1:8001"
SKEMA_MATHJAX_PROTOCOL: "http://"
SKEMA_MATHJAX_HOST: "127.0.0.1"
SKEMA_MATHJAX_PORT: "8031"
SKEMA_MATHJAX_ADDRESS: "http://127.0.0.1:8031"

jobs:
docs:
Expand Down Expand Up @@ -71,6 +75,10 @@ jobs:
with:
distribution: temurin
java-version: 11
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version: 18
# Install dependencies
- name: System-wide deps
run: |
Expand Down Expand Up @@ -137,8 +145,15 @@ jobs:
cargo build --release --bin skema_service
./target/release/skema_service &
echo "results for ${SKEMA_RS_HOST}:${SKEMA_RS_PORT}/version: `curl -s ${SKEMA_RS_HOST}:${SKEMA_RS_PORT}/version`"
# NOTE: moved to runbefore the Python unit tests, so we can use the model coverage report results in testing
- name: Install MathJax service deps
working-directory: ./skema/img2mml/data_generation
run: |
npm install
- name: "Launch Mathjax in background for testing"
working-directory: ./skema/img2mml/data_generation
run: |
npm start &
# NOTE: moved to run before the Python unit tests, so we can use the model coverage report results in testing
- name: "Code2fn model coverage reports"
run: python skema/program_analysis/model_coverage_report/model_coverage_report.py $GITHUB_WORKSPACE/docs/coverage/code2fn_coverage/ all

Expand All @@ -149,7 +164,9 @@ jobs:
run: |
echo "SKEMA_RS_ADDESS: $SKEMA_RS_ADDESS"
python -c "import requests; print(requests.get('$SKEMA_RS_ADDESS/version').text)"
SKEMA_RS_ADDRESS=$SKEMA_RS_ADDESS pytest -vvv
echo "SKEMA_MATHJAX_ADDRESS: $SKEMA_MATHJAX_ADDRESS"
python -c "import requests; print(requests.get('$SKEMA_MATHJAX_ADDRESS/version').text)"
SKEMA_RS_ADDESS=$SKEMA_RS_ADDESS SKEMA_MATHJAX_ADDRESS=$SKEMA_MATHJAX_ADDRESS pytest -vvv
- name: "Unit tests for Rust components"
working-directory: ./skema/skema-rs
Expand Down
6 changes: 6 additions & 0 deletions skema/program_analysis/model_coverage_report/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
.hidden {
display: none;
}
.green {
color: green
}
.red {
color: red
}
table {
width: 100%;
border-collapse: collapse;
Expand Down
8 changes: 6 additions & 2 deletions skema/program_analysis/model_coverage_report/html_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ def add_table_header_field(self, table_header_tag, field_name: str):
def add_table_data_field(self, table_row_tag, field_data: str, anchored=False, anchor_text=None):
"""Adds a new field to a table row"""
field_tag = self.soup.new_tag("td")
if field_data == "✓":
field_tag["class"] = "green"
elif field_data == "✗":
field_tag["class"] = "red"

if anchored:
anchor_tag = self.soup.new_tag("a")
Expand Down Expand Up @@ -53,7 +57,7 @@ def add_model_developer():
new_model_table_header_basic = self.soup.new_tag("tr")
self.add_table_header_field(new_model_table_header_basic, "File Name")
self.add_table_header_field(new_model_table_header_basic, "Num Lines")
self.add_table_header_field(new_model_table_header_basic, "Can Ingest")
self.add_table_header_field(new_model_table_header_basic, "Can Produce Gromet")
self.add_table_header_field(new_model_table_header_basic, "Tree-Sitter Parse Tree")
self.add_table_header_field(new_model_table_header_basic, "CAST")
self.add_table_header_field(new_model_table_header_basic, "Gromet")
Expand Down Expand Up @@ -89,7 +93,7 @@ def add_model_consumer():

new_model_table_header_basic = self.soup.new_tag("tr")
self.add_table_header_field(new_model_table_header_basic, "File Name")
self.add_table_header_field(new_model_table_header_basic, "Can Ingest")
self.add_table_header_field(new_model_table_header_basic, "Can Produce AMR")
self.add_table_header_field(new_model_table_header_basic, "AMR")

# Append the elements to each other
Expand Down
5 changes: 2 additions & 3 deletions skema/rest/proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
SKEMA_GRAPH_DB_PROTO = os.environ.get("SKEMA_GRAPH_DB_PROTO", "bolt://")
SKEMA_GRAPH_DB_HOST = os.environ.get("SKEMA_GRAPH_DB_HOST", "127.0.0.1")
SKEMA_GRAPH_DB_PORT = os.environ.get("SKEMA_GRAPH_DB_PORT", "7687")
SKEMA_RS_ADDESS = os.environ.get("SKEMA_RS_ADDRESS", "https://skema-rs.askem.lum.ai")
SKEMA_RS_ADDESS = os.environ.get("SKEMA_RS_ADDRESS", "http://127.0.0.1:8001")
SKEMA_OPENAI_KEY = os.environ.get("SKEMA_OPENAI_KEY", "YOU_FORGOT_TO_SET_SKEMA_OPENAI_KEY")

# MathJAX service
Expand All @@ -19,8 +19,7 @@
SKEMA_MATHJAX_PORT = str(os.environ.get("SKEMA_MATHJAX_PORT", 8031))
SKEMA_MATHJAX_ADDRESS = os.environ.get(
"SKEMA_MATHJAX_ADDRESS",
"https://mathjax.askem.lum.ai"
#f"{SKEMA_MATHJAX_PROTOCOL}{SKEMA_MATHJAX_HOST}:{SKEMA_MATHJAX_PORT}",
f"{SKEMA_MATHJAX_PROTOCOL}{SKEMA_MATHJAX_HOST}:{SKEMA_MATHJAX_PORT}",
)

# Text Reading services
Expand Down

0 comments on commit a6df9ef

Please sign in to comment.