Skip to content

Commit cec2942

Browse files
authored
Merge pull request #1 from flyingrobots/fix/ci-pipeline
fix(ci): Robust E2E & Unit Test Pipeline
2 parents 3119118 + aafe963 commit cec2942

7 files changed

Lines changed: 62 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,47 @@ on:
77
branches: [ main ]
88

99
jobs:
10-
test:
10+
unit-test:
11+
name: Unit Tests (Docker)
1112
runs-on: ubuntu-latest
1213
steps:
1314
- uses: actions/checkout@v4
1415

15-
- name: Setup Node.js
16-
uses: actions/setup-node@v4
16+
- name: Run Unit Tests
17+
run: ./test/run-docker.sh
18+
19+
e2e-test:
20+
name: E2E Tests (Playwright)
21+
runs-on: ubuntu-latest
22+
container:
23+
image: mcr.microsoft.com/playwright:v1.57.0-jammy
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- uses: actions/setup-node@v4
1728
with:
1829
node-version: '20'
1930
cache: 'npm'
20-
31+
32+
# Git is required in the container to perform plumbing operations during E2E tests
33+
- name: Install Git
34+
run: apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/*
35+
36+
- name: Configure Git User
37+
run: |
38+
git config --global user.email "ci@git-cms.local"
39+
git config --global user.name "CI Bot"
40+
git config --global init.defaultBranch main
41+
2142
- name: Install Dependencies
2243
run: npm ci
2344

24-
- name: Run Tests (Docker)
25-
run: npm test
45+
- name: Run Playwright Tests
46+
run: npm run test:e2e
47+
48+
- uses: actions/upload-artifact@v4
49+
if: always()
50+
with:
51+
name: playwright-report
52+
path: playwright-report/
53+
retention-days: 30

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# git-cms
22

3+
<img src="./docs/images/hero.png" width="600" alt="Burnt-Out Linux Penguin" align="right" />
4+
35
A serverless, database-free CMS built on Git plumbing.
46

57
> "I'm using `git push` as my API endpoint."
@@ -37,7 +39,7 @@ npm run dev
3739
# OR
3840
docker compose up app
3941
```
40-
The API and Admin UI will be available at `http://localhost:4637`.
42+
The API and Admin UI will be available at `http://localhost:4638`.
4143

4244
### Run Tests
4345
```bash

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ services:
77
- .:/app
88
- /app/node_modules
99
ports:
10-
- "4637:4637"
10+
- "4638:4638"
1111
environment:
12-
- PORT=4637
12+
- PORT=4638
1313
- GIT_CMS_ENV=dev
1414
command: npm run serve
1515

docs/images/hero.png

3.2 MB
Loading

node_modules/.package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { parseArticleCommit } from '../lib/parse.js';
99
import { chunkFileToRef } from '../lib/chunks.js';
1010

1111
const __dirname = path.dirname(new URL(import.meta.url).pathname);
12-
const PORT = process.env.PORT || 4637;
12+
const PORT = process.env.PORT || 4638;
1313
const CWD = process.env.GIT_CMS_REPO || process.cwd();
1414
const ENV = (process.env.GIT_CMS_ENV || 'dev').toLowerCase();
1515
const REF_PREFIX = process.env.CMS_REF_PREFIX || `refs/_blog/${ENV}`;

vitest.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { defineConfig, defaultExclude } from 'vitest/config';
2+
3+
export default defineConfig({
4+
test: {
5+
exclude: [...defaultExclude, 'test/e2e/**'],
6+
},
7+
});

0 commit comments

Comments
 (0)