Skip to content

Commit

Permalink
Merge pull request #7 from usdot-jpo-ode/release_q3
Browse files Browse the repository at this point in the history
Merge Q3 release into master
  • Loading branch information
dan-du-car authored Nov 29, 2023
2 parents 8566d60 + fdae960 commit a291711
Show file tree
Hide file tree
Showing 185 changed files with 18,617 additions and 24,299 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: cv-manager

on: [pull_request, push]

jobs:
build_api:
runs-on: ubuntu-latest
container:
image: python:3.9
options: --user root
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v3

- name: Install Dependencies
run: |
apt-get update
apt-get -y install python3-coverage python3-pip python3-pytest
- name: Install Python Requirements
run: python3 -m pip install -r $GITHUB_WORKSPACE/services/requirements.txt

- name: Run Tests and Generate Coverage
continue-on-error: true
run: |
# Set PYTHONPATH and navigate to the tests directory
export PYTHONPATH=$PYTHONPATH:/usr/lib/python3/dist-packages
cd $GITHUB_WORKSPACE/services
# Run tests and generate coverage report
python3 -m coverage run -m pytest
python3 -m coverage xml --omit="/opt/*,/root/*,/tmp/*,/usr/*,/var/*,**/__init__.py"
- name: Archive Code Coverage Results
uses: actions/upload-artifact@v3
with:
name: build_api
path: services/coverage.xml

- name: Find coverage.xml
shell: bash
run: |
find "$GITHUB_WORKSPACE/services" -name "coverage.xml"
webapp:
runs-on: ubuntu-latest
container:
image: node:16.16.0
options: --user root
env:
CI: true
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v3

- name: Build Web Application
continue-on-error: true
run: |
# Navigate to the webapp directory and perform necessary setup
cd $GITHUB_WORKSPACE/webapp
npm install -g nodemon
npm init -y
npm install --force
# Run tests with coverage and suppress failures
npm test -- --coverage || true
- name: Archive Code Coverage Results
uses: actions/upload-artifact@v3
with:
name: webapp
path: webapp/coverage/*

- name: Find lcov.info
shell: bash
run: |
find "$GITHUB_WORKSPACE" -name "lcov.info"
sonar:
needs: [build_api, webapp]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download code coverage results
uses: actions/download-artifact@v3
continue-on-error: true
with:
name: build_api
path: services/coverage.xml

- name: Download Code Coverage Results
uses: actions/download-artifact@v3
with:
name: webapp
path: webapp

- name: Find coverage.xml
shell: bash
run: |
find "$GITHUB_WORKSPACE" -name "coverage.xml"
- name: Find lcov.info
shell: bash
run: |
find "$GITHUB_WORKSPACE" -name "lcov.info"
- name: Setup SonarScanner
uses: warchant/setup-sonar-scanner@v4
with:
version: 4.8.0.2856

- name: Generate Sonar Properties File
run: |
cat <<EOF > /tmp/sonar-scanner.properties
sonar.host.url=https://sonarcloud.io
sonar.exclusions=**/__init__.py,**/*test*.py,**/test/**
sonar.coverage.exclusions=**/__init__.py,**/*test*.py,**/test/**
sonar.javascript.lcov.reportPaths=/home/runner/work/jpo-cvmanager/jpo-cvmanager/webapp/lcov.info
sonar.modules=api,webapp
sonar.organization=usdot-jpo-ode
sonar.projectBaseDir=$GITHUB_WORKSPACE
sonar.projectKey=usdot-jpo-ode_jpo-cvmanager
sonar.projectName=jpo-cvmanager
sonar.python.coverage.reportPaths=$GITHUB_WORKSPACE/services/coverage.xml
sonar.python.version=3.9
api.sonar.projectBaseDir=$GITHUB_WORKSPACE/services
api.sonar.sources=addons/images/bsm_query,addons/images/count_metric,addons/images/iss_health_check,addons/images/rsu_ping_fetch,api/src,common/pgquery.py
api.sonar.tests=addons/tests,api/tests,common/tests
webapp.sonar.projectBaseDir=$GITHUB_WORKSPACE/webapp
webapp.sonar.sources=src
EOF
- name: Run SonarScanner
uses: usdot-fhwa-stol/actions/sonar-scanner@main
with:
sonar-properties-path: /tmp/sonar-scanner.properties
sonar-token: ${{ secrets.SONAR_TOKEN }}
working-dir: $GITHUB_WORKSPACE
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pyc
*.pyc.*
.env
.coverage
cov.xml
56 changes: 28 additions & 28 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"command": "npm start",
"name": "Launch web app",
"request": "launch",
"cwd": "${workspaceFolder}/webapp",
"type": "node-terminal"
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"program": "${workspaceRoot}/api/src/main.py",
"env": {
"FLASK_APP": "${workspaceRoot}/api/src/main.py"
},
"args": ["run"],
"envFile": "${workspaceRoot}/api/.env",
"preLaunchTask": "build-python-api"
}
]
}
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"command": "npm start",
"name": "Launch web app",
"request": "launch",
"cwd": "${workspaceFolder}/webapp",
"type": "node-terminal"
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"program": "${workspaceRoot}/services/api/src/main.py",
"env": {
"FLASK_APP": "${workspaceRoot}/services/api/src/main.py"
},
"args": ["run"],
"envFile": "${workspaceRoot}/services/api/.env",
"preLaunchTask": "build-python-services"
}
]
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"editor.formatOnPaste": false,
"prettier.useEditorConfig": false,
"prettier.useTabs": false,
"prettier.configPath": ".vscode/.prettierrc.json"
"prettier.configPath": ".vscode/.prettierrc.json",
"python.testing.pytestArgs": ["services"]
}
21 changes: 7 additions & 14 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@
"version": "2.0.0",
"tasks": [
{
"label": "build-python-api",
"label": "build-python-services",
"type": "shell",
"command": "${command:python.interpreterPath} -m pip install -r ./api/requirements.txt"
"command": "${command:python.interpreterPath} -m pip install -r ./services/requirements.txt"
},
{
"label": "build-python-addons",
"label": "run-services-tests-and-coverage",
"type": "shell",
"command": "${command:python.interpreterPath} -m pip install -r ./addons/tests/requirements.txt"
},
{
"label": "run-api-tests-and-coverage",
"type": "shell",
"command": "${command:python.interpreterPath} -m pytest -v --cov-report xml:cov.xml --cov . ./api/tests/"
},
{
"label": "run-addons-tests-and-coverage",
"type": "shell",
"command": "${command:python.interpreterPath} -m pytest -v --cov-report xml:cov.xml --cov . ./addons/tests/"
"options": {
"cwd": "${workspaceFolder}/services/"
},
"command": "${command:python.interpreterPath} -m pytest -v --cov-report xml:cov.xml --cov ."
}
]
}
12 changes: 0 additions & 12 deletions addons/images/bsm_query/Dockerfile

This file was deleted.

4 changes: 0 additions & 4 deletions addons/images/bsm_query/requirements.txt

This file was deleted.

14 changes: 0 additions & 14 deletions addons/images/count_metric/Dockerfile

This file was deleted.

73 changes: 0 additions & 73 deletions addons/images/count_metric/pgquery_rsu.py

This file was deleted.

11 changes: 0 additions & 11 deletions addons/images/count_metric/requirements.txt

This file was deleted.

14 changes: 0 additions & 14 deletions addons/images/rsu_ping_fetch/Dockerfile

This file was deleted.

Loading

0 comments on commit a291711

Please sign in to comment.