-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented conditional testing in pipeline
- Loading branch information
Showing
3 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -20,18 +43,65 @@ jobs: | |
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
channels: conda-forge | ||
environment-file: air-quality-backend/conda/etl_environment.yml | ||
environment-file: air-quality-backend/conda/linting_environment.yml | ||
auto-activate-base: false | ||
activate-environment: etl | ||
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 not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
e |