-
Notifications
You must be signed in to change notification settings - Fork 1
105 lines (92 loc) · 3.11 KB
/
pr-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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:
etl: ${{ steps.filter.outputs.etl }}
api: ${{ steps.filter.outputs.api }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: dorny/[email protected]
id: filter
with:
filters: |
etl:
- 'air-quality-backend/src/etl/**'
- 'air-quality-backend/tests/etl_tests/**'
api:
- 'air-quality-backend/src/api/**'
- 'air-quality-backend/tests/api_tests/**'
run-lint:
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/utility_environment.yml
auto-activate-base: false
activate-environment: linting-env
- name: Run lint check
run: python -m flake8 --append-config air-quality-backend/.flake8 air-quality-backend
etl:
needs: detect-change-scope
if: ${{ needs.detect-change-scope.outputs.etl == '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/etl_test_report.xml
token: ${{ secrets.GITHUB_TOKEN }}
api:
needs: detect-change-scope
if: ${{ needs.detect-change-scope.outputs.api == '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 }}