Fix: CI bestand hernoemd naar .yaml voor contract tests
This commit is contained in:
1 parent
c992bed970
commit
f0efb6b169
1 file changed
@@ -0,0 +1,80 @@
|
||||
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! ---"
|
||||
Reference in new issue
Block a user