-
Notifications
You must be signed in to change notification settings - Fork 6
154 lines (131 loc) · 4.16 KB
/
ci.yml
File metadata and controls
154 lines (131 loc) · 4.16 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
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
name: CI Fast
on:
pull_request:
branches: [ main, develop ]
paths-ignore:
- "**/*.md"
- "docs/**"
concurrency:
group: ci-fast-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
FEATURES: "postgres sqlite redis s3 metrics tracing websockets analytics"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-lint-fast-${{ hashFiles('**/Cargo.lock') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --lib --tests --bins --features "$FEATURES" -- -D warnings --force-warn clippy::collapsible-if
- name: Provider consistency guards
run: |
cargo test test_catalog_entries_are_supported_selectors --lib
cargo test test_catalog_entries_are_creatable_via_factory --lib
cargo test core::router::gateway_config::tests:: --lib
- name: Schema duplication guards
run: bash scripts/guards/check_schema_duplicates.sh
- name: API/runtime boundary guard
run: bash scripts/guards/check_api_runtime_boundary.sh
- name: PR scope guard
if: github.event_name == 'pull_request'
run: |
git fetch origin main --depth=1
bash scripts/guards/check_pr_scope.sh origin/main
feature-matrix:
name: Feature Matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: lite
features: "lite"
- name: sqlite-redis
features: "sqlite,redis"
- name: postgres-redis
features: "postgres,redis"
- name: sqlite-redis-observability
features: "sqlite,redis,metrics,tracing"
- name: postgres-redis-s3-observability
features: "postgres,redis,s3,metrics,tracing"
- name: current-ci-bundle
features: "postgres,sqlite,redis,s3,metrics,tracing,websockets,analytics"
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-feature-matrix-${{ matrix.name }}-${{ hashFiles('**/Cargo.lock') }}
- name: Check feature combo (${{ matrix.name }})
run: cargo check --lib --locked --no-default-features --features "${{ matrix.features }}"
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_DB: gateway_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-test-fast-${{ hashFiles('**/Cargo.lock') }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpq-dev
- name: Run tests
run: cargo test --lib --tests --bins --features "$FEATURES" --verbose
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/gateway_test
REDIS_URL: redis://localhost:6379
JWT_SECRET: test-secret-key-for-ci
RUST_LOG: debug