-
Notifications
You must be signed in to change notification settings - Fork 0
167 lines (144 loc) · 4.97 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
name: CI
defaults:
run:
shell: bash
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@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# Most of the steps in this workflow use Just: https://github.com/casey/just
# Just can be used to run commands, it is similar to Make.
# The just file is located in the root of the repository: "justfile"
- name: Install just
run: ./ci/scripts/install-just.sh
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit
run: just lint
shell: bash
test-datastore:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install just
run: ./ci/scripts/install-just.sh
- name: Build docker containers
run: just build
- name: Run the unit test
run: just unit
- name: Start docker stack
run: just services
- name: Load the data into the database
run: just load
- name: Run the integration test
run: just integration
- name: Run the performance test
run: just performance
- name: Run the client test
run: just client
- name: Archive test artifacts
uses: actions/upload-artifact@v4
with:
name: test-results-artifact
path: |
api/test/output/pytest-coverage.txt
api/test/output/pytest.xml
datastore/load-test/output/store_read_*.csv
datastore/load-test/output/store_rw_*.csv
- name: Print results
run: |
pip install csvkit
echo "## Stats (READ ONLY)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/output/store_read_stats.csv >> $GITHUB_STEP_SUMMARY
echo "## Failures (READ ONLY)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/output/store_read_failures.csv >> $GITHUB_STEP_SUMMARY
echo "## Stats (WRITE + READ)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/output/store_rw_stats.csv >> $GITHUB_STEP_SUMMARY
echo "## Failures (WRITE + READ)" >> $GITHUB_STEP_SUMMARY
csvlook datastore/load-test/output/store_rw_failures.csv >> $GITHUB_STEP_SUMMARY
- name: Cleanup
if: always()
run: just destroy
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@v4
- 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@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Checkout Source
uses: actions/checkout@v4
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install pytest-timeout
pip install pytest-cov
pip install httpx
pip install -r ./ingest/requirements.txt
pip install ./ingest
cd ./ingest && python3 api/generate_standard_name.py
- name: Copy Protobuf file to api directory and build
run: |
mkdir ./ingest/protobuf
cp ./protobuf/datastore.proto ./ingest/protobuf/datastore.proto
python -m grpc_tools.protoc --proto_path=./ingest/protobuf --python_out=./ingest --grpc_python_out=./ingest ./ingest/protobuf/datastore.proto
- name: Run Tests
run: |
cd ingest
mkdir -p /tmp/metrics
PROMETHEUS_MULTIPROC_DIR=/tmp/metrics python -m pytest -v --timeout=60
publish-test-results:
needs: test-datastore
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Download test results so that they can be published
uses: actions/download-artifact@v4
with:
name: test-results-artifact
- name: Comment coverage
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: api/test/output/pytest-coverage.txt
coverage-path-prefix: api/test/output/
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/test/output/pytest.xml
junitxml-title: API Unit Test Coverage Summary