Skip to content

Commit 5fcd2a0

Browse files
committed
Add a basic workflow for CI tests
1 parent 9285d6a commit 5fcd2a0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint-and-test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
lambda: [collector, external-alerts-webhook]
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
cache: 'yarn'
25+
cache-dependency-path: 'lambdas/${{ matrix.lambda }}/yarn.lock'
26+
27+
- name: Install dependencies
28+
run: |
29+
cd lambdas/${{ matrix.lambda }}
30+
yarn install --frozen-lockfile
31+
32+
- name: Run lint
33+
run: |
34+
cd lambdas/${{ matrix.lambda }}
35+
yarn lint
36+
37+
- name: Run format check
38+
run: |
39+
cd lambdas/${{ matrix.lambda }}
40+
yarn format:check
41+
42+
- name: Run tests
43+
run: |
44+
cd lambdas/${{ matrix.lambda }}
45+
if [ -f "package.json" ] && grep -q '"test"' package.json; then
46+
yarn test
47+
else
48+
echo "No tests found for ${{ matrix.lambda }}"
49+
fi

0 commit comments

Comments
 (0)