diff --git a/.github/workflows/build-python-app.yml b/.github/workflows/build-python-app.yml index adfbf89b..b658ed48 100644 --- a/.github/workflows/build-python-app.yml +++ b/.github/workflows/build-python-app.yml @@ -16,7 +16,6 @@ on: required: true type: boolean - jobs: build-python: if: ${{ inputs.enabled && inputs.shouldBuild }} @@ -25,49 +24,85 @@ jobs: steps: - uses: actions/checkout@v4 + # ----------------------------- + # Cache pip per app + # ----------------------------- + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ inputs.app }}-${{ hashFiles('apps/${{ inputs.app }}/requirements*.txt') }} + restore-keys: | + ${{ runner.os }}-pip-${{ inputs.app }}- + + # ----------------------------- + # Install Python deps + # ----------------------------- - name: Install dependencies + working-directory: apps/${{ inputs.app }} run: | - cd apps/${{ inputs.app }} - if [ -f requirements.txt ]; then - pip install -r requirements.txt - fi + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi - # Install test dependencies (pytest, asyncio test libs, etc.) - - name: Install test dependencies - run: | - cd apps/${{ inputs.app }} - if [ -f requirements-test.txt ]; then - pip install -r requirements-test.txt - fi - - - # Run Python tests + # ----------------------------- + # Run tests + # ----------------------------- - name: Run Python tests - run: | - cd apps/${{ inputs.app }} - python -m pytest -q + working-directory: apps/${{ inputs.app }} + run: python -m pytest -q - # Build Docker image locally - - name: Build Docker image locally - run: | - docker build \ - -f ./dockerfiles/Python \ - -t local-${{ inputs.app }}:${{ inputs.dockerTag }} \ - --build-arg MODULE_NAME=${{ inputs.app }} \ - . + # ----------------------------- + # Setup Buildx + # ----------------------------- + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - # Smoke-test the container - - name: Test Docker container - run: | - docker run --rm local-${{ inputs.app }}:${{ inputs.dockerTag }} /bin/sh -c "echo 'Smoke test OK'" + # ----------------------------- + # Cache Docker layers per app + # ----------------------------- + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache-${{ inputs.app }} + key: ${{ runner.os }}-buildx-${{ inputs.app }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx-${{ inputs.app }}- + # ----------------------------- + # Build image (load locally for smoke test) + # ----------------------------- + - name: Build Docker image (local load) + uses: docker/build-push-action@v5 + with: + context: . + file: ./dockerfiles/Python + build-args: | + MODULE_NAME=${{ inputs.app }} + load: true + tags: local-${{ inputs.app }}:${{ inputs.dockerTag }} + cache-from: type=local,src=/tmp/.buildx-cache-${{ inputs.app }} + cache-to: type=local,dest=/tmp/.buildx-cache-${{ inputs.app }}-new + + # ----------------------------- + # Smoke test + # ----------------------------- + - name: Smoke test container + run: | + docker run --rm local-${{ inputs.app }}:${{ inputs.dockerTag }} \ + /bin/sh -c "echo 'Smoke test OK'" + + # ----------------------------- + # Docker login + # ----------------------------- - name: Docker login uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_NAME }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - # Push final image + # ----------------------------- + # Push final image (no rebuild) + # ----------------------------- - name: Push Docker image uses: docker/build-push-action@v5 with: @@ -80,3 +115,13 @@ jobs: bskjon/mediaprocessing-${{ inputs.app }}:v5 bskjon/mediaprocessing-${{ inputs.app }}:v5-${{ inputs.dockerTag }} bskjon/mediaprocessing-${{ inputs.app }}:v5-${{ github.sha }} + cache-from: type=local,src=/tmp/.buildx-cache-${{ inputs.app }} + cache-to: type=local,dest=/tmp/.buildx-cache-${{ inputs.app }}-new + + # ----------------------------- + # Move Docker cache + # ----------------------------- + - name: Move Docker cache + run: | + rm -rf /tmp/.buildx-cache-${{ inputs.app }} + mv /tmp/.buildx-cache-${{ inputs.app }}-new /tmp/.buildx-cache-${{ inputs.app }} diff --git a/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/CollectEventsListener.kt b/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/CollectEventsListener.kt index 70c3145e..025b259a 100644 --- a/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/CollectEventsListener.kt +++ b/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/CollectEventsListener.kt @@ -27,7 +27,11 @@ class CollectEventsListener: EventListener() { } val statusAcceptable = taskStatus.none { it in undesiredStates } if (!statusAcceptable) { - log.warn { "One or more tasks have failed in ${event.referenceId}" } + if (taskStatus.any { it == CollectProjection.TaskStatus.Failed }) { + log.warn { "One or more tasks have failed in ${event.referenceId}" } + } else { + log.info { "One or more tasks are still pending in ${event.referenceId}" } + } return null } diff --git a/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/MediaDetermineSubtitleTrackTypeListener.kt b/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/MediaDetermineSubtitleTrackTypeListener.kt index b6e965f5..9f8b7e62 100644 --- a/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/MediaDetermineSubtitleTrackTypeListener.kt +++ b/apps/coordinator/src/main/kotlin/no/iktdev/mediaprocessing/coordinator/listeners/events/MediaDetermineSubtitleTrackTypeListener.kt @@ -70,7 +70,7 @@ class MediaDetermineSubtitleTrackTypeListener: EventListener() { } private fun List.onlySupportedCodecs(): List { - return this.filter { it.stream.codec_type in supportedCodecs } + return this.filter { it.stream.codec_name in supportedCodecs } } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4ad9ecd5..6e7c02fa 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,5 @@ [versions] -eventi = "1.0-rc19" +eventi = "1.0-rc20" exfl = "1.0-rc1" [libraries] diff --git a/shared/database/src/main/kotlin/no/iktdev/mediaprocessing/shared/database/DatabaseConfiguration.kt b/shared/database/src/main/kotlin/no/iktdev/mediaprocessing/shared/database/DatabaseConfiguration.kt index 4ecf6ec3..0ce932a7 100644 --- a/shared/database/src/main/kotlin/no/iktdev/mediaprocessing/shared/database/DatabaseConfiguration.kt +++ b/shared/database/src/main/kotlin/no/iktdev/mediaprocessing/shared/database/DatabaseConfiguration.kt @@ -71,10 +71,11 @@ class FlywayAutoConfig( .load() val pending = flyway.info().pending() - + var migrationsToApply = true when { pending.isEmpty() -> { log.info("ℹ️ Flyway is up to date. No migrations to apply.") + migrationsToApply = false } else -> { @@ -87,7 +88,9 @@ class FlywayAutoConfig( if (result.migrationsExecuted > 0) { log.info("✅ Applied ${result.migrationsExecuted} migration(s).") } else { - log.info("ℹ️ No migrations were applied.") + if (migrationsToApply) { + log.info("ℹ️ No migrations were applied.") + } } }