ci: add GitHub Actions workflow for testing all 5 languages

Swadhin Biswas committed 7 months ago
241bf5b
1 parent 9f1832f
commit 241bf5b
1 file changed
+188 -0
Showing 1 changed file+188-0
▼.github/workflows/ci.yml
+188-0
1
+name: CI
2
+
3
+on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+concurrency:
10
+ group: ci-${{ github.ref }}
11
+ cancel-in-progress: true
12
+
13
+jobs:
14
+ # ── Python ──────────────────────────────────────────────────────────
15
+ test-python:
16
+ name: Test Python
17
+ runs-on: ubuntu-latest
18
+ defaults:
19
+ run:
20
+ working-directory: PYTHON
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v4
26
+ with:
27
+ version: "latest"
28
+
29
+ - name: Set up Python
30
+ uses: actions/setup-python@v5
31
+ with:
32
+ python-version: "3.12"
33
+
34
+ - name: Install dependencies
35
+ run: uv sync
36
+
37
+ - name: Run tests
38
+ run: uv run pytest -v
39
+
40
+ # ── JavaScript / TypeScript ─────────────────────────────────────────
41
+ test-js:
42
+ name: Test JavaScript
43
+ runs-on: ubuntu-latest
44
+ defaults:
45
+ run:
46
+ working-directory: JS
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Set up Node.js
51
+ uses: actions/setup-node@v4
52
+ with:
53
+ node-version: "20"
54
+ cache: "npm"
55
+ cache-dependency-path: JS/package-lock.json
56
+
57
+ - name: Install dependencies
58
+ run: npm ci || npm install
59
+
60
+ - name: Build
61
+ run: npm run build
62
+
63
+ - name: Run tests
64
+ run: npm test
65
+
66
+ # ── Rust ────────────────────────────────────────────────────────────
67
+ test-rust:
68
+ name: Test Rust
69
+ runs-on: ubuntu-latest
70
+ defaults:
71
+ run:
72
+ working-directory: RUST
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+
76
+ - name: Set up Rust
77
+ uses: dtolnay/rust-toolchain@stable
78
+
79
+ - name: Cache cargo
80
+ uses: actions/cache@v4
81
+ with:
82
+ path: |
83
+ ~/.cargo/bin/
84
+ ~/.cargo/registry/index/
85
+ ~/.cargo/registry/cache/
86
+ ~/.cargo/git/db/
87
+ RUST/target/
88
+ key: cargo-${{ runner.os }}-${{ hashFiles('RUST/Cargo.lock', 'RUST/Cargo.toml') }}
89
+ restore-keys: cargo-${{ runner.os }}-
90
+
91
+ - name: Build
92
+ run: cargo build --verbose
93
+
94
+ - name: Run tests
95
+ run: cargo test --verbose
96
+
97
+ # ── Go ──────────────────────────────────────────────────────────────
98
+ test-go:
99
+ name: Test Go
100
+ runs-on: ubuntu-latest
101
+ defaults:
102
+ run:
103
+ working-directory: GO
104
+ steps:
105
+ - uses: actions/checkout@v4
106
+
107
+ - name: Set up Go
108
+ uses: actions/setup-go@v5
109
+ with:
110
+ go-version: "1.21"
111
+ cache-dependency-path: GO/go.sum
112
+
113
+ - name: Download dependencies
114
+ run: go mod download
115
+
116
+ - name: Build
117
+ run: go build ./...
118
+
119
+ - name: Run tests
120
+ run: go test -v ./cortexa/
121
+
122
+ # ── Zig ─────────────────────────────────────────────────────────────
123
+ test-zig:
124
+ name: Test Zig
125
+ runs-on: ubuntu-latest
126
+ defaults:
127
+ run:
128
+ working-directory: ZIG
129
+ steps:
130
+ - uses: actions/checkout@v4
131
+
132
+ - name: Set up Zig
133
+ uses: mlugg/setup-zig@v2
134
+ with:
135
+ version: "0.14.0"
136
+
137
+ - name: Build
138
+ run: zig build
139
+
140
+ - name: Run tests
141
+ run: zig build test
142
+
143
+ # ── Lua ──────────────────────────────────────────────────────────
144
+ test-lua:
145
+ name: Test Lua
146
+ runs-on: ubuntu-latest
147
+ defaults:
148
+ run:
149
+ working-directory: LUA
150
+ steps:
151
+ - uses: actions/checkout@v4
152
+
153
+ - name: Install Lua and LuaFileSystem
154
+ run: |
155
+ sudo apt-get update -qq
156
+ sudo apt-get install -y -qq lua5.4 liblua5.4-dev luarocks
157
+ sudo luarocks install luafilesystem
158
+
159
+ - name: Run tests
160
+ run: lua test.lua
161
+
162
+ # ── Elixir ───────────────────────────────────────────────────────
163
+ test-elixir:
164
+ name: Test Elixir
165
+ runs-on: ubuntu-latest
166
+ defaults:
167
+ run:
168
+ working-directory: ELIXIR
169
+ steps:
170
+ - uses: actions/checkout@v4
171
+
172
+ - name: Set up Elixir
173
+ uses: erlef/setup-beam@v1
174
+ with:
175
+ elixir-version: "1.16"
176
+ otp-version: "26"
177
+
178
+ - name: Install dependencies
179
+ run: |
180
+ mix local.hex --force
181
+ mix local.rebar --force
182
+ mix deps.get
183
+
184
+ - name: Compile
185
+ run: mix compile --warnings-as-errors
186
+
187
+ - name: Run tests
188
+ run: mix test --trace
0
189