diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 4b639ba4e..cec41fbc0 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -26,10 +26,8 @@ jobs: env: DOCKER_BUILD_RECORD_UPLOAD: false with: - load: true cache-from: type=gha cache-to: type=gha,mode=max - tags: squidex-local test-containers: runs-on: ubuntu-latest @@ -38,13 +36,13 @@ jobs: - name: Prepare - Checkout uses: actions/checkout@v4.2.2 - - name: Prepare - Setup DotNet + - name: Prepare - Setup dotnet uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Test - TestContainers - run: dotnet test backend/Squidex.sln --filter Category==TestContainers + run: dotnet test backend/Squidex.sln --filter Category=TestContainers test-mongo: runs-on: ubuntu-latest @@ -56,7 +54,7 @@ jobs: - name: Prepare - Setup Docker Buildx uses: docker/setup-buildx-action@v3.10.0 - - name: Prepare - Setup DotNet + - name: Prepare - Setup dotnet uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x @@ -74,7 +72,7 @@ jobs: with: load: true cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: tags: squidex-local - name: Start Compose @@ -157,7 +155,7 @@ jobs: - name: Prepare - Setup Docker Buildx uses: docker/setup-buildx-action@v3.10.0 - - name: Prepare - Setup DotNet + - name: Prepare - Setup dotnet uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x @@ -175,7 +173,7 @@ jobs: with: load: true cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: tags: squidex-local - name: Start Compose diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9bf09921..e96ffd896 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,10 +21,8 @@ jobs: env: DOCKER_BUILD_RECORD_UPLOAD: false with: - load: true cache-from: type=gha cache-to: type=gha,mode=max - tags: squidex-local test-containers: runs-on: ubuntu-latest @@ -33,13 +31,13 @@ jobs: - name: Prepare - Checkout uses: actions/checkout@v4.2.2 - - name: Prepare - Setup DotNet + - name: Prepare - Setup dotnet uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Test - TestContainers - run: dotnet test backend/Squidex.sln --filter Category==TestContainers + run: dotnet test backend/Squidex.sln --filter Category=TestContainers test-mongo: runs-on: ubuntu-latest @@ -51,7 +49,7 @@ jobs: - name: Prepare - Setup Docker Buildx uses: docker/setup-buildx-action@v3.10.0 - - name: Prepare - Setup DotNet + - name: Prepare - Setup dotnet uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x @@ -69,7 +67,7 @@ jobs: with: load: true cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: tags: squidex-local - name: Start Compose @@ -152,7 +150,7 @@ jobs: - name: Prepare - Setup Docker Buildx uses: docker/setup-buildx-action@v3.10.0 - - name: Prepare - Setup DotNet + - name: Prepare - Setup dotnet uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x @@ -170,7 +168,7 @@ jobs: with: load: true cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: tags: squidex-local - name: Start Compose @@ -253,8 +251,8 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 - tags: squidex/squidex:${{ env.GITHUB_REF_SLUG }},squidex/squidex:${{ steps.version.outputs._0 }}${{env.STABLE_VERSION == 'true' && ',squidex/squidex:latest'}} push: true + tags: squidex/squidex:${{ env.GITHUB_REF_SLUG }},squidex/squidex:${{ steps.version.outputs._0 }}${{env.STABLE_VERSION == 'true' && ',squidex/squidex:latest'}} - name: Release - Make directories run: sudo mkdir /build /release @@ -284,6 +282,7 @@ jobs: artifacts: "/release/binaries.zip" body: ${{ steps.changelog_reader.outputs.changes }} name: ${{ env.GITHUB_REF_SLUG }} + removeArtifacts: false replacesArtifacts: true token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Dockerfile b/Dockerfile index 4becc2b89..f2c8349b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,10 +9,12 @@ RUN apt-get update \ && apt-get install -y ffmpeg ARG SQUIDEX__BUILD__VERSION=7.0.0 +ARG SQUIDEX__BUILD__ARGS= WORKDIR /src # Copy nuget project files. +COPY backend/Directory.Build.props ./ COPY backend/*.sln ./ # Copy the main source project files @@ -32,16 +34,14 @@ RUN dotnet restore COPY backend . # Test Backend -RUN dotnet test --no-restore --filter "Category!=Dependencies & Category!=TestContainer" +RUN dotnet test --filter "Category!=Dependencies & Category!=TestContainer" --configuration Release # Publish -RUN dotnet publish --no-restore src/Squidex/Squidex.csproj --output /build/ --configuration Release -p:version=$SQUIDEX__BUILD__VERSION +RUN dotnet publish src/Squidex/Squidex.csproj --output /build/ --configuration Release -p:version=$SQUIDEX__BUILD__VERSION # Install tools -RUN dotnet tool install --tool-path /tools dotnet-counters \ - && dotnet tool install --tool-path /tools dotnet-dump \ - && dotnet tool install --tool-path /tools dotnet-gcdump \ - && dotnet tool install --tool-path /tools dotnet-trace +RUN dotnet tool install --tool-path /tools dotnet-dump \ + && dotnet tool install --tool-path /tools dotnet-gcdump # @@ -67,7 +67,6 @@ RUN npm run test:coverage \ RUN cp -a build /build/ - # # Stage 3, Build runtime # @@ -77,7 +76,9 @@ ARG SQUIDEX__RUNTIME__VERSION=7.0.0 # Curl for debugging and libc-dev for protobuf RUN apt-get update \ - && apt-get install -y curl libc-dev ffmpeg + && apt-get install -y --no-install-recommends curl libc-dev + +COPY --from=mwader/static-ffmpeg:7.1.1 /ffprobe /usr/local/bin/ # Default tool directory WORKDIR /tools @@ -95,10 +96,8 @@ COPY --from=frontend /build/browser wwwroot/build/ EXPOSE 80 EXPOSE 443 -ENV DIAGNOSTICS__COUNTERSTOOL=/tools/dotnet-counters ENV DIAGNOSTICS__DUMPTOOL=/tools/dotnet-dump ENV DIAGNOSTICS__GCDUMPTOOL=/tools/dotnet-gcdump -ENV DIAGNOSTICS__TRACETOOL=/tools/dotnet-trace ENV ASPNETCORE_HTTP_PORTS=80 ENTRYPOINT ["dotnet", "Squidex.dll"] diff --git a/backend/Directory.Build.props b/backend/Directory.Build.props new file mode 100644 index 000000000..76030707f --- /dev/null +++ b/backend/Directory.Build.props @@ -0,0 +1,13 @@ + + + $(DefineConstants);INCLUDE_MAGICK;INCLUDE_KAFKA + + + + true + + + + true + + diff --git a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaAction.cs b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaAction.cs index 658103f6b..645f46b9f 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaAction.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaAction.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +#if INCLUDE_KAFKA using System.ComponentModel.DataAnnotations; using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules; @@ -55,3 +56,4 @@ public sealed record KafkaAction : RuleAction [Editor(RuleFieldEditor.TextArea)] public string? Schema { get; set; } } +#endif diff --git a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs index 53b6d51be..df3036c8d 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaActionHandler.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +#if INCLUDE_KAFKA using Squidex.Domain.Apps.Core.HandleRules; using Squidex.Domain.Apps.Core.Rules.EnrichedEvents; @@ -113,3 +114,4 @@ public sealed class KafkaJob public int PartitionCount { get; set; } } +#endif diff --git a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaPlugin.cs b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaPlugin.cs index 7761d4d43..5662433b6 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaPlugin.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaPlugin.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +#if INCLUDE_KAFKA using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -27,3 +28,4 @@ public sealed class KafkaPlugin : IPlugin } } } +#endif diff --git a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs index 954fa471c..8add3c570 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducer.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +#if INCLUDE_KAFKA using System.Text; using Avro; using Avro.Generic; @@ -278,3 +279,4 @@ public sealed class KafkaProducer return schema?.Tag == expected || (schema is UnionSchema union && union.Schemas.Any(x => x.Tag == expected)); } } +#endif \ No newline at end of file diff --git a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducerOptions.cs b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducerOptions.cs index 654593c22..cf5244e63 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducerOptions.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Kafka/KafkaProducerOptions.cs @@ -5,6 +5,7 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== +#if INCLUDE_KAFKA using Confluent.Kafka; using Confluent.SchemaRegistry; using Confluent.SchemaRegistry.Serdes; @@ -27,3 +28,4 @@ public class KafkaProducerOptions : ProducerConfig return !string.IsNullOrWhiteSpace(SchemaRegistry?.Url); } } +#endif \ No newline at end of file diff --git a/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj b/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj index 92331a942..b97fab0e8 100644 --- a/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj +++ b/backend/extensions/Squidex.Extensions/Squidex.Extensions.csproj @@ -13,7 +13,6 @@ - @@ -41,6 +40,9 @@ + + + diff --git a/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj b/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj index a54bd62d7..db4b5392e 100644 --- a/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj +++ b/backend/src/Squidex.Data.EntityFramework/Squidex.Data.EntityFramework.csproj @@ -35,13 +35,16 @@ - - - - - - - + + + + + + + + + + diff --git a/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj b/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj index 6d45454fb..60927e0ec 100644 --- a/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj +++ b/backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj @@ -24,11 +24,11 @@ - - - - - + + + + + diff --git a/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj b/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj index f7c0d0933..6f7d72dea 100644 --- a/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj +++ b/backend/src/Squidex.Domain.Apps.Core.Operations/Squidex.Domain.Apps.Core.Operations.csproj @@ -28,8 +28,8 @@ - - + + diff --git a/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj b/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj index eddb9e72d..328989d7b 100644 --- a/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj +++ b/backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj @@ -24,13 +24,13 @@ - - - - - - - + + + + + + + diff --git a/backend/src/Squidex/Config/Domain/ResizeServices.cs b/backend/src/Squidex/Config/Domain/ResizeServices.cs index e461b122c..f4d1ebdd1 100644 --- a/backend/src/Squidex/Config/Domain/ResizeServices.cs +++ b/backend/src/Squidex/Config/Domain/ResizeServices.cs @@ -6,7 +6,9 @@ // ========================================================================== using Squidex.Assets; +#if INCLUDE_MAGICK using Squidex.Assets.ImageMagick; +#endif using Squidex.Assets.ImageSharp; using Squidex.Assets.Remote; @@ -19,14 +21,18 @@ public static class ResizeServices services.AddSingletonAs() .AsSelf(); +#if INCLUDE_MAGICK services.AddSingletonAs() .AsSelf(); +#endif services.AddSingletonAs(c => new CompositeThumbnailGenerator( [ c.GetRequiredService(), +#if INCLUDE_MAGICK c.GetRequiredService(), +#endif ])) .AsSelf(); diff --git a/backend/src/Squidex/Config/Messaging/MessagingServices.cs b/backend/src/Squidex/Config/Messaging/MessagingServices.cs index ced7e6cdf..b3afad8ac 100644 --- a/backend/src/Squidex/Config/Messaging/MessagingServices.cs +++ b/backend/src/Squidex/Config/Messaging/MessagingServices.cs @@ -153,6 +153,13 @@ public static class MessagingServices return builder.AddSquidexEntityFrameworkTransport(config); } +#if INCLUDE_KAFKA + if (string.Equals(type, "Kafka", StringComparison.OrdinalIgnoreCase)) + { + return builder.AddKafkaTransport(config); + } +#endif + return builder.AddTransport(config); } } diff --git a/backend/src/Squidex/Config/Web/WebServices.cs b/backend/src/Squidex/Config/Web/WebServices.cs index 529683a0b..1e86f8cc8 100644 --- a/backend/src/Squidex/Config/Web/WebServices.cs +++ b/backend/src/Squidex/Config/Web/WebServices.cs @@ -98,7 +98,9 @@ public static class WebServices options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(JsonValue))); }) .AddDataAnnotationsLocalization() +#if DEBUG .AddRazorRuntimeCompilation() +#endif .AddSquidexPlugins(config) .AddSquidexSerializers(); } diff --git a/backend/src/Squidex/Squidex.csproj b/backend/src/Squidex/Squidex.csproj index 0e56d62be..b6655f028 100644 --- a/backend/src/Squidex/Squidex.csproj +++ b/backend/src/Squidex/Squidex.csproj @@ -1,8 +1,6 @@  net8.0 - Latest - true latest enable en @@ -43,7 +41,6 @@ - @@ -62,18 +59,17 @@ - - - - - - - + + + + + + - - - - + + + + @@ -81,6 +77,18 @@ + + + + + + + + + + + + true