Skip to content

Commit 5295d95

Browse files
committed
ci: Add Docker test step
1 parent a8814f0 commit 5295d95

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/workflows/main-docker.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,51 @@ env:
1515
GHCR_REGISTRY: ghcr.io
1616
DOCKERHUB_REGISTRY: docker.io
1717
IMAGE_NAME: ${{ github.repository }}
18+
TEST_TAG: triliumnext/notes:test
1819

1920
jobs:
21+
test_docker:
22+
name: Check Docker build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Checkout the repository
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
31+
- name: Set up node & dependencies
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: "npm"
36+
37+
- run: npm ci
38+
39+
- name: Run the TypeScript build
40+
run: npx tsc
41+
42+
- name: Create server-package.json
43+
run: cat package.json | grep -v electron > server-package.json
44+
45+
- name: Build and export to Docker
46+
uses: docker/build-push-action@v6
47+
with:
48+
context: .
49+
load: true
50+
tags: ${{ env.TEST_TAG }}
51+
cache-from: type=gha
52+
cache-to: type=gha,mode=max
53+
54+
- name: Run the container
55+
run: |
56+
docker run --rm ${{ env.TEST_TAG }}
57+
2058
build_docker:
2159
name: Build Docker images
2260
runs-on: ubuntu-latest
61+
needs:
62+
- test_docker
2363
permissions:
2464
contents: read
2565
packages: write

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
paths-ignore:
99
- "docs/**"
1010
- "bin/**"
11+
- ".github/workflows/main-docker.yml"
1112
tags:
1213
- "v*"
1314
workflow_dispatch:

0 commit comments

Comments
 (0)