Skip to content

Commit eabbcee

Browse files
authored
Merge pull request #12 from TaskarCenterAtUW/dev
Dev to Main
2 parents 5e54b11 + 0785d04 commit eabbcee

File tree

4 files changed

+64
-25
lines changed

4 files changed

+64
-25
lines changed

.github/workflows/unit_tests.yml

Lines changed: 57 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,66 @@ on:
55
branches-ignore:
66
- '**'
77
pull_request:
8-
branches: [dev]
8+
branches: [ main, dev ]
99

1010
jobs:
1111
UnitTest:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v2
17-
18-
- name: Set up Python
19-
uses: actions/setup-python@v2
20-
with:
21-
python-version: '3.10'
22-
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install -r requirements.txt
27-
28-
- name: Run tests with coverage
29-
run: |
30-
coverage run --source=src/osw_incline -m unittest discover -s tests/
31-
coverage xml
32-
33-
- name: Check coverage
34-
run: |
35-
coverage report --fail-under=85
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: '3.10'
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -r requirements.txt
27+
28+
- name: Determine output folder
29+
id: set_output_folder
30+
run: |
31+
if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then
32+
branch_name=$GITHUB_BASE_REF
33+
else
34+
branch_name=$GITHUB_REF_NAME
35+
fi
36+
if [[ $branch_name == "main" ]]; then
37+
echo "output_folder=prod" >> $GITHUB_ENV
38+
elif [[ $branch_name == "stage" ]]; then
39+
echo "output_folder=stage" >> $GITHUB_ENV
40+
elif [[ $branch_name == "dev" ]]; then
41+
echo "output_folder=dev" >> $GITHUB_ENV
42+
else
43+
echo "Unknown branch: $branch_name"
44+
exit 1
45+
fi
46+
47+
- name: Run tests with coverage
48+
run: |
49+
timestamp=$(date '+%Y-%m-%d_%H-%M-%S')
50+
mkdir -p test_results
51+
log_file="test_results/${timestamp}_report.log"
52+
echo -e "\nTest Cases Report Report\n" >> $log_file
53+
# Run the tests and append output to the log file
54+
python -m coverage run --source=src/osw_incline -m unittest discover -v tests >> $log_file 2>&1
55+
echo -e "\nCoverage Report\n" >> $log_file
56+
coverage report >> $log_file
57+
58+
- name: Check coverage
59+
run: |
60+
coverage report --fail-under=85
61+
62+
- name: Upload report to Azure
63+
uses: LanceMcCarthy/Action-AzureBlobUpload@v2
64+
with:
65+
source_folder: 'test_results'
66+
destination_folder: '${{ env.output_folder }}'
67+
connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
68+
container_name: 'osw-incline-package'
69+
clean_destination_folder: false
70+
delete_if_exists: false

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 0.0.4
2+
- Fixed [Task-1467](https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/1467/).
3+
- Updated pipeline to deploy the test results to Azure Blob
4+
15
### 0.0.3
26

37
- Fixed [Task-1369](https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/1369/).

src/osw_incline/dem_processor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def process(self, nodes_path, edges_path, skip_existing_tags=False, batch_proces
5757
if 'geometry' in d:
5858
if skip_existing_tags:
5959
if 'incline' in d and d['incline'] is not None:
60-
if -1 <= d['incline'] <= 1:
60+
if d['incline'] < -1 or d['incline'] > 1:
6161
del d['incline']
6262
# If incline already exists, skip
6363
continue
@@ -91,7 +91,7 @@ def _process_in_batches(self, edges, dem, batch_size=10000, skip_existing_tags=F
9191
if 'geometry' in d:
9292
if skip_existing_tags:
9393
if 'incline' in d and d['incline'] is not None:
94-
if -1 <= d['incline'] <= 1:
94+
if d['incline'] < -1 or d['incline'] > 1:
9595
del d['incline']
9696
# If incline already exists, skip
9797
continue

src/osw_incline/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.0.3'
1+
__version__ = '0.0.4'

0 commit comments

Comments
 (0)