-
Notifications
You must be signed in to change notification settings - Fork 3
134 lines (107 loc) · 3.48 KB
/
pull-request.yaml
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
name: Pull Request
on:
pull_request:
branches:
- "main"
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: "--cfg=ci_run"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
UV_VERSION: "0.4.29"
UV_FROZEN: 1
UV_EXTRA_INDEX_URL: "https://github_actions:${{secrets.PRIVATE_PYPI_PASS}}@cqcpythonrepository.azurewebsites.net/simple/"
jobs:
check-rust:
name: Check Rust
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']
run-type: ["lint", "test"]
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
if: ${{ matrix.run-type == 'test' }}
- name: Setup dependencies.
run: uv sync --python ${{ matrix.python-version }}
if: ${{ matrix.run-type == 'test' }}
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
# if: ${{ matrix.run-type == 'test' }}
- name: "Run tests"
run: |
(cd tierkreis-server && cargo build)
uv run cargo test --verbose
if: ${{ matrix.run-type == 'test' }}
- name: "Check code with rustfmt"
run: cargo fmt -- --check
if: ${{ matrix.run-type == 'lint' }}
- name: "Lint code with clippy"
run: |
cargo clippy -- -D warnings
if: ${{ matrix.run-type == 'lint' }}
- name: "Generate crate docs"
run: cargo doc --no-deps --all-features --workspace
env:
RUSTDOCFLAGS: "-Dwarnings"
if: ${{ matrix.run-type == 'lint' }}
- uses: actions/upload-artifact@v4
with:
name: tierkreis-server
path: target/debug/tierkreis-server
if: ${{ matrix.run-type == 'test' }}
check-python:
name: Check tierkreis python
runs-on: ubuntu-latest
needs: check-rust
strategy:
matrix:
python-version: ['3.10']
steps:
- uses: actions/checkout@v4
- uses: mozilla-actions/[email protected]
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
- name: Install Protoc
uses: arduino/setup-protoc@v3
- name: Setup dependencies.
run: uv sync --python ${{ matrix.python-version }}
- name: Check formatting with ruff
run: uv run ruff format --check
- name: Lint with ruff
run: uv run ruff check
- name: Check static typing with pyright
run: |
(cd python && uv run pyright)
(cd integration && uv run pyright)
- uses: actions/download-artifact@v4
with:
name: tierkreis-server
path: target/debug
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Test with pytest
env:
SERVER: target/debug/tierkreis-server
CONFIG_FILE: .github/workflows/pr_server_config.json
RUN_SCRIPT: .github/workflows/run_with_server
run: |
uv run pytest python
chmod +x $SERVER $RUN_SCRIPT
# run pytest with local server
uv run $RUN_SCRIPT $SERVER $CONFIG_FILE pytest python --host=localhost --port=8090 --client-only
- run: uv run pytest integration