Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c949319332 | ||
|
|
e97a9f3119 | ||
|
|
f0efb6b169 | ||
|
|
c992bed970 | ||
|
|
d01975706d |
No files matched your search
+53
-512
File diff suppressed because it is too large.
Load diff
@@ -1,80 +0,0 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
tags:
|
||||
- "v*"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ gitea.repository }}
|
||||
token: ${{ gitea.token }}
|
||||
fetch-depth: 50
|
||||
|
||||
- name: Typecheck, lint, and test
|
||||
run: |
|
||||
set -e
|
||||
echo "--- CI checks starten met CPU-limieten ---"
|
||||
node scripts/check-node-toolchain.mjs
|
||||
|
||||
# OPLOSSING: Voorkom dat Node de server overbelast (max 1 thread / beperkt geheugen)
|
||||
export UV_THREADPOOL_SIZE=1
|
||||
export NODE_OPTIONS="--max-old-space-size=1536"
|
||||
|
||||
export SKIP_ENV_VALIDATION=1
|
||||
export NODE_ENV=test
|
||||
export DATABASE_URL="mysql://test:test@localhost:3306/test?charset=utf8mb4"
|
||||
export REDIS_URL="redis://127.0.0.1:6379?connect_timeout=2"
|
||||
export AUTH_SECRET="ci-test-secret-key-that-is-long-enough"
|
||||
export BCRYPT_ROUNDS=4
|
||||
|
||||
# Dwing pnpm en tools om single-threaded te draaien
|
||||
pnpm install --frozen-lockfile --jobs 1
|
||||
pnpm biome:lint --workers 1
|
||||
pnpm typecheck
|
||||
pnpm test --maxWorkers=1
|
||||
pnpm knip
|
||||
echo "--- CI checks passed ---"
|
||||
|
||||
deploy:
|
||||
needs: check
|
||||
if: gitea.event_name == 'push' && (gitea.ref_name == 'main' || gitea.ref_name == 'master')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository code for deploy
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ gitea.repository }}
|
||||
token: ${{ gitea.token }}
|
||||
|
||||
- name: Build and Deploy Container
|
||||
run: |
|
||||
set -e
|
||||
echo "--- Start Docker Build & Deploy ---"
|
||||
|
||||
# Bouw ook de Docker container op slechts 1 CPU kern om lag te voorkomen
|
||||
docker build --build-arg NODE_OPTIONS="--max-old-space-size=1536" -t epicnext-cms:latest .
|
||||
|
||||
docker stop epicnext-cms-app 2>/dev/null || true
|
||||
docker rm epicnext-cms-app 2>/dev/null || true
|
||||
|
||||
docker run -d \
|
||||
--name epicnext-cms-app \
|
||||
--restart always \
|
||||
--net=host \
|
||||
epicnext-cms:latest
|
||||
|
||||
docker image prune -f
|
||||
echo "--- Deployment succesvol afgerond! ---"
|
||||
@@ -13,34 +13,21 @@ describe("CI workflow", () => {
|
||||
expect(workflow).toContain("pnpm typecheck");
|
||||
expect(workflow).toContain("pnpm test");
|
||||
expect(workflow).toContain("needs: check");
|
||||
expect(workflow).toContain(
|
||||
"gitea.event_name == 'push' && gitea.ref_name == 'main'",
|
||||
);
|
||||
expect(workflow).toContain("worktree add --detach");
|
||||
expect(workflow).toContain("gitea.event_name == 'push'");
|
||||
expect(workflow).toContain("gitea.ref_name == 'main'");
|
||||
expect(workflow).toContain("/api/health");
|
||||
expect(workflow).not.toContain("github.ref");
|
||||
});
|
||||
|
||||
it("uses Gitea SHA for check checkout", () => {
|
||||
expect(workflow).toContain("gitea.sha");
|
||||
expect(workflow).toContain("SKIP_ENV_VALIDATION=1");
|
||||
});
|
||||
|
||||
it("keeps tag release in the same workflow", () => {
|
||||
it("includes tag triggers", () => {
|
||||
expect(workflow).toContain('tags:\n - "v*"');
|
||||
expect(workflow).toContain("Creating release for");
|
||||
expect(workflow).toContain("startsWith(gitea.ref_name, 'v')");
|
||||
});
|
||||
|
||||
it("applies CMS migrations on tag release before build", () => {
|
||||
const release = workflow.slice(workflow.indexOf("\n release:"));
|
||||
expect(release).toContain("pnpm db:migrate");
|
||||
expect(release).not.toContain("pnpm prisma:generate");
|
||||
expect(release).toContain("pnpm db:migrate");
|
||||
expect(release).toContain("src/db/schema.ts");
|
||||
const migrateAt = release.indexOf("pnpm db:migrate");
|
||||
const buildAt = release.indexOf("pnpm build");
|
||||
expect(migrateAt).toBeGreaterThan(-1);
|
||||
expect(buildAt).toBeGreaterThan(migrateAt);
|
||||
it("runs knip for unused code detection", () => {
|
||||
expect(workflow).toContain("pnpm knip");
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user