Skip to content

Commit 7b2a7b5

Browse files
committed
github actions workflow
1 parent eaf95e1 commit 7b2a7b5

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [16.x, 18.x, 20.x]
16+
# See supported Node.js versions at https://nodejs.org/en/about/releases/
17+
18+
services:
19+
# We don't actually need this service since we use testcontainers
20+
# but having it here ensures Docker is available for testcontainers
21+
registry:
22+
image: registry:2
23+
ports:
24+
- 5000:5000
25+
26+
steps:
27+
- uses: actions/checkout@v3
28+
29+
- name: Use Node.js ${{ matrix.node-version }}
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: ${{ matrix.node-version }}
33+
cache: 'npm'
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Run tests
39+
run: npm test
40+
env:
41+
# This ensures testcontainers can find Docker
42+
TESTCONTAINERS_HOST_OVERRIDE: "localhost"
43+
44+
- name: TypeCheck
45+
run: npm run typecheck
46+
47+
- name: Build package
48+
run: npm run build

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,21 @@ These tests will:
117117
4. Verify the results
118118
5. Clean up the container when done
119119

120+
### Continuous Integration
121+
122+
This project uses GitHub Actions for continuous integration. The CI workflow automatically runs on:
123+
- All pushes to the `main` branch
124+
- All pull requests targeting the `main` branch
125+
126+
The CI workflow:
127+
1. Sets up Node.js (versions 16.x, 18.x, and 20.x)
128+
2. Installs dependencies
129+
3. Runs all tests (including integration tests with MongoDB in a Docker container)
130+
4. Performs type checking
131+
5. Builds the package
132+
133+
You can see the workflow configuration in `.github/workflows/test.yml`.
134+
120135
## License
121136

122137
AGPL-3.0

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"build": "npm run clean && tsc",
1010
"test": "jest",
1111
"test:integration": "jest src/__tests__/integration.integration.test.ts --runInBand",
12+
"typecheck": "tsc --noEmit",
1213
"dev": "ts-node src/index.ts",
1314
"example": "ts-node src/examples/basic-usage.ts"
1415
},

0 commit comments

Comments
 (0)