Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated pr-build.yml #16

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fb04c2d
Updated pr-build.yml
Ben-EJ May 16, 2024
e8c4944
change to test
Ben-EJ May 16, 2024
cf7e23a
Update pr-build.yml
Ben-EJ May 16, 2024
e4cfc7b
Update pr-build.yml
Ben-EJ May 16, 2024
b63853f
Update pr-build.yml
Ben-EJ May 16, 2024
4b501e1
Update pr-build.yml
Ben-EJ May 16, 2024
ce3e3e6
Update pr-build.yml
Ben-EJ May 16, 2024
545a615
Update pr-build.yml
Ben-EJ May 16, 2024
bfef78f
Update pr-build.yml
Ben-EJ May 16, 2024
b6c429d
Update pr-build.yml
Ben-EJ May 16, 2024
61f9a23
Update pr-build.yml
Ben-EJ May 16, 2024
c35ae3f
Update pr-build.yml
Ben-EJ May 16, 2024
a6031a7
Update __init__.py
Ben-EJ May 16, 2024
13fe39f
commit
Ben-EJ May 16, 2024
29cff36
Update __init__.py
Ben-EJ May 16, 2024
ae77204
Update pr-build.yml
Ben-EJ May 17, 2024
ed51955
commit
Ben-EJ May 17, 2024
32e5fa2
Update __init__.py
Ben-EJ May 17, 2024
39a926e
Update pr-build.yml
Ben-EJ May 17, 2024
4068d54
Update pr-build.yml
Ben-EJ May 17, 2024
e9a8d6b
Update pr-build.yml
Ben-EJ May 17, 2024
7c4a293
Update pr-build.yml
Ben-EJ May 17, 2024
6950a99
Update pr-build.yml
Ben-EJ May 17, 2024
4095329
Update pr-build.yml
Ben-EJ May 17, 2024
14880fb
commit
Ben-EJ May 17, 2024
9f2bc27
Update pr-build.yml
Ben-EJ May 17, 2024
5525552
Update pr-build.yml
Ben-EJ May 17, 2024
236bc9e
Update pr-build.yml
Ben-EJ May 17, 2024
799929e
Update pr-build.yml
Ben-EJ May 17, 2024
8a946c7
Update pr-build.yml
Ben-EJ May 17, 2024
af17177
Update pr-build.yml
Ben-EJ May 17, 2024
7feba92
Update pr-build.yml
Ben-EJ May 17, 2024
1380f8c
Commit
Ben-EJ May 17, 2024
3f89788
Implemented conditional testing in pipeline
Ben-EJ May 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 77 additions & 7 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,30 @@ on:
- 'main'

jobs:
run-pr-checks:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
etl: ${{ steps.filter.outputs.etl }}
api: ${{ steps.filter.outputs.api }}
etl_tests: ${{ steps.filter.outputs.etl_tests }}
api_tests: ${{ steps.filter.outputs.api_tests }}
steps:
- uses: dorny/[email protected]
id: filter
with:
filters: |
etl:
- 'air-quality-backend/src/etl/**'
api:
- 'air-quality-backend/src/api/**'
etl_tests:
- 'air-quality-backend/tests/etl_tests/**'
api_tests:
- 'air-quality-backend/tests/api_tests/**'

run-lint:
runs-on: ubuntu-latest
defaults:
run:
Expand All @@ -20,18 +43,65 @@ jobs:
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
environment-file: air-quality-backend/conda/test_environment.yml
environment-file: air-quality-backend/conda/linting_environment.yml
auto-activate-base: false
activate-environment: unit-test
activate-environment: linting-env

- name: Run lint check
run: python -m flake8 --append-config air-quality-backend/.flake8 air-quality-backend

- name: Run unit tests
run: python -m pytest --cov=src --cov=scripts --cov-report=xml:air-quality-backend/tests/coverage/test_report.xml air-quality-backend/tests

etl:
needs: changes
if: ${{ needs.changes.outputs.etl == 'true' || needs.changes.outputs.etl_tests == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
environment-file: air-quality-backend/conda/etl_environment.yml
auto-activate-base: false
activate-environment: etl-dev

- name: Run etl unit tests
run: python -m pytest --cov=src --cov=scripts --cov-report=xml:air-quality-backend/tests/coverage/etl_test_report.xml air-quality-backend/tests/etl_tests

- name: Code Coverage Report
uses: orgoro/[email protected]
with:
coverageFile: air-quality-backend/tests/coverage/test_report.xml
coverageFile: air-quality-backend/tests/coverage/etl_test_report.xml
token: ${{ secrets.GITHUB_TOKEN }}

api:
needs: changes
if: ${{ needs.changes.outputs.api == 'true' || needs.changes.outputs.api_tests == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup miniconda
uses: conda-incubator/setup-miniconda@v3
with:
channels: conda-forge
environment-file: air-quality-backend/conda/api_environment.yml
auto-activate-base: false
activate-environment: api-dev

- name: Run api unit tests
run: python -m pytest --cov=src --cov=scripts --cov-report=xml:air-quality-backend/tests/coverage/api_test_report.xml air-quality-backend/tests/api_tests

- name: Code Coverage Report
uses: orgoro/[email protected]
with:
coverageFile: air-quality-backend/tests/coverage/api_test_report.xml
token: ${{ secrets.GITHUB_TOKEN }}
Binary file added air-quality-backend/conda/linting_environment.yml
Binary file not shown.
3 changes: 2 additions & 1 deletion air-quality-backend/scripts/run_forecast_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from dotenv import load_dotenv
import logging
from logging import config
from src.database import (

from src.database.air_quality_dashboard_dao import (
get_locations_by_type,
insert_data_forecast,
)
Expand Down
3 changes: 2 additions & 1 deletion air-quality-backend/scripts/run_in_situ_etl.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
from dotenv import load_dotenv
import logging
from logging import config
from src.database import (

from src.database.air_quality_dashboard_dao import (
get_locations_by_type,
insert_data_openaq,
)
Expand Down
5 changes: 2 additions & 3 deletions air-quality-backend/scripts/run_purge_old_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
from dotenv import load_dotenv
import logging
from logging import config
from src.database import (
delete_data_before,
)

from src.database.air_quality_dashboard_dao import delete_data_before

config.fileConfig("../logging.ini")

Expand Down