Some checks failed
Build Gateway / build-gateway (pull_request) Has been cancelled
Build Subgraphs / build-subgraphs (map[name:novel-service project:FictionArchive.Service.NovelService subgraph:Novel]) (pull_request) Has been cancelled
Build Subgraphs / build-subgraphs (map[name:scheduler-service project:FictionArchive.Service.SchedulerService subgraph:Scheduler]) (pull_request) Has been cancelled
Build Subgraphs / build-subgraphs (map[name:translation-service project:FictionArchive.Service.TranslationService subgraph:Translation]) (pull_request) Has been cancelled
Build Subgraphs / build-subgraphs (map[name:user-service project:FictionArchive.Service.UserService subgraph:User]) (pull_request) Has been cancelled
Build Subgraphs / trigger-gateway (pull_request) Has been cancelled
Build Subgraphs / build-subgraphs (map[name:file-service project:FictionArchive.Service.FileService subgraph:File]) (pull_request) Has been cancelled
CI / build-backend (pull_request) Successful in 58s
CI / build-frontend (pull_request) Successful in 27s
Release / build-and-push (map[dockerfile:FictionArchive.API/Dockerfile name:api]) (pull_request) Failing after 1m37s
Release / build-and-push (map[dockerfile:FictionArchive.Service.AuthenticationService/Dockerfile name:authentication-service]) (pull_request) Failing after 19s
Release / build-and-push (map[dockerfile:FictionArchive.Service.FileService/Dockerfile name:file-service]) (pull_request) Failing after 20s
Release / build-and-push (map[dockerfile:FictionArchive.Service.NovelService/Dockerfile name:novel-service]) (pull_request) Failing after 20s
Release / build-and-push (map[dockerfile:FictionArchive.Service.SchedulerService/Dockerfile name:scheduler-service]) (pull_request) Failing after 19s
Release / build-and-push (map[dockerfile:FictionArchive.Service.TranslationService/Dockerfile name:translation-service]) (pull_request) Failing after 19s
Release / build-and-push (map[dockerfile:FictionArchive.Service.UserService/Dockerfile name:user-service]) (pull_request) Failing after 19s
Release / build-frontend (pull_request) Failing after 19s
128 lines
3.6 KiB
YAML
128 lines
3.6 KiB
YAML
name: Build Gateway
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'FictionArchive.API/**'
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'FictionArchive.API/**'
|
|
|
|
env:
|
|
REGISTRY: ${{ gitea.server_url }}
|
|
IMAGE_NAME: ${{ gitea.repository_owner }}/fictionarchive-api
|
|
|
|
jobs:
|
|
build-gateway:
|
|
runs-on: ubuntu-latest
|
|
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
|
|
|
|
# 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: |
|
|
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: 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: |
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|