2022-06-19 13:16:35 +00:00
|
|
|
name: Test
|
|
|
|
on:
|
2022-07-16 05:48:35 +00:00
|
|
|
workflow_dispatch:
|
2022-06-19 13:16:35 +00:00
|
|
|
pull_request:
|
2022-08-11 13:27:44 +00:00
|
|
|
push:
|
|
|
|
branches: [main]
|
2022-06-19 13:16:35 +00:00
|
|
|
|
2023-02-19 16:44:53 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2022-06-19 13:16:35 +00:00
|
|
|
jobs:
|
2023-01-15 19:08:24 +00:00
|
|
|
e2e-tests:
|
|
|
|
name: Run end-to-end test suites
|
|
|
|
runs-on: ubuntu-latest
|
2022-06-19 13:16:35 +00:00
|
|
|
|
2023-01-15 19:08:24 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-09-06 01:50:22 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-10-06 21:32:28 +00:00
|
|
|
with:
|
|
|
|
submodules: "recursive"
|
2023-07-11 21:54:44 +00:00
|
|
|
|
|
|
|
- name: Run e2e tests
|
2023-10-06 21:32:28 +00:00
|
|
|
run: docker-compose -f ./docker/docker-compose.test.yml -p immich-test-e2e up --renew-anon-volumes --abort-on-container-exit --exit-code-from immich-server-test --remove-orphans --build
|
2022-08-11 13:27:44 +00:00
|
|
|
|
2023-04-24 17:49:20 +00:00
|
|
|
doc-tests:
|
|
|
|
name: Run documentation checks
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./docs
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-09-06 01:50:22 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-04-24 17:49:20 +00:00
|
|
|
|
|
|
|
- name: Run npm install
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Run formatter
|
|
|
|
run: npm run format
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run tsc
|
|
|
|
run: npm run check
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
2022-09-08 09:07:27 +00:00
|
|
|
server-unit-tests:
|
|
|
|
name: Run server unit test suites and checks
|
2022-08-11 13:27:44 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-04-12 20:17:27 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./server
|
2022-08-11 13:27:44 +00:00
|
|
|
|
2022-08-11 18:46:11 +00:00
|
|
|
steps:
|
2022-08-11 13:27:44 +00:00
|
|
|
- name: Checkout code
|
2023-09-06 01:50:22 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-08-11 13:27:44 +00:00
|
|
|
|
2023-04-12 20:17:27 +00:00
|
|
|
- name: Run npm install
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Run linter
|
|
|
|
run: npm run lint
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run formatter
|
|
|
|
run: npm run format
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run tsc
|
|
|
|
run: npm run check
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run unit tests & coverage
|
|
|
|
run: npm run test:cov
|
|
|
|
if: ${{ !cancelled() }}
|
2022-09-08 15:44:13 +00:00
|
|
|
|
2023-07-06 14:37:47 +00:00
|
|
|
cli-unit-tests:
|
|
|
|
name: Run cli test suites
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./cli
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-09-06 01:50:22 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-07-06 14:37:47 +00:00
|
|
|
|
|
|
|
- name: Run npm install
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Run linter
|
|
|
|
run: npm run lint
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run formatter
|
|
|
|
run: npm run format
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run unit tests & coverage
|
|
|
|
run: npm run test:cov
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
2022-09-08 15:44:13 +00:00
|
|
|
web-unit-tests:
|
|
|
|
name: Run web unit test suites and checks
|
|
|
|
runs-on: ubuntu-latest
|
2023-04-12 20:17:27 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./web
|
2022-09-08 15:44:13 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
2023-09-06 01:50:22 +00:00
|
|
|
uses: actions/checkout@v4
|
2022-09-08 15:44:13 +00:00
|
|
|
|
2023-04-12 20:17:27 +00:00
|
|
|
- name: Run npm install
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Run linter
|
|
|
|
run: npm run lint
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run formatter
|
|
|
|
run: npm run format
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run svelte checks
|
2023-06-02 13:55:08 +00:00
|
|
|
run: npm run check:svelte
|
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
|
|
|
- name: Run tsc
|
|
|
|
run: npm run check:typescript
|
2023-04-12 20:17:27 +00:00
|
|
|
if: ${{ !cancelled() }}
|
|
|
|
|
2023-07-16 01:13:04 +00:00
|
|
|
# - name: Run unit tests & coverage
|
|
|
|
# run: npm run test:cov
|
|
|
|
# if: ${{ !cancelled() }}
|
2023-01-25 16:10:04 +00:00
|
|
|
|
|
|
|
mobile-unit-tests:
|
|
|
|
name: Run mobile unit tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-06 01:50:22 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-25 16:10:04 +00:00
|
|
|
- name: Setup Flutter SDK
|
|
|
|
uses: subosito/flutter-action@v2
|
|
|
|
with:
|
2023-03-17 03:15:12 +00:00
|
|
|
channel: "stable"
|
2023-10-11 01:12:01 +00:00
|
|
|
flutter-version: "3.13.6"
|
2023-01-25 16:10:04 +00:00
|
|
|
- name: Run tests
|
|
|
|
working-directory: ./mobile
|
2023-05-17 17:36:02 +00:00
|
|
|
run: flutter test -j 1
|
2023-01-25 16:10:04 +00:00
|
|
|
|
2023-06-27 23:21:33 +00:00
|
|
|
ml-unit-tests:
|
|
|
|
name: Run ML unit tests and checks
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./machine-learning
|
|
|
|
steps:
|
2023-09-06 01:50:22 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-06-27 23:21:33 +00:00
|
|
|
- name: Install poetry
|
|
|
|
run: pipx install poetry
|
|
|
|
- uses: actions/setup-python@v4
|
|
|
|
with:
|
|
|
|
python-version: 3.11
|
|
|
|
cache: "poetry"
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
poetry install --with dev
|
2023-08-25 04:28:51 +00:00
|
|
|
poetry run pip install --no-deps -r requirements.txt
|
2023-06-27 23:21:33 +00:00
|
|
|
- name: Lint with ruff
|
|
|
|
run: |
|
|
|
|
poetry run ruff check --format=github app
|
|
|
|
- name: Check black formatting
|
|
|
|
run: |
|
|
|
|
poetry run black --check app
|
|
|
|
- name: Run mypy type checking
|
|
|
|
run: |
|
|
|
|
poetry run mypy --install-types --non-interactive app/
|
|
|
|
- name: Run tests and coverage
|
|
|
|
run: |
|
|
|
|
poetry run pytest --cov app
|
|
|
|
|
2023-02-19 16:44:53 +00:00
|
|
|
generated-api-up-to-date:
|
|
|
|
name: Check generated files are up-to-date
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-06 01:50:22 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-02-19 16:44:53 +00:00
|
|
|
- name: Run API generation
|
2023-04-29 02:10:01 +00:00
|
|
|
run: npm --prefix server run api:generate
|
2023-02-19 16:44:53 +00:00
|
|
|
- name: Find file changes
|
|
|
|
uses: tj-actions/verify-changed-files@v13.1
|
|
|
|
id: verify-changed-files
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
mobile/openapi
|
|
|
|
web/src/api/open-api
|
|
|
|
- name: Verify files have not changed
|
|
|
|
if: steps.verify-changed-files.outputs.files_changed == 'true'
|
|
|
|
run: |
|
|
|
|
echo "ERROR: Generated files not up to date!"
|
|
|
|
echo "Changed files: ${{ steps.verify-changed-files.outputs.changed_files }}"
|
|
|
|
exit 1
|
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
generated-typeorm-migrations-up-to-date:
|
|
|
|
name: Check generated TypeORM migrations are up-to-date
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_PASSWORD: postgres
|
|
|
|
POSTGRES_USER: postgres
|
|
|
|
POSTGRES_DB: immich
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
2023-10-05 16:35:58 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
working-directory: ./server
|
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
steps:
|
2023-10-05 16:35:58 +00:00
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
- name: Install server dependencies
|
2023-10-05 16:35:58 +00:00
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
- name: Build the
|
|
|
|
run: npm run build
|
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
- name: Run existing migrations
|
2023-10-05 16:35:58 +00:00
|
|
|
run: npm run typeorm:migrations:run
|
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
- name: Generate new migrations
|
|
|
|
continue-on-error: true
|
2023-10-05 16:35:58 +00:00
|
|
|
run: npm run typeorm:migrations:generate ./src/infra/migrations/TestMigration
|
|
|
|
|
2023-02-20 01:50:27 +00:00
|
|
|
- name: Find file changes
|
|
|
|
uses: tj-actions/verify-changed-files@v13.1
|
|
|
|
id: verify-changed-files
|
|
|
|
with:
|
|
|
|
files: |
|
2023-06-08 15:01:07 +00:00
|
|
|
server/src/infra/migrations/
|
2023-02-20 01:50:27 +00:00
|
|
|
- name: Verify files have not changed
|
|
|
|
if: steps.verify-changed-files.outputs.files_changed == 'true'
|
|
|
|
run: |
|
|
|
|
echo "ERROR: Generated files not up to date!"
|
|
|
|
echo "Changed files: ${{ steps.verify-changed-files.outputs.changed_files }}"
|
|
|
|
exit 1
|
|
|
|
|
2023-03-17 03:15:12 +00:00
|
|
|
# mobile-integration-tests:
|
|
|
|
# name: Run mobile end-to-end integration tests
|
|
|
|
# runs-on: macos-latest
|
|
|
|
# steps:
|
2023-09-06 01:50:22 +00:00
|
|
|
# - uses: actions/checkout@v4
|
2023-03-17 03:15:12 +00:00
|
|
|
# - uses: actions/setup-java@v3
|
|
|
|
# with:
|
|
|
|
# distribution: 'zulu'
|
|
|
|
# java-version: '12.x'
|
|
|
|
# cache: 'gradle'
|
|
|
|
# - name: Cache android SDK
|
|
|
|
# uses: actions/cache@v3
|
|
|
|
# id: android-sdk
|
|
|
|
# with:
|
|
|
|
# key: android-sdk
|
|
|
|
# path: |
|
|
|
|
# /usr/local/lib/android/
|
|
|
|
# ~/.android
|
|
|
|
# - name: Cache Gradle
|
|
|
|
# uses: actions/cache@v3
|
|
|
|
# with:
|
|
|
|
# path: |
|
|
|
|
# ./mobile/build/
|
|
|
|
# ./mobile/android/.gradle/
|
|
|
|
# key: ${{ runner.os }}-flutter-${{ hashFiles('**/*.gradle*', 'pubspec.lock') }}
|
|
|
|
# - name: Setup Android SDK
|
|
|
|
# if: steps.android-sdk.outputs.cache-hit != 'true'
|
|
|
|
# uses: android-actions/setup-android@v2
|
|
|
|
# - name: AVD cache
|
|
|
|
# uses: actions/cache@v3
|
|
|
|
# id: avd-cache
|
|
|
|
# with:
|
|
|
|
# path: |
|
|
|
|
# ~/.android/avd/*
|
|
|
|
# ~/.android/adb*
|
|
|
|
# key: avd-29
|
|
|
|
# - name: create AVD and generate snapshot for caching
|
|
|
|
# if: steps.avd-cache.outputs.cache-hit != 'true'
|
|
|
|
# uses: reactivecircus/android-emulator-runner@v2.27.0
|
|
|
|
# with:
|
|
|
|
# working-directory: ./mobile
|
|
|
|
# cores: 2
|
|
|
|
# api-level: 29
|
|
|
|
# arch: x86_64
|
|
|
|
# profile: pixel
|
|
|
|
# target: default
|
|
|
|
# force-avd-creation: false
|
|
|
|
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
|
|
# disable-animations: false
|
|
|
|
# script: echo "Generated AVD snapshot for caching."
|
|
|
|
# - name: Setup Flutter SDK
|
|
|
|
# uses: subosito/flutter-action@v2
|
|
|
|
# with:
|
|
|
|
# channel: 'stable'
|
|
|
|
# flutter-version: '3.7.3'
|
|
|
|
# cache: true
|
|
|
|
# - name: Run integration tests
|
|
|
|
# uses: Wandalen/wretry.action@master
|
|
|
|
# with:
|
|
|
|
# action: reactivecircus/android-emulator-runner@v2.27.0
|
|
|
|
# with: |
|
|
|
|
# working-directory: ./mobile
|
|
|
|
# cores: 2
|
|
|
|
# api-level: 29
|
|
|
|
# arch: x86_64
|
|
|
|
# profile: pixel
|
|
|
|
# target: default
|
|
|
|
# force-avd-creation: false
|
|
|
|
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
|
|
# disable-animations: true
|
|
|
|
# script: |
|
|
|
|
# flutter pub get
|
|
|
|
# flutter test integration_test
|
|
|
|
# attempt_limit: 3
|