-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (162 loc) · 6.4 KB
/
ci.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
name: CI
on:
push:
branches:
- "**"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- main
permissions:
contents: read
jobs:
pre-commit-hook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Install pre-commit
run: python -m pip install pre-commit
shell: bash
- name: Show pre-commit requirements
run: python -m pip freeze --local
shell: bash
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit for all files
run: pre-commit run --config './.pre-commit-config.yaml' --all-files --color=always --show-diff-on-failure
shell: bash
test-datastore:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Copy Protobuf files to Dockerfile directories
run: ./ci/docker/copy-protobuf.sh
- name: Build docker containers
run: docker compose --profile test build
- name: Start docker stack
run: DYNAMICTIME=false LOTIME=1000-01-01T00:00:00Z HITIME=9999-12-31T23:59:59Z docker compose up -d --wait --wait-timeout 120
- name: Test loader runs without errors
run: DYNAMICTIME=false LOTIME=1000-01-01T00:00:00Z HITIME=9999-12-31T23:59:59Z docker compose run --rm loader
- name: Integration test
run: DYNAMICTIME=false LOTIME=1000-01-01T00:00:00Z HITIME=9999-12-31T23:59:59Z docker compose run --rm integration
- name: Test client runs without errors
run: DYNAMICTIME=false LOTIME=1000-01-01T00:00:00Z HITIME=9999-12-31T23:59:59Z docker compose run --rm client
- name: Run load test (read only)
run: |
python --version
pip install -r datastore/load-test/requirements.txt
python -m grpc_tools.protoc --proto_path=./protobuf datastore.proto --python_out=datastore/load-test --grpc_python_out=datastore/load-test
cd datastore/load-test
locust -f locustfile_read.py --headless -u 5 -r 10 --run-time 60 --only-summary --csv store_read
- name: Run load test (write + read)
run: |
pip install -r datastore/load-test/requirements.txt
python -m grpc_tools.protoc --proto_path=./protobuf datastore.proto --python_out=datastore/load-test --grpc_python_out=datastore/load-test
cd datastore/load-test
python schedule_write.py > schedule_write.log 2>&1 &
locust -f locustfile_read.py --headless -u 5 -r 10 --run-time 60 --only-summary --csv store_rw
kill %1
echo Catting schedule_write output...
cat schedule_write.log
echo Done catting
- name: Archive load test artifacts
uses: actions/upload-artifact@v3
with:
name: performance
path: |
datastore/load-test/store_read_*.csv
datastore/load-test/store_rw_*.csv
- name: Print results
run: |
pip install csvkit
echo "## Stats (READ ONLY)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/store_read_stats.csv >> $GITHUB_STEP_SUMMARY
echo "## Failures (READ ONLY)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/store_read_failures.csv >> $GITHUB_STEP_SUMMARY
echo "## Stats (WRITE + READ)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/store_rw_stats.csv >> $GITHUB_STEP_SUMMARY
echo "## Failures (WRITE + READ)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/store_rw_failures.csv >> $GITHUB_STEP_SUMMARY
- name: Cleanup
if: always()
run: docker compose down --volumes
test-api:
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: Checkout the repo
uses: actions/checkout@v4
- name: Python Setup
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install pytest-timeout
pip install pytest-cov
pip install httpx
pip install -r ./api/requirements.txt
- name: Copy Protobuf file to api directory and build
run: |
mkdir ./api/protobuf
cp ./protobuf/datastore.proto ./api/protobuf/datastore.proto
python -m grpc_tools.protoc --proto_path=./api/protobuf --python_out=./api --grpc_python_out=./api ./api/protobuf/datastore.proto
- name: Run Tests
run: |
cd api
python -m pytest --timeout=60 --junitxml=pytest.xml --cov-report=term-missing --cov=. | tee pytest-coverage.txt
- name: Comment coverage
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: ./api/pytest-coverage.txt
coverage-path-prefix: api/
title: API Unit Test Coverage Report
hide-badge: true
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: false
remove-link-from-badge: false
junitxml-path: ./api/pytest.xml
junitxml-title: API Unit Test Coverage Summary
# TODO: These tests don't currently work. Uncomment once this is resolved.
# test-ingest:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.10"] # Add 3.11 back pybind11 bug is fixed
# steps:
# - name: Checkout the repo
# uses: actions/checkout@v3
# - name: Ubuntu setup
# run: sudo apt update && sudo apt install libeccodes-data rapidjson-dev pybind11-dev libssl-dev
# - name: Python Setup
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# architecture: x64
# - name: Checkout Source
# uses: actions/checkout@v3
# - name: Install Dependencies
# run: |
# pip install --upgrade pip
# pip install pytest-timeout
# pip install pytest-cov
# pip install ./ingest
# - name: Run Tests
# run: python -m pytest -v --timeout=60 ./ingest