diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e733c79..32fbe86 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,19 +7,47 @@ on: branches: [ main ] jobs: - test: + unit-test: + name: Unit Tests (Docker) runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup Node.js - uses: actions/setup-node@v4 + - name: Run Unit Tests + run: ./test/run-docker.sh + + e2e-test: + name: E2E Tests (Playwright) + runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/playwright:v1.57.0-jammy + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - + + # Git is required in the container to perform plumbing operations during E2E tests + - name: Install Git + run: apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/* + + - name: Configure Git User + run: | + git config --global user.email "ci@git-cms.local" + git config --global user.name "CI Bot" + git config --global init.defaultBranch main + - name: Install Dependencies run: npm ci - - name: Run Tests (Docker) - run: npm test + - name: Run Playwright Tests + run: npm run test:e2e + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 \ No newline at end of file diff --git a/README.md b/README.md index 630f443..0902730 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # git-cms +Burnt-Out Linux Penguin + A serverless, database-free CMS built on Git plumbing. > "I'm using `git push` as my API endpoint." @@ -35,7 +37,7 @@ npm run dev # OR docker compose up app ``` -The API and Admin UI will be available at `http://localhost:4637`. +The API and Admin UI will be available at `http://localhost:4638`. ### Run Tests ```bash diff --git a/docker-compose.yml b/docker-compose.yml index 5b349f9..f26046f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,9 +7,9 @@ services: - .:/app - /app/node_modules ports: - - "4637:4637" + - "4638:4638" environment: - - PORT=4637 + - PORT=4638 - GIT_CMS_ENV=dev command: npm run serve diff --git a/docs/images/hero.png b/docs/images/hero.png new file mode 100644 index 0000000..8f7a47a Binary files /dev/null and b/docs/images/hero.png differ diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 544b676..e3ca308 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -423,6 +423,21 @@ "node": ">=18" } }, + "node_modules/playwright/node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/postcss": { "version": "8.5.6", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", diff --git a/src/server/index.js b/src/server/index.js index ee49b53..b4dafa8 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -9,7 +9,7 @@ import { parseArticleCommit } from '../lib/parse.js'; import { chunkFileToRef } from '../lib/chunks.js'; const __dirname = path.dirname(new URL(import.meta.url).pathname); -const PORT = process.env.PORT || 4637; +const PORT = process.env.PORT || 4638; const CWD = process.env.GIT_CMS_REPO || process.cwd(); const ENV = (process.env.GIT_CMS_ENV || 'dev').toLowerCase(); const REF_PREFIX = process.env.CMS_REF_PREFIX || `refs/_blog/${ENV}`; diff --git a/vitest.config.js b/vitest.config.js new file mode 100644 index 0000000..b5087aa --- /dev/null +++ b/vitest.config.js @@ -0,0 +1,7 @@ +import { defineConfig, defaultExclude } from 'vitest/config'; + +export default defineConfig({ + test: { + exclude: [...defaultExclude, 'test/e2e/**'], + }, +});