Repository navigation
139 lines (135 loc) · 5.17 KB
/
Copy pathci.yml
File metadata and controls
139 lines (135 loc) · 5.17 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.0
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: 26
- name: Install example and fixture dependencies
run: |
npm install --no-audit --no-fund --prefix examples/express_demo
npm ci --no-audit --no-fund --prefix examples/cjs_demo
npm ci --no-audit --no-fund --prefix tests/fixtures/frameworks
- run: python3 tests/installers.py
- run: cargo fmt --all -- --check
- run: cargo clippy --locked --all-targets -- -D warnings
- run: cargo test --locked
- name: Installer (latest release)
continue-on-error: true
run: |
MALIA_NO_MODIFY_PATH=1 MALIA_INSTALL_DIR="$RUNNER_TEMP/malia" sh scripts/install.sh
"$RUNNER_TEMP/malia/bin/malia" eval "console.log(process.version, navigator.userAgent)"
windows:
name: Build and test (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.0
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: 26
- name: Install required fixtures
run: |
npm install --no-audit --no-fund --prefix examples/express_demo
npm ci --no-audit --no-fund --prefix examples/cjs_demo
npm ci --no-audit --no-fund --prefix tests/fixtures/frameworks
- run: cargo build --locked --bins
- name: Smoke test
shell: bash
run: |
./target/debug/malia run examples/hello.ts
./target/debug/malia eval --allow-all "const fs = await import('node:fs'); const os = await import('node:os'); const p = await import('node:path'); const f = p.join(os.tmpdir(), 'jse-ci.txt'); fs.writeFileSync(f, 'ok'); console.log(fs.readFileSync(f, 'utf8'), p.sep, os.platform(), fs.statSync(f).isFile());"
- run: cargo test --locked
- name: Installer (latest release)
continue-on-error: true
shell: pwsh
run: |
$env:MALIA_INSTALL_DIR = "$env:RUNNER_TEMP\malia"
./scripts/install.ps1
& "$env:RUNNER_TEMP\malia\bin\malia.exe" eval "console.log(process.version, navigator.userAgent)"
if ($LASTEXITCODE -ne 0) { throw "installed malia failed" }
databases:
name: Database drivers (Linux)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_PASSWORD: secret
ports: ["5432:5432"]
options: --health-cmd "pg_isready -U postgres" --health-interval 5s --health-retries 20
mysql:
image: mysql:8.4
env:
MYSQL_ROOT_PASSWORD: secret
MYSQL_DATABASE: app
ports: ["3306:3306"]
options: --health-cmd "mysqladmin ping -h 127.0.0.1 -psecret" --health-interval 5s --health-retries 30
redis:
image: redis:7-alpine
ports: ["6379:6379"]
options: --health-cmd "redis-cli ping" --health-interval 5s --health-retries 20
mongo:
image: mongo:7
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: secret
ports: ["27017:27017"]
options: >-
--health-cmd "mongosh --quiet --eval 'db.runCommand({ping:1})'"
--health-interval 5s --health-retries 30
dynamodb:
image: amazon/dynamodb-local
ports: ["8000:8000"]
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.15.3
env:
discovery.type: single-node
xpack.security.enabled: "false"
ES_JAVA_OPTS: -Xms512m -Xmx512m
ports: ["9200:9200"]
options: --health-cmd "curl -fs http://127.0.0.1:9200/_cluster/health" --health-interval 10s --health-retries 30
cassandra:
image: cassandra:5
env:
MAX_HEAP_SIZE: 512M
HEAP_NEWSIZE: 128M
ports: ["9042:9042"]
options: --health-cmd "cqlsh -e 'describe keyspaces'" --health-interval 10s --health-retries 40
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.97.0
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: 26
- run: npm ci --no-audit --no-fund --prefix tests/db
- run: cargo build --locked --bin malia
- name: Run drivers against live servers
working-directory: tests/db
env:
JSE_PG_URL: postgres://postgres:secret@127.0.0.1:5432/postgres
JSE_MYSQL_URL: mysql://root:secret@127.0.0.1:3306/app
JSE_REDIS_URL: redis://127.0.0.1:6379
JSE_MONGO_URL: mongodb://root:secret@127.0.0.1:27017/?authSource=admin
JSE_DYNAMO_URL: http://127.0.0.1:8000
JSE_ES_URL: http://127.0.0.1:9200
JSE_CASSANDRA: 127.0.0.1:9042
JSE_DB_REQUIRE_ALL: "1"
run: ../../target/debug/malia run --allow-all drivers.mjs