Some checks failed
Build Gateway / build-subgraphs (map[name:novel-service project:FictionArchive.Service.NovelService subgraph:Novel]) (pull_request) Successful in 47s
Build Gateway / build-subgraphs (map[name:scheduler-service project:FictionArchive.Service.SchedulerService subgraph:Scheduler]) (pull_request) Successful in 41s
Build Gateway / build-subgraphs (map[name:translation-service project:FictionArchive.Service.TranslationService subgraph:Translation]) (pull_request) Successful in 43s
Build Gateway / build-subgraphs (map[name:user-service project:FictionArchive.Service.UserService subgraph:User]) (pull_request) Successful in 40s
CI / build-backend (pull_request) Successful in 50s
CI / build-frontend (pull_request) Successful in 27s
Release / build-and-push (map[dockerfile:FictionArchive.Service.FileService/Dockerfile name:file-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.NovelService/Dockerfile name:novel-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.SchedulerService/Dockerfile name:scheduler-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.TranslationService/Dockerfile name:translation-service]) (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.UserService/Dockerfile name:user-service]) (pull_request) Has been cancelled
Release / build-frontend (pull_request) Has been cancelled
Release / build-and-push (map[dockerfile:FictionArchive.Service.AuthenticationService/Dockerfile name:authentication-service]) (pull_request) Has been cancelled
Build Gateway / build-gateway (pull_request) Failing after 27s
189 lines
5.6 KiB
YAML
189 lines
5.6 KiB
YAML
name: Build Gateway
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- 'v*.*.*'
|
|
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:
|
|
REGISTRY: ${{ gitea.server_url }}
|
|
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
|
|
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: Add .NET tools to PATH
|
|
run: echo "$HOME/.dotnet/tools" >> $GITHUB_PATH
|
|
|
|
- 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 schema.graphql
|
|
|
|
- name: Pack subgraph
|
|
run: fusion subgraph pack -w ${{ matrix.service.project }}
|
|
|
|
- name: Upload subgraph package
|
|
uses: christopherhx/gitea-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
|
|
|
|
- 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: Create subgraphs directory
|
|
run: mkdir -p subgraphs
|
|
|
|
- name: Download Novel Service subgraph
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: novel-service-subgraph
|
|
path: subgraphs/novel
|
|
|
|
- name: Download Translation Service subgraph
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: translation-service-subgraph
|
|
path: subgraphs/translation
|
|
|
|
- name: Download Scheduler Service subgraph
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: scheduler-service-subgraph
|
|
path: subgraphs/scheduler
|
|
|
|
- name: Download User Service subgraph
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: user-service-subgraph
|
|
path: subgraphs/user
|
|
|
|
- name: Download File Service subgraph
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: file-service-subgraph
|
|
path: subgraphs/file
|
|
|
|
- name: Configure subgraph URLs for Docker
|
|
run: |
|
|
for fsp in subgraphs/*/*.fsp; do
|
|
if [ -f "$fsp" ]; then
|
|
dir=$(dirname "$fsp")
|
|
name=$(basename "$dir")
|
|
url="http://${name}-service:8080/graphql"
|
|
echo "Setting $name URL to $url"
|
|
fusion subgraph config set http --url "$url" -c "$fsp"
|
|
fi
|
|
done
|
|
|
|
- name: Compose gateway
|
|
run: |
|
|
cd FictionArchive.API
|
|
rm -f gateway.fgp
|
|
for fsp in ../subgraphs/*/*.fsp; do
|
|
if [ -f "$fsp" ]; then
|
|
echo "Composing: $fsp"
|
|
fusion compose -p gateway.fgp -s "$fsp"
|
|
fi
|
|
done
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore FictionArchive.API/FictionArchive.API.csproj
|
|
|
|
- name: Build gateway
|
|
run: dotnet build FictionArchive.API/FictionArchive.API.csproj -c Release --no-restore -p:SkipFusionBuild=true
|
|
|
|
- name: Run tests
|
|
run: dotnet test FictionArchive.sln -c Release --no-build --verbosity normal
|
|
continue-on-error: true
|
|
|
|
- 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:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ gitea.actor }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: FictionArchive.API/Dockerfile
|
|
push: true
|
|
tags: |
|
|
${{ 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
|