Skip to content

Commit

Permalink
Big rename: CrdtMerge -> FwHeadless
Browse files Browse the repository at this point in the history
Also renamed SendReceiveConfig section of appsettings.json to
FwHeadlessConfig so we get all the renames done at once.
  • Loading branch information
rmunn committed Oct 30, 2024
1 parent 6028ea1 commit 140de48
Show file tree
Hide file tree
Showing 28 changed files with 120 additions and 120 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ jobs:
version: ${{ needs.set-version.outputs.version }}
label-latest: false

build-crdtmerge:
name: Build CrdtMerge
build-fw-headless:
name: Build FwHeadless
needs: [ set-version ]
uses: ./.github/workflows/lexbox-crdtmerge.yaml
uses: ./.github/workflows/lexbox-fw-headless.yaml
with:
version: ${{ needs.set-version.outputs.version }}
label-latest: false

deploy:
name: Deploy Develop
uses: ./.github/workflows/deploy.yaml
needs: [ build-api, build-ui, build-hgweb, build-crdtmerge, set-version ]
needs: [ build-api, build-ui, build-hgweb, build-fw-headless, set-version ]
secrets: inherit
with:
version: ${{ needs.set-version.outputs.version }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
url: https://${{ inputs.deploy-domain }}
outputs:
api-version: ${{ steps.get-api-version.outputs.result }}
crdtmerge-version: ${{ steps.get-crdtmerge-version.outputs.result }}
fw-headless-version: ${{ steps.get-fw-headless-version.outputs.result }}
ui-version: ${{ steps.get-ui-version.outputs.result }}
steps:
- name: Checkout lexbox repo
Expand Down Expand Up @@ -81,11 +81,11 @@ jobs:
id: get-api-version
with:
cmd: yq '.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-api").newTag' "fleet/${{ inputs.k8s-environment }}/kustomization.yaml"
- name: Get CrdtMerge version
- name: Get FwHeadless version
uses: mikefarah/yq@0b34c9a00de1c575a34eea05af1d956a525c4fc1 # v4.34.2
id: get-crdtmerge-version
id: get-fw-headless-version
with:
cmd: yq '.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-crdtmerge").newTag' "fleet/${{ inputs.k8s-environment }}/kustomization.yaml"
cmd: yq '.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-fw-headless").newTag' "fleet/${{ inputs.k8s-environment }}/kustomization.yaml"
- name: Get UI version
uses: mikefarah/yq@0b34c9a00de1c575a34eea05af1d956a525c4fc1 # v4.34.2
id: get-ui-version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
name: Develop CrdtMerge CI/CD
name: Develop FwHeadless CI/CD
on:
workflow_dispatch:
push:
paths:
- 'backend/CrdtMerge/**'
- 'backend/FwHeadless/**'
- 'backend/FixFwData/**'
- 'backend/FwLite/FwDataMiniLcmBridge/**'
- 'backend/FwLite/LcmCrdt/**'
- 'backend/FwLite/MiniLcm/**'
- 'backend/FwLiteProjectSync/FwLiteProjectSync/**'
- 'backend/LexCore/**'
- 'backend/LexData/**'
- '.github/workflows/lexbox-crdtmerge.yaml'
- '.github/workflows/lexbox-fw-headless.yaml'
- '.github/workflows/deploy.yaml'
- 'deployment/base/crdtmerge-deployment.yaml'
- 'deployment/base/fw-headless-deployment.yaml'
branches:
- develop
pull_request:
paths:
- 'backend/CrdtMerge/**'
- 'backend/FwHeadless/**'
- 'backend/FixFwData/**'
- 'backend/FwLite/FwDataMiniLcmBridge/**'
- 'backend/FwLite/LcmCrdt/**'
- 'backend/FwLite/MiniLcm/**'
- 'backend/FwLiteProjectSync/FwLiteProjectSync/**'
- 'backend/LexCore/**'
- 'backend/LexData/**'
- '.github/workflows/lexbox-crdtmerge.yaml'
- '.github/workflows/lexbox-fw-headless.yaml'
- '.github/workflows/deploy.yaml'
- 'deployment/base/crdtmerge-deployment.yaml'
- 'deployment/base/fw-headless-deployment.yaml'
branches:
- develop

Expand All @@ -45,28 +45,28 @@ jobs:
run: |
shortSha=$(echo ${{ github.sha }} | cut -c1-8)
echo "VERSION=v$(date --rfc-3339=date)-$shortSha" >> ${GITHUB_OUTPUT}
build-crdtmerge:
name: Build CrdtMerge
build-fw-headless:
name: Build FwHeadless
needs: set-version
uses: ./.github/workflows/lexbox-crdtmerge.yaml
uses: ./.github/workflows/lexbox-fw-headless.yaml
with:
version: ${{ needs.set-version.outputs.version }}
deploy-crdtmerge:
name: Deploy CrdtMerge
deploy-fw-headless:
name: Deploy FwHeadless
if: ${{github.ref == 'refs/heads/develop'}}
needs: [ build-crdtmerge, set-version ]
needs: [ build-fw-headless, set-version ]
uses: ./.github/workflows/deploy.yaml
secrets: inherit
with:
version: ${{ needs.set-version.outputs.version }}
image: 'ghcr.io/sillsdev/lexbox-crdtmerge'
image: 'ghcr.io/sillsdev/lexbox-fw-headless'
k8s-environment: develop
deploy-domain: lexbox.dev.languagetechnology.org

# TODO: Run CrdtMerge tests once we have developed them, but we don't need to run the whole integration test suite if only CrdtMerge changes are being pushed
# TODO: Run FwHeadless tests once we have developed them, but we don't need to run the whole integration test suite if only FwHeadless changes are being pushed
# integration-test-gha:
# name: GHA integration tests
# needs: [build-crdtmerge, set-version]
# needs: [build-fw-headless, set-version]
# uses: ./.github/workflows/integration-test-gha.yaml
# with:
# lexbox-crdtmerge-tag: ${{ needs.set-version.outputs.version }}
# lexbox-fw-headless-tag: ${{ needs.set-version.outputs.version }}
14 changes: 7 additions & 7 deletions .github/workflows/integration-test-gha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ jobs:
uses: mikefarah/yq@0b34c9a00de1c575a34eea05af1d956a525c4fc1 # v4.34.2
with:
cmd: yq eval -i '(.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-api").newTag) = "${{ inputs.lexbox-api-tag }}"' "./deployment/gha/kustomization.yaml"
# It's also possible that hgweb, crdtmerge, and/or ui image may have changed; if so, pull them and update kustomization.yaml for them as well
- name: Pull crdtmerge if updated
id: crdtmerge_image
# It's also possible that hgweb, fw-headless, and/or ui image may have changed; if so, pull them and update kustomization.yaml for them as well
- name: Pull fw-headless if updated
id: fw-headless_image
continue-on-error: true
run: docker pull ghcr.io/sillsdev/lexbox-crdtmerge:${{ inputs.lexbox-api-tag }}
- name: Update image crdtmerge version
if: ${{ steps.crdtmerge_image.outcome == 'success' }}
run: docker pull ghcr.io/sillsdev/lexbox-fw-headless:${{ inputs.lexbox-api-tag }}
- name: Update image fw-headless version
if: ${{ steps.fw-headless_image.outcome == 'success' }}
uses: mikefarah/yq@0b34c9a00de1c575a34eea05af1d956a525c4fc1 # v4.34.2
with:
cmd: yq eval -i '(.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-crdtmerge").newTag) = "${{ inputs.lexbox-api-tag }}"' "./deployment/gha/kustomization.yaml"
cmd: yq eval -i '(.images.[] | select(.name == "ghcr.io/sillsdev/lexbox-fw-headless").newTag) = "${{ inputs.lexbox-api-tag }}"' "./deployment/gha/kustomization.yaml"
- name: Pull hgweb if updated
id: hgweb_image
continue-on-error: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build CrdtMerge
name: Build FwHeadless

# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
Expand All @@ -14,11 +14,11 @@ on:
default: false

env:
IMAGE_NAME: ghcr.io/sillsdev/lexbox-crdtmerge
IMAGE_NAME: ghcr.io/sillsdev/lexbox-fw-headless


jobs:
publish-crdtmerge:
publish-fw-headless:
timeout-minutes: 60
runs-on: ubuntu-latest

Expand Down Expand Up @@ -51,10 +51,10 @@ jobs:
with:
dotnet-version: '9.x'
- name: Dotnet build
run: dotnet build backend/CrdtMerge/CrdtMerge.csproj
# TODO: Write CrdtMerge unit tests, probably based on existing sync tests
run: dotnet build backend/FwHeadless/FwHeadless.csproj
# TODO: Write FwHeadless unit tests, probably based on existing sync tests
# - name: Unit tests
# run: dotnet test backend/CrdtMerge/CrdtMerge.csproj --logger:"xunit;LogFileName={assembly}.results.xml" --results-directory ./test-results --filter "Category!=Integration&Category!=FlakyIntegration" --blame-hang-timeout 10m
# run: dotnet test backend/FwHeadless/FwHeadless.csproj --logger:"xunit;LogFileName={assembly}.results.xml" --results-directory ./test-results --filter "Category!=Integration&Category!=FlakyIntegration" --blame-hang-timeout 10m
# - name: Publish unit test results
# uses: EnricoMi/publish-unit-test-result-action@8885e273a4343cd7b48eaa72428dea0c3067ea98 # v2.14.0
# if: always()
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
- uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: backend
file: backend/CrdtMerge/Dockerfile
file: backend/FwHeadless/Dockerfile
build-args: |
APP_VERSION=${{ inputs.version }}
push: ${{ !env.ACT && github.repository == 'sillsdev/languageforge-lexbox' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ jobs:
version: ${{ needs.set-version.outputs.version }}
label-latest: true

build-crdtmerge:
name: Build crdtmerge
build-fw-headless:
name: Build fw-headless
needs: [ set-version ]
uses: ./.github/workflows/lexbox-crdtmerge.yaml
uses: ./.github/workflows/lexbox-fw-headless.yaml
with:
version: ${{ needs.set-version.outputs.version }}
label-latest: true

deploy:
name: Deploy Staging
uses: ./.github/workflows/deploy.yaml
needs: [ build-api, build-ui, build-hgweb, build-crdtmerge, set-version ]
needs: [ build-api, build-ui, build-hgweb, build-fw-headless, set-version ]
secrets: inherit
with:
version: ${{ needs.set-version.outputs.version }}
Expand Down
2 changes: 1 addition & 1 deletion LexBox.sln
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LcmDebugger", "backend\LfNe
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniLcm.Tests", "backend\FwLite\MiniLcm.Tests\MiniLcm.Tests.csproj", "{00AE5440-0E36-4488-935B-5B11301BA57D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CrdtMerge", "backend\CrdtMerge\CrdtMerge.csproj", "{ECBA46AB-AF87-4D4D-9716-FD77264B817F}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FwHeadless", "backend\FwHeadless\FwHeadless.csproj", "{ECBA46AB-AF87-4D4D-9716-FD77264B817F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
10 changes: 5 additions & 5 deletions backend/CrdtMerge/Dockerfile → backend/FwHeadless/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build

COPY . .
RUN --mount=type=cache,target=/root/.nuget/packages dotnet restore "CrdtMerge/CrdtMerge.csproj"
RUN --mount=type=cache,target=/root/.nuget/packages dotnet restore "FwHeadless/FwHeadless.csproj"

ARG APP_VERSION
LABEL version=$APP_VERSION

RUN --mount=type=cache,target=/root/.nuget/packages dotnet build /p:InformationalVersion=$APP_VERSION "CrdtMerge/CrdtMerge.csproj" -c Release -o /app/build
RUN --mount=type=cache,target=/root/.nuget/packages dotnet build /p:InformationalVersion=$APP_VERSION "FwHeadless/FwHeadless.csproj" -c Release -o /app/build

FROM build AS publish
RUN --mount=type=cache,target=/root/.nuget/packages dotnet publish /p:InformationalVersion=$APP_VERSION "CrdtMerge/CrdtMerge.csproj" -c Release -o /app/publish
RUN --mount=type=cache,target=/root/.nuget/packages dotnet publish /p:InformationalVersion=$APP_VERSION "FwHeadless/FwHeadless.csproj" -c Release -o /app/publish

FROM base AS final
RUN mkdir -p /var/lib/crdtmerge && chown -R www-data:www-data /var/lib/crdtmerge
RUN mkdir -p /var/lib/fw-headless && chown -R www-data:www-data /var/lib/fw-headless
WORKDIR /app
COPY --from=publish /app/publish .
USER www-data:www-data
ENTRYPOINT ["dotnet", "CrdtMerge.dll"]
ENTRYPOINT ["dotnet", "FwHeadless.dll"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.ComponentModel.DataAnnotations;

namespace CrdtMerge;
namespace FwHeadless;

public class CrdtMergeConfig
public class FwHeadlessConfig
{
[Required, Url, RegularExpression(@"^.+/$", ErrorMessage = "Must end with '/'")]
public required string LexboxUrl { get; init; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
using FwLiteProjectSync;
using LcmCrdt;

namespace CrdtMerge;
namespace FwHeadless;

public static class CrdtMergeKernel
public static class FwHeadlessKernel
{
public static void AddCrdtMerge(this IServiceCollection services)
public static void AddFwHeadless(this IServiceCollection services)
{
services
.AddLogging(builder => builder.AddConsole().AddDebug().AddFilter("Microsoft.EntityFrameworkCore", LogLevel.Warning));
services.AddOptions<CrdtMergeConfig>()
.BindConfiguration("SendReceiveConfig")
services.AddOptions<FwHeadlessConfig>()
.BindConfiguration("FwHeadlessConfig")
.ValidateDataAnnotations()
.ValidateOnStart();
services.AddScoped<SendReceiveService>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using CrdtMerge;
using FwHeadless;
using FwDataMiniLcmBridge;
using FwLiteProjectSync;
using LcmCrdt;
Expand All @@ -21,7 +21,7 @@
useOpenIddict: false
);

builder.Services.AddCrdtMerge();
builder.Services.AddFwHeadless();

var app = builder.Build();

Expand All @@ -45,7 +45,7 @@
ILogger<Program> logger,
IServiceProvider services,
SendReceiveService srService,
IOptions<CrdtMergeConfig> config,
IOptions<FwHeadlessConfig> config,
FwDataFactory fwDataFactory,
ProjectsService projectsService,
ProjectLookupService projectLookupService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using LexData;
using Microsoft.EntityFrameworkCore;

namespace CrdtMerge;
namespace FwHeadless;

public class ProjectLookupService(LexBoxDbContext dbContext)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using FwDataMiniLcmBridge;
using SIL.Progress;

namespace CrdtMerge;
namespace FwHeadless;

public static class SendReceiveHelpers
{
Expand All @@ -12,7 +12,7 @@ public record ProjectPath(string Code, string Dir)

public record SendReceiveAuth(string Username, string Password)
{
public SendReceiveAuth(CrdtMergeConfig config) : this(config.LexboxUsername, config.LexboxPassword) { }
public SendReceiveAuth(FwHeadlessConfig config) : this(config.LexboxUsername, config.LexboxPassword) { }
};

public record LfMergeBridgeResult(string Output, string ProgressMessages);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using FwDataMiniLcmBridge;
using Microsoft.Extensions.Options;

namespace CrdtMerge;
namespace FwHeadless;

public class SendReceiveService(IOptions<CrdtMergeConfig> config)
public class SendReceiveService(IOptions<FwHeadlessConfig> config)
{
public SendReceiveHelpers.LfMergeBridgeResult SendReceive(FwDataProject project, string? projectCode, string? commitMessage = null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SendReceiveConfig": {
"FwHeadlessConfig": {
"ProjectStorageRoot": "../../hgweb/repos",
"LexboxUrl": "http://localhost/",
"LexboxUsername": "admin",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"SendReceiveConfig": {
"FwHeadlessConfig": {
"LexboxUsername": null
},
"Logging": {
Expand Down
Loading

0 comments on commit 140de48

Please sign in to comment.