chore(ci): run unit tests in dev workflow

This commit is contained in:
Elian Doran 2025-02-26 18:58:27 +02:00
parent bd933dde28
commit 6fcd229b52
No known key found for this signature in database

View File

@ -33,6 +33,10 @@ jobs:
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Run the unit tests
run: npm run test
build_docker: build_docker:
name: Build Docker image name: Build Docker image
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -45,7 +49,7 @@ jobs:
with: with:
node-version: 20 node-version: 20
cache: "npm" cache: "npm"
- run: npm ci - run: npm ci
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Create server-package.json - name: Create server-package.json
@ -55,7 +59,7 @@ jobs:
with: with:
context: . context: .
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
test_docker: test_docker:
name: Check Docker build name: Check Docker build
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -69,7 +73,7 @@ jobs:
steps: steps:
- name: Checkout the repository - name: Checkout the repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set IMAGE_NAME to lowercase - name: Set IMAGE_NAME to lowercase
run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV run: echo "IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV
- name: Set TEST_TAG to lowercase - name: Set TEST_TAG to lowercase
@ -83,12 +87,12 @@ jobs:
with: with:
node-version: 20 node-version: 20
cache: "npm" cache: "npm"
- run: npm ci - run: npm ci
- name: Run the TypeScript build - name: Run the TypeScript build
run: npx tsc run: npx tsc
- name: Create server-package.json - name: Create server-package.json
run: cat package.json | grep -v electron > server-package.json run: cat package.json | grep -v electron > server-package.json
@ -101,12 +105,12 @@ jobs:
tags: ${{ env.TEST_TAG }} tags: ${{ env.TEST_TAG }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
- name: Validate container run output - name: Validate container run output
run: | run: |
CONTAINER_ID=$(docker run -d --log-driver=journald --rm --name trilium_local ${{ env.TEST_TAG }}) CONTAINER_ID=$(docker run -d --log-driver=journald --rm --name trilium_local ${{ env.TEST_TAG }})
echo "Container ID: $CONTAINER_ID" echo "Container ID: $CONTAINER_ID"
- name: Wait for the healthchecks to pass - name: Wait for the healthchecks to pass
uses: stringbean/docker-healthcheck-action@v3 uses: stringbean/docker-healthcheck-action@v3
with: with: