Skip to content

Update test workflow to Trilium 0.94 #152

Update test workflow to Trilium 0.94

Update test workflow to Trilium 0.94 #152

Workflow file for this run

name: Test
on:
push:
branches:
- '*'
pull_request:
workflow_dispatch:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/cache@v4
with:
path: app/build
key: ${{ runner.os }}-build-${{ hashFiles('app/build.gradle') }}
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
- uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.yaml') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1.5G
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}-
# created more than this number of seconds ago
purge-created: 0
# or, last accessed more than this number of seconds ago
# relative to the start of the `Post Restore and save Nix store` phase
purge-last-accessed: 0
# except any version with the key that is the same as the `primary-key`
purge-primary-key: never
- name: Install Trilium Server and ImageMagick
run: nix profile install github:TriliumNext/Notes/c40e224727a8b00c864bc3f525ca9a6670d17254#server nixpkgs/master#imagemagick
- name: Run Trilium Server
run: ./app/test/setup-test-server.sh
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Configure test networking
run: "sed -i 's/LOCAL_TEST = true/LOCAL_TEST = false/g' app/src/androidTest/kotlin/eu/fliegendewurst/triliumdroid/InitialSyncTest.kt"
- name: Configure Gradle wrapper
run: gradle wrapper --no-daemon
- name: Run unit tests
run: ./gradlew :app:testDebugUnitTest
- name: Run emulator tests
run: ./gradlew :app:pixel9api35DebugAndroidTest
- name: Upload screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: app/build/outputs/managed_device_android_test_additional_output/debug/pixel9api35/*
- name: Compare screenshots to reference
run: ./app/test/compare-test-images.sh
- name: Delete screenshots before caching
run: rm app/build/outputs/managed_device_android_test_additional_output/debug/pixel9api35/* 2>/dev/null || true