Skip to content

Build your personal knowledge base with Trilium Notes

ci: Add Docker test step

Elian Doran5295d956a21a
diff --git a/.github/workflows/main-docker.yml b/.github/workflows/main-docker.yml
index ea35b8265b..019a8da93b 100644
--- a/.github/workflows/main-docker.yml
+++ b/.github/workflows/main-docker.yml
@@ -15,11 +15,51 @@ env:
GHCR_REGISTRY: ghcr.io
DOCKERHUB_REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
+ TEST_TAG: triliumnext/notes:test
jobs:
+ test_docker:
+ name: Check Docker build
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout the repository
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Set up node & dependencies
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: "npm"
+
+ - run: npm ci
+
+ - name: Run the TypeScript build
+ run: npx tsc
+
+ - name: Create server-package.json
+ run: cat package.json | grep -v electron > server-package.json
+
+ - name: Build and export to Docker
+ uses: docker/build-push-action@v6
+ with:
+ context: .
+ load: true
+ tags: ${{ env.TEST_TAG }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+
+ - name: Run the container
+ run: |
+ docker run --rm ${{ env.TEST_TAG }}
+
build_docker:
name: Build Docker images
runs-on: ubuntu-latest
+ needs:
+ - test_docker
permissions:
contents: read
packages: write
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 7a0acc027b..5870e3333a 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -8,6 +8,7 @@ on:
paths-ignore:
- "docs/**"
- "bin/**"
+ - ".github/workflows/main-docker.yml"
tags:
- "v*"
workflow_dispatch: