Test - fix forecast calibration test to round appropriately #761
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
name: pr-build | |
on: | |
pull_request: | |
types: ['opened', 'reopened', 'synchronize'] | |
branches: | |
- 'main' | |
jobs: | |
detect-change-scope: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
backend-etl: ${{ steps.filter.outputs.backend-etl }} | |
backend-api: ${{ steps.filter.outputs.backend-api }} | |
backend-shared: ${{ steps.filter.outputs.backend-shared }} | |
ui: ${{ steps.filter.outputs.ui }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3.0.2 | |
id: filter | |
with: | |
filters: | | |
backend-etl: | |
- 'air-quality-backend/etl/**' | |
backend-api: | |
- 'air-quality-backend/api/**' | |
backend-shared: | |
- 'air-quality-backend/shared/**' | |
ui: | |
- 'air-quality-ui/**' | |
pr-checks-backend-etl: | |
needs: detect-change-scope | |
if: ${{ needs.detect-change-scope.outputs.backend-etl == 'true' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: 'air-quality-backend' | |
sparse-checkout-cone-mode: false | |
- name: Setup miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
channels: conda-forge | |
environment-file: air-quality-backend/etl/conda/environment.yml | |
auto-activate-base: false | |
activate-environment: pr-env | |
- name: Get Dependencies | |
run: poetry install | |
working-directory: ./air-quality-backend/etl | |
- name: Run lint check | |
run: python -m flake8 --append-config .flake8 | |
working-directory: ./air-quality-backend/etl | |
- name: Run unit tests | |
run: python -m pytest --cov=etl --cov-report= etl/tests | |
working-directory: ./air-quality-backend/ | |
- name: Convert to report | |
run: coverage xml | |
working-directory: ./air-quality-backend/ | |
- name: Code Coverage Report | |
uses: orgoro/coverage@v3.1 | |
with: | |
coverageFile: ./air-quality-backend/coverage.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
thresholdAll: 0.8 | |
thresholdModified: 0 | |
pr-checks-backend-api: | |
needs: detect-change-scope | |
if: ${{ needs.detect-change-scope.outputs.backend-api == 'true' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: 'air-quality-backend' | |
sparse-checkout-cone-mode: false | |
- name: Setup Python | |
uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: Get Dependencies | |
run: pip install -r requirements-dev.txt | |
working-directory: ./air-quality-backend/api | |
- name: Run lint check | |
run: python -m flake8 --append-config .flake8 | |
working-directory: ./air-quality-backend/api | |
- name: Run unit tests | |
run: python -m pytest --cov=api/src --cov-report= api/tests | |
working-directory: ./air-quality-backend/ | |
- name: Convert to report | |
run: coverage xml | |
working-directory: ./air-quality-backend/ | |
- name: Code Coverage Report | |
uses: orgoro/coverage@v3.1 | |
with: | |
coverageFile: ./air-quality-backend/coverage.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
thresholdAll: 0.8 | |
thresholdModified: 0.9 | |
thresholdNew: 1 | |
pr-checks-backend-shared: | |
needs: detect-change-scope | |
if: ${{ needs.detect-change-scope.outputs.backend-shared == 'true' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: 'air-quality-backend' | |
sparse-checkout-cone-mode: false | |
- name: Setup Python | |
uses: actions/setup-python@v5.1.0 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
- name: Get Dependencies | |
run: pip install -r requirements-test.txt | |
working-directory: ./air-quality-backend/shared | |
- name: Run lint check | |
run: python -m flake8 --append-config .flake8 | |
working-directory: ./air-quality-backend/shared | |
- name: Run unit tests | |
run: python -m pytest --cov=shared/src --cov-report= shared/tests | |
working-directory: ./air-quality-backend/ | |
- name: Convert to report | |
run: coverage xml | |
working-directory: ./air-quality-backend/ | |
- name: Code Coverage Report | |
uses: orgoro/coverage@v3.1 | |
with: | |
coverageFile: ./air-quality-backend/coverage.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
thresholdAll: 0.8 | |
thresholdModified: 0.9 | |
thresholdNew: 1 | |
pr-checks-ui: | |
runs-on: ubuntu-latest | |
needs: detect-change-scope | |
if: ${{ needs.detect-change-scope.outputs.ui == 'true' }} | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: 'air-quality-ui' | |
sparse-checkout-cone-mode: false | |
- name: Install | |
run: npm ci | |
working-directory: 'air-quality-ui' | |
- name: Run lint check | |
run: npm run lint | |
working-directory: 'air-quality-ui' | |
- name: Run tests with coverage | |
uses: ArtiomTr/jest-coverage-report-action@v2.0-rc.6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
working-directory: 'air-quality-ui' | |
threshold: 90 | |
test-script: npm run test:ci |