Skip to content

Commit

Permalink
ci: Add Docker test step
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Aug 7, 2024
1 parent a8814f0 commit 5295d95
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/main-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths-ignore:
- "docs/**"
- "bin/**"
- ".github/workflows/main-docker.yml"
tags:
- "v*"
workflow_dispatch:
Expand Down

0 comments on commit 5295d95

Please sign in to comment.