From 50263109ab05e743c2ed46353a6e0ad017277f0a Mon Sep 17 00:00:00 2001 From: gamer147 Date: Wed, 26 Nov 2025 11:54:57 -0500 Subject: [PATCH] [FA-11] More pipeline fixes --- .gitea/workflows/build-gateway.yml | 75 +++++++++++++++-- .gitea/workflows/build-subgraphs.yml | 84 ------------------- .gitea/workflows/release.yml | 16 +++- .../appsettings.json | 2 +- 4 files changed, 80 insertions(+), 97 deletions(-) delete mode 100644 .gitea/workflows/build-subgraphs.yml diff --git a/.gitea/workflows/build-gateway.yml b/.gitea/workflows/build-gateway.yml index 4f8d723..51fdad3 100644 --- a/.gitea/workflows/build-gateway.yml +++ b/.gitea/workflows/build-gateway.yml @@ -6,11 +6,17 @@ on: branches: - master paths: + - 'FictionArchive.Service.*/**' + - 'FictionArchive.Common/**' + - 'FictionArchive.Service.Shared/**' - 'FictionArchive.API/**' pull_request: branches: - master paths: + - 'FictionArchive.Service.*/**' + - 'FictionArchive.Common/**' + - 'FictionArchive.Service.Shared/**' - 'FictionArchive.API/**' env: @@ -18,8 +24,63 @@ env: IMAGE_NAME: ${{ gitea.repository_owner }}/fictionarchive-api jobs: + build-subgraphs: + runs-on: ubuntu-latest + strategy: + matrix: + service: + - name: novel-service + project: FictionArchive.Service.NovelService + subgraph: Novel + - name: translation-service + project: FictionArchive.Service.TranslationService + subgraph: Translation + - name: scheduler-service + project: FictionArchive.Service.SchedulerService + subgraph: Scheduler + - name: user-service + project: FictionArchive.Service.UserService + subgraph: User + - name: file-service + project: FictionArchive.Service.FileService + subgraph: File + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Install Fusion CLI + run: dotnet tool install -g HotChocolate.Fusion.CommandLine + + - name: Restore dependencies + run: dotnet restore ${{ matrix.service.project }}/${{ matrix.service.project }}.csproj + + - name: Build + run: dotnet build ${{ matrix.service.project }}/${{ matrix.service.project }}.csproj -c Release --no-restore + + - name: Export schema + run: | + dotnet run -c Release --no-launch-profile \ + --project ${{ matrix.service.project }}/${{ matrix.service.project }}.csproj \ + -- schema export --output ${{ matrix.service.project }}/schema.graphql + + - name: Pack subgraph + run: fusion subgraph pack -w ${{ matrix.service.project }} + + - name: Upload subgraph package + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.service.name }}-subgraph + path: ${{ matrix.service.project }}/*.fsp + retention-days: 30 + build-gateway: runs-on: ubuntu-latest + needs: build-subgraphs steps: - name: Checkout uses: actions/checkout@v4 @@ -35,41 +96,35 @@ jobs: - name: Create subgraphs directory run: mkdir -p subgraphs - # Download all subgraph packages from latest successful builds - name: Download Novel Service subgraph uses: actions/download-artifact@v4 with: name: novel-service-subgraph path: subgraphs/novel - continue-on-error: true - name: Download Translation Service subgraph uses: actions/download-artifact@v4 with: name: translation-service-subgraph path: subgraphs/translation - continue-on-error: true - name: Download Scheduler Service subgraph uses: actions/download-artifact@v4 with: name: scheduler-service-subgraph path: subgraphs/scheduler - continue-on-error: true - name: Download User Service subgraph uses: actions/download-artifact@v4 with: name: user-service-subgraph path: subgraphs/user - continue-on-error: true - name: Download File Service subgraph uses: actions/download-artifact@v4 with: name: file-service-subgraph path: subgraphs/file - continue-on-error: true - name: Configure subgraph URLs for Docker run: | @@ -107,6 +162,10 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Extract registry hostname + id: registry + run: echo "HOST=$(echo '${{ gitea.server_url }}' | sed 's|https\?://||')" >> $GITHUB_OUTPUT + - name: Log in to Gitea Container Registry uses: docker/login-action@v3 with: @@ -121,7 +180,7 @@ jobs: file: FictionArchive.API/Dockerfile push: true tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest - ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }} + ${{ steps.registry.outputs.HOST }}/${{ env.IMAGE_NAME }}:latest + ${{ steps.registry.outputs.HOST }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }} cache-from: type=gha cache-to: type=gha,mode=max diff --git a/.gitea/workflows/build-subgraphs.yml b/.gitea/workflows/build-subgraphs.yml deleted file mode 100644 index 108a8e7..0000000 --- a/.gitea/workflows/build-subgraphs.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Build Subgraphs - -on: - push: - branches: - - master - paths: - - 'FictionArchive.Service.*/**' - - 'FictionArchive.Common/**' - - 'FictionArchive.Service.Shared/**' - pull_request: - branches: - - master - paths: - - 'FictionArchive.Service.*/**' - - 'FictionArchive.Common/**' - - 'FictionArchive.Service.Shared/**' - -jobs: - build-subgraphs: - runs-on: ubuntu-latest - strategy: - matrix: - service: - - name: novel-service - project: FictionArchive.Service.NovelService - subgraph: Novel - - name: translation-service - project: FictionArchive.Service.TranslationService - subgraph: Translation - - name: scheduler-service - project: FictionArchive.Service.SchedulerService - subgraph: Scheduler - - name: user-service - project: FictionArchive.Service.UserService - subgraph: User - - name: file-service - project: FictionArchive.Service.FileService - subgraph: File - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - - name: Install Fusion CLI - run: dotnet tool install -g HotChocolate.Fusion.CommandLine - - - name: Restore dependencies - run: dotnet restore ${{ matrix.service.project }}/${{ matrix.service.project }}.csproj - - - name: Build - run: dotnet build ${{ matrix.service.project }}/${{ matrix.service.project }}.csproj -c Release --no-restore - - - name: Export schema - run: | - dotnet run -c Release --no-launch-profile \ - --project ${{ matrix.service.project }}/${{ matrix.service.project }}.csproj \ - -- schema export --output ${{ matrix.service.project }}/schema.graphql - - - name: Pack subgraph - run: fusion subgraph pack -w ${{ matrix.service.project }} - - - name: Upload subgraph package - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.service.name }}-subgraph - path: ${{ matrix.service.project }}/*.fsp - retention-days: 30 - - # Trigger gateway build after all subgraphs are built - trigger-gateway: - runs-on: ubuntu-latest - needs: build-subgraphs - steps: - - name: Trigger gateway workflow - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/actions/workflows/build-gateway.yml/dispatches" \ - -d '{"ref":"master"}' diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 6578ff5..e86f810 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -43,6 +43,10 @@ jobs: id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + - name: Extract registry hostname + id: registry + run: echo "HOST=$(echo '${{ gitea.server_url }}' | sed 's|https\?://||')" >> $GITHUB_OUTPUT + - name: Log in to Gitea Container Registry uses: docker/login-action@v3 with: @@ -57,8 +61,8 @@ jobs: file: ${{ matrix.service.dockerfile }} push: true tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-${{ matrix.service.name }}:${{ steps.version.outputs.VERSION }} - ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-${{ matrix.service.name }}:latest + ${{ steps.registry.outputs.HOST }}/${{ env.IMAGE_PREFIX }}-${{ matrix.service.name }}:${{ steps.version.outputs.VERSION }} + ${{ steps.registry.outputs.HOST }}/${{ env.IMAGE_PREFIX }}-${{ matrix.service.name }}:latest cache-from: type=gha cache-to: type=gha,mode=max @@ -75,6 +79,10 @@ jobs: id: version run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT + - name: Extract registry hostname + id: registry + run: echo "HOST=$(echo '${{ gitea.server_url }}' | sed 's|https\?://||')" >> $GITHUB_OUTPUT + - name: Log in to Gitea Container Registry uses: docker/login-action@v3 with: @@ -95,7 +103,7 @@ jobs: VITE_OIDC_REDIRECT_URI=${{ vars.VITE_OIDC_REDIRECT_URI }} VITE_OIDC_POST_LOGOUT_REDIRECT_URI=${{ vars.VITE_OIDC_POST_LOGOUT_REDIRECT_URI }} tags: | - ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-frontend:${{ steps.version.outputs.VERSION }} - ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}-frontend:latest + ${{ steps.registry.outputs.HOST }}/${{ env.IMAGE_PREFIX }}-frontend:${{ steps.version.outputs.VERSION }} + ${{ steps.registry.outputs.HOST }}/${{ env.IMAGE_PREFIX }}-frontend:latest cache-from: type=gha cache-to: type=gha,mode=max diff --git a/FictionArchive.Service.FileService/appsettings.json b/FictionArchive.Service.FileService/appsettings.json index c18d35f..0f6f7a4 100644 --- a/FictionArchive.Service.FileService/appsettings.json +++ b/FictionArchive.Service.FileService/appsettings.json @@ -9,7 +9,7 @@ "BaseUrl": "https://localhost:7247/api" }, "RabbitMQ": { - "ConnectionString": "amqp://localhost", + "ConnectionString": "amqp://localhost2", "ClientIdentifier": "FileService" }, "S3": {