-
Notifications
You must be signed in to change notification settings - Fork 5
141 lines (118 loc) · 3.16 KB
/
test.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
name: Ahnlich TestSuite
on:
push:
branches: ["main"]
paths:
- ahnlich/**
- sdk/**
pull_request:
branches: ["main"]
paths:
- ahnlich/**
- sdk/**
env:
CARGO_TERM_COLOR: always
jobs:
run-rust-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: ahnlich
- name: Set up cargo and rustup tools
run: |
which cargo-nextest || cargo install cargo-nextest
- name: Cache Docker images.
uses: ScribeMD/docker-cache@0.5.0
with:
key: ${{ runner.os }}-cargo-${{ hashFiles('ahnlich/Cargo.lock') }}
- name: Cache Ahnlich Home directory images.
uses: actions/cache@v4
with:
path: ~/.ahnlich
key: ${{ runner.os }}-ahnlich-models
- name: Format and Lint
working-directory: ./ahnlich
run: |
make format
make clippy
- name: Run Test
working-directory: ./ahnlich
run: |
make test
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: rust
path: ahnlich/target/nextest/default/rust.xml
run-python-tests:
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Run image
uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.7.0
- name: View poetry --help
run: poetry --help
- name: Cache using poetry lock
uses: actions/cache@v4
with:
path: ./.venv
key: venv-${{ hashFiles('poetry.lock') }}
- name: Installing poetry dependencies
working-directory: ./sdk/ahnlich-client-py
run: poetry install
- name: Check Python Linting
working-directory: ./sdk/ahnlich-client-py
run: |
poetry run isort . -c --profile black; echo $?
poetry run black . --check; echo $?
- name: Complie Binaries
working-directory: ./ahnlich
run: |
cargo build
- name: Run Python Client Tests
working-directory: ./sdk/ahnlich-client-py
env:
AHNLICH_DB_HOST: "127.0.0.1"
AHNLICH_DB_PORT: 1349
AHNLICH_AI_HOST: "127.0.0.1"
AHNLICH_AI_PORT: 8000
run: |
poetry run pytest -s -vv --junitxml=./python.xml
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: python
path: sdk/ahnlich-client-py/python.xml
upload-test-results:
if: always()
runs-on: ubuntu-latest
needs: ["run-rust-tests", "run-python-tests"]
steps:
- name: Download Rust Test Output
uses: actions/download-artifact@v4
with:
name: rust
path: ./rust
- name: Download Python Test Output
uses: actions/download-artifact@v4
with:
name: python
path: ./python
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/macos@v2
if: always()
with:
files: |
rust/*.xml
python/*.xml