-
Notifications
You must be signed in to change notification settings - Fork 27
125 lines (103 loc) · 3 KB
/
ci.yml
File metadata and controls
125 lines (103 loc) · 3 KB
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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
backend:
- 'backend/**'
- 'schema/**'
frontend:
- 'frontend/**'
- 'schema/**'
- 'schema-js/**'
backend:
name: Backend Tests
needs: changes
if: ${{ needs.changes.outputs.backend == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
env:
SQLX_OFFLINE: true
steps:
- uses: actions/checkout@v4
- name: Install protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, llvm-tools-preview
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
backend/target
key: ${{ runner.os }}-cargo-${{ hashFiles('backend/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run unit tests
run: cargo test
- name: Run clippy (with dev-mode features)
run: cargo clippy --features dev-mode -- -D warnings
- name: Run all tests (including integration)
run: cargo test --features dev-mode
# - name: Install cargo-llvm-cov
# uses: taiki-e/install-action@cargo-llvm-cov
# - name: Generate coverage report
# run: cargo llvm-cov --features dev-mode --html
# - name: Upload coverage report
# uses: actions/upload-artifact@v4
# with:
# name: coverage-report
# path: backend/target/llvm-cov/html/
frontend:
name: Frontend Checks
needs: changes
if: ${{ needs.changes.outputs.frontend == 'true' }}
runs-on: ubuntu-latest
env:
PUBLIC_KINDE_CLIENT_ID: dummy
PUBLIC_KINDE_DOMAIN: https://example.com
PUBLIC_SERVER_URL: ws://localhost:8080
PUBLIC_KINDE_REDIRECT_URI: http://localhost:5173
PUBLIC_SCENARIOS_SERVER_URL: http://localhost:8000
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run type check
run: pnpm --filter frontend run check
- name: Run lint
run: pnpm --filter frontend run lint