forked from Echo-Mirror-Butler/echomirror-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (95 loc) · 2.88 KB
/
Copy pathrust-ci.yml
File metadata and controls
102 lines (95 loc) · 2.88 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
name: Rust CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
with:
key: ${{ hashFiles('Cargo.lock') }}
# --all-features compiles echomirror-sync's `postgres` feature too;
# runtime queries + embedded migrations need no live database.
- run: cargo clippy --workspace --all-targets --all-features -- -D warnings
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ hashFiles('Cargo.lock') }}
- run: cargo test --workspace
test-sync-postgres:
name: Test (echomirror-sync + PostgreSQL)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: echomirror_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/echomirror_test
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ hashFiles('Cargo.lock') }}-postgres
- run: cargo test -p echomirror-sync --features postgres
wasm-build:
name: WASM Build (@echomirror/wasm)
runs-on: ubuntu-latest
needs: [fmt, clippy, test]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
key: ${{ hashFiles('Cargo.lock') }}-wasm
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
# Builds both wasm-pack targets (web + nodejs) via wasm-pack build,
# with wasm-opt applied per crates/echomirror-wasm/Cargo.toml, then
# compiles the hand-written TS wrapper.
- run: npm run build:wasm -w packages/js/wasm
- run: npm run build -w packages/js/wasm
- run: npm run size -w packages/js/wasm
- run: npm run test -w packages/js/wasm
- name: Install Playwright Chromium
run: npx playwright install --with-deps chromium
- run: npm run test:browser -w packages/js/wasm