-
Notifications
You must be signed in to change notification settings - Fork 1
156 lines (149 loc) · 5.41 KB
/
python-app.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
usl_lib:
name: usl_lib CI
runs-on: ubuntu-22.04
env:
FIRESTORE_EMULATOR_HOST: "localhost:8085"
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Start FireStore Emulator
run: |
sudo apt-get update -qq
sudo apt-get install -y apt-transport-https ca-certificates gnupg curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install -y google-cloud-cli google-cloud-cli-firestore-emulator
gcloud emulators firestore start --host-port=localhost:8085 &
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo add-apt-repository ppa:ubuntugis/ppa -y
sudo apt-get update -qq
sudo apt-get install -y gdal-bin libgdal-dev
python -m pip install --upgrade pip
cd usl_pipeline
pip install -e usl_lib[dev]
- name: Lint with flake8
run: |
flake8 usl_pipeline/usl_lib --show-source --statistics
- name: Ensure black auto-formatter has run
run: |
black usl_pipeline/usl_lib --check
- name: Test with pytest
run: |
pytest usl_pipeline/usl_lib
- name: MyPy Type Checking
run: |
mypy usl_pipeline/usl_lib
study_area_uploader:
name: Study Area Uploader CI
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo add-apt-repository ppa:ubuntugis/ppa -y
sudo apt-get update -qq
sudo apt-get install -y gdal-bin libgdal-dev
python -m pip install --upgrade pip
cd usl_pipeline/study_area_uploader
pip install -r requirements.txt
pip install -e .[dev]
- name: Lint with flake8
run: |
flake8 usl_pipeline/study_area_uploader --show-source --statistics
- name: Ensure black auto-formatter has run
run: |
black usl_pipeline/study_area_uploader --check
- name: Test with pytest
run: |
pytest usl_pipeline/study_area_uploader
- name: MyPy Type Checking
run: |
mypy usl_pipeline/study_area_uploader
cloud_functions:
name: Cloud Funcations CI
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
# Copy the usl_lib files to sit alongside main.py to mirror the .zip we
# will use for the cloud function.
run: |
python -m pip install --upgrade pip
# Copy wheels folder to current directory for requirements install
cp -r usl_pipeline/cloud_functions/wheels .
pip install -r usl_pipeline/cloud_functions/requirements.txt
pip install black~=24.0 flake8~=7.0 flake8-docstrings~=1.7 pytest~=8.0 mypy~=1.9
- name: Lint with flake8
run: |
flake8 usl_pipeline/cloud_functions --show-source --statistics
- name: Ensure black auto-formatter has run
run: |
black usl_pipeline/cloud_functions --check
- name: Test with pytest
run: |
pytest usl_pipeline/cloud_functions
- name: MyPy Type Checking
run: |
mypy usl_pipeline/cloud_functions
usl_models:
name: USL Models CI
runs-on: ubuntu-22.04
env:
FIRESTORE_EMULATOR_HOST: "localhost:8085"
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Start FireStore Emulator
run: |
sudo apt-get update -qq
sudo apt-get install -y apt-transport-https ca-certificates gnupg curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install -y google-cloud-cli google-cloud-cli-firestore-emulator
gcloud emulators firestore start --host-port=localhost:8085 &
- name: Install dependencies
run: |
python -m pip install --upgrade pip
cd usl_models
pip install -r requirements.txt
pip install -e .[dev]
- name: Lint with flake8
run: |
flake8 usl_models --show-source --statistics
- name: Ensure black auto-formatter has run
run: |
black usl_models --check
- name: Test with pytest
run: |
pytest usl_models
- name: Type check with MyPy
run: |
mypy usl_models