34
34
filters : |
35
35
backend:
36
36
- 'backend/**'
37
+ api:
38
+ - 'backend/api/**'
39
+ archiver:
40
+ - 'backend/archiver/**'
41
+ prefect:
42
+ - 'backend/prefect/prefect/**'
43
+
44
+
37
45
38
46
# test_api_server:
39
47
# runs-on: ubuntu-latest
@@ -60,38 +68,66 @@ jobs:
60
68
# if: ${{ always() }}
61
69
#
62
70
63
- test_archiver_flows :
71
+ test_flows :
64
72
runs-on : ubuntu-latest
65
73
needs : detect_changes
74
+ if : ${{ needs.detect_changes.outputs.archiver == 'true' }} || github.event_name != 'pull_request'
75
+ defaults :
76
+ run :
77
+ working-directory : ./backend/archiver
66
78
steps :
67
79
- uses : actions/checkout@v4
68
- - name : Set up Python
80
+
81
+ - name : Install uv
82
+ uses : astral-sh/setup-uv@v5
83
+ with :
84
+ version : " 0.6.1"
85
+
86
+ - name : " Set up Python"
69
87
uses : actions/setup-python@v5
70
88
with :
71
- python-version : " 3.11"
72
- - name : Install dependencies and run tests
73
- working-directory : ./backend/archiver
89
+ python-version-file : backend/archiver/pyproject.toml
90
+
91
+ - name : Install the project
92
+ run : |
93
+ uv sync --all-extras --dev
94
+ uv add pytest-md-report
95
+
96
+ - name : Run tests
97
+ env :
98
+ REPORT_OUTPUT : md_report.md
99
+ shell : bash
74
100
run : |
75
- python -m pip install --upgrade pip
76
- python -m pip install pipenv
77
- pipenv sync -d
78
- pipenv run pytest --junitxml=junit/test-results.xml --cov=. --cov-report=xml --cov-report=html
79
- - name : Upload pytest test results
80
- uses : actions/upload-artifact@v4
101
+ echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV"
102
+ uv run pytest --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT" --cov=. --cov-report=xml --cov-report=html
103
+
104
+ - name : Render the report to the PR when tests fail
105
+ uses : marocchino/sticky-pull-request-comment@v2
106
+ if : failure()
81
107
with :
82
- name : archiver-test-results
83
- path : ./junit/test-results.xml
84
- # Use always() to always run this step to publish test results when there are test failures
85
- if : ${{ always() }}
108
+ header : test-report
109
+ recreate : true
110
+ path : ${{ env.REPORT_FILE }}
86
111
87
- build_runtime_image :
112
+ - name : Output reports to the job summary when tests fail
113
+ shell : bash
114
+ run : |
115
+ if [ -f "$REPORT_FILE" ]; then
116
+ echo "<details><summary>Failed Test Report</summary>" >> $GITHUB_STEP_SUMMARY
117
+ echo "" >> $GITHUB_STEP_SUMMARY
118
+ cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY
119
+ echo "" >> $GITHUB_STEP_SUMMARY
120
+ echo "</details>" >> $GITHUB_STEP_SUMMARY
121
+ fi
122
+
123
+ build_flows_image :
88
124
runs-on : ubuntu-latest
89
125
permissions :
90
126
packages : write
91
127
contents : read
92
128
93
- needs : test_archiver_flows
94
- if : ${{ needs.detect_changes.outputs.backend == 'true' }} || github.event_name != 'pull_request'
129
+ needs : test_flows
130
+ if : ${{ needs.detect_changes.outputs.archiver == 'true' }} || github.event_name != 'pull_request'
95
131
96
132
steps :
97
133
- uses : actions/checkout@v4
@@ -114,10 +150,9 @@ jobs:
114
150
id : build-and-push
115
151
uses : docker/build-push-action@v6
116
152
with :
117
- context : ./
118
- file : ./backend/prefect- runtime.Dockerfile
153
+ context : ./backend/archiver
154
+ file : ./backend/prefect/ runtime.Dockerfile
119
155
push : ${{ github.event_name != 'pull_request' }}
120
- build-args : PREFECT_VERSION=3.0.4-python3.11
121
156
tags : ${{ steps.meta.outputs.tags }}
122
157
labels : ${{ steps.meta.outputs.labels }}
123
158
@@ -127,8 +162,8 @@ jobs:
127
162
packages : write
128
163
contents : read
129
164
130
- needs : test_archiver_flows
131
- if : ${{ needs.detect_changes.outputs.backend == 'true' }} || github.event_name != 'pull_request'
165
+ needs : test_flows
166
+ if : ${{ needs.detect_changes.outputs.prefect == 'true' }} || github.event_name != 'pull_request'
132
167
133
168
steps :
134
169
- uses : actions/checkout@v4
@@ -152,20 +187,20 @@ jobs:
152
187
uses : docker/build-push-action@v6
153
188
with :
154
189
context : ./backend/
155
- file : ./backend/prefect- config.Dockerfile
190
+ file : ./backend/prefect/ config.Dockerfile
156
191
push : ${{ github.event_name != 'pull_request' }}
157
- build-args : PREFECT_VERSION=3.0.4 -python3.11
192
+ build-args : PREFECT_VERSION=3.1.11 -python3.11
158
193
tags : ${{ steps.meta.outputs.tags }}
159
194
labels : ${{ steps.meta.outputs.labels }}
160
195
161
- build_openem_backend :
196
+ build_service_api_image :
162
197
runs-on : ubuntu-latest
163
198
164
199
permissions :
165
200
packages : write
166
201
contents : read
167
202
168
- # needs: test_api_server
203
+ needs : detect_changes
169
204
if : ${{ needs.detect_changes.outputs.backend == 'true' }} || github.event_name != 'pull_request'
170
205
171
206
steps :
0 commit comments