-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (142 loc) · 4.91 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
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 ingest-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: Install just
run: ./ci/scripts/install-just.sh
- name: Copy protobuf files
run: just copy-proto
- name: Run the unit test
run: just ingest-unit
- name: Archive test artifacts
uses: actions/upload-artifact@v4
with:
name: ingest-test-results-artifact
path: |
ingest/test/output/pytest-coverage.txt
ingest/test/output/pytest.xml
- name: Cleanup
if: always()
run: just destroy
publish-test-results:
needs:
- test-datastore
- test-ingest
runs-on: ubuntu-latest
if: github.event_name != 'push' || github.event.ref_type != 'tag'
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Download test-datastore results so that they can be published
uses: actions/download-artifact@v4
with:
name: test-results-artifact
path: ./artifacts/test-results
- name: Download test-ingest results so that they can be published
uses: actions/download-artifact@v4
with:
name: ingest-test-results-artifact
path: ./artifacts/ingest-results
- name: Comment coverage
uses: MishaKav/pytest-coverage-comment@main
with:
title: Unit Test Coverage Report
pytest-coverage-path: ./artifacts/test-results/api/test/output/pytest-coverage.txt
multiple-files: |
API Unit Tests, ./artifacts/test-results/api/test/output/pytest-coverage.txt, ./artifacts/test-results/api/test/output/pytest.xml
Ingest Unit Tests, ./artifacts/ingest-results/pytest-coverage.txt, ./artifacts/ingest-results/pytest.xml