Skip to content

Commit

Permalink
Merge branch 'develop' into minilcm-diff-apis
Browse files Browse the repository at this point in the history
  • Loading branch information
hahn-kev committed Nov 5, 2024
2 parents 883984e + 6a5a04d commit 950f127
Show file tree
Hide file tree
Showing 88 changed files with 2,858 additions and 464 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
**/node_modules
**/npm-debug.log
**/obj
**/artifacts/publish
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
README.md
10 changes: 9 additions & 1 deletion .github/workflows/deploy-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ jobs:
version: ${{ needs.set-version.outputs.version }}
label-latest: false

build-fw-headless:
name: Build FwHeadless
needs: [ set-version ]
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, 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
6 changes: 6 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ jobs:
url: https://${{ inputs.deploy-domain }}
outputs:
api-version: ${{ steps.get-api-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 @@ -80,6 +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 FwHeadless version
uses: mikefarah/yq@0b34c9a00de1c575a34eea05af1d956a525c4fc1 # v4.34.2
id: get-fw-headless-version
with:
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
72 changes: 72 additions & 0 deletions .github/workflows/develop-fw-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Develop FwHeadless CI/CD
on:
workflow_dispatch:
push:
paths:
- 'backend/FwHeadless/**'
- 'backend/FixFwData/**'
- 'backend/FwLite/FwDataMiniLcmBridge/**'
- 'backend/FwLite/LcmCrdt/**'
- 'backend/FwLite/MiniLcm/**'
- 'backend/FwLiteProjectSync/FwLiteProjectSync/**'
- 'backend/LexCore/**'
- 'backend/LexData/**'
- '.github/workflows/lexbox-fw-headless.yaml'
- '.github/workflows/deploy.yaml'
- 'deployment/base/fw-headless-deployment.yaml'
branches:
- develop
pull_request:
paths:
- 'backend/FwHeadless/**'
- 'backend/FixFwData/**'
- 'backend/FwLite/FwDataMiniLcmBridge/**'
- 'backend/FwLite/LcmCrdt/**'
- 'backend/FwLite/MiniLcm/**'
- 'backend/FwLiteProjectSync/FwLiteProjectSync/**'
- 'backend/LexCore/**'
- 'backend/LexData/**'
- '.github/workflows/lexbox-fw-headless.yaml'
- '.github/workflows/deploy.yaml'
- 'deployment/base/fw-headless-deployment.yaml'
branches:
- develop

jobs:
set-version:
name: Set Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.setVersion.outputs.VERSION }}
steps:
- name: Set Version
id: setVersion
# set version to date in vYYYY-MM-DD-commitSha format
run: |
shortSha=$(echo ${{ github.sha }} | cut -c1-8)
echo "VERSION=v$(date --rfc-3339=date)-$shortSha" >> ${GITHUB_OUTPUT}
build-fw-headless:
name: Build FwHeadless
needs: set-version
uses: ./.github/workflows/lexbox-fw-headless.yaml
with:
version: ${{ needs.set-version.outputs.version }}
deploy-fw-headless:
name: Deploy FwHeadless
if: ${{github.ref == 'refs/heads/develop'}}
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-fw-headless'
k8s-environment: develop
deploy-domain: lexbox.dev.languagetechnology.org

# 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-fw-headless, set-version]
# uses: ./.github/workflows/integration-test-gha.yaml
# with:
# lexbox-fw-headless-tag: ${{ needs.set-version.outputs.version }}
11 changes: 10 additions & 1 deletion .github/workflows/integration-test-gha.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +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 and/or ui image may have changed; if so, pull them and update kustomization.yaml for them as well
# 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-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-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
99 changes: 99 additions & 0 deletions .github/workflows/lexbox-fw-headless.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Build FwHeadless

# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
workflow_call:
inputs:
version:
description: 'The version of the image to build'
required: true
type: string
label-latest:
description: 'The label to apply to the latest image'
type: boolean
default: false

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


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

# postgres db is for automated tests
# services:
# postgres:
# image: postgres:15-alpine
# env:
# POSTGRES_PASSWORD: 972b722e63f549938d07bd8c4ee5086c
# POSTGRES_DB: lexbox-tests
# # Set health checks to wait until postgres has started
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# # Maps tcp port 5432 on service container to the host
# - 5433:5432

env:
# https://docs.docker.com/develop/develop-images/build_enhancements/
DOCKER_BUILDKIT: 1

steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
- name: Dotnet build
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/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()
# with:
# check_name: C# Unit Tests
# files: ./test-results/*.xml
# - name: Upload test results
# if: always()
# uses: actions/upload-artifact@v4
# with:
# name: dotnet-unit-test-results
# path: ./test-results

- name: Docker meta
id: meta
if: ${{ !env.ACT }}
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,enable=${{ inputs.label-latest }},value=latest
type=raw,value=${{ inputs.version }}
- name: ghcr.io login
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
if: ${{ !env.ACT }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: backend
file: backend/FwHeadless/Dockerfile
build-args: |
APP_VERSION=${{ inputs.version }}
push: ${{ !env.ACT && github.repository == 'sillsdev/languageforge-lexbox' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
10 changes: 9 additions & 1 deletion .github/workflows/release-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,18 @@ jobs:
version: ${{ needs.set-version.outputs.version }}
label-latest: true

build-fw-headless:
name: Build fw-headless
needs: [ set-version ]
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, 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
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"redhat.vscode-yaml",
"task.vscode-task",
"dbaeumer.vscode-eslint",
"katjanakosic.vscode-json5"
"katjanakosic.vscode-json5",
"tilt-dev.tiltfile"
]
}
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
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ files related to a specific service should be in a folder named after the servic
There are some exceptions:
* `LexBox.sln` visual studio expects the sln to be at the root of the repo and can make things difficult otherwise

Other files, like `skaffold.yaml`, should be at the root of the repo, because they're related to all services.

## Development

### Prerequisites
Expand All @@ -29,11 +27,10 @@ Other files, like `skaffold.yaml`, should be at the root of the repo, because th
* linux: `sudo snap install task --classic` or other options on their website
* mac: `brew install go-task/tap/go-task`
* via npm: `npm install -g @go-task/cli`
* install [Skaffold](https://skaffold.dev/docs/install/#standalone-binary) and add it to your path
* the file you will download is **NOT** an installer, just a standalone runnable .exe (on Windows) or binary (on Linux)
* install [Tilt](https://docs.tilt.dev/) and add it to your path
* on Linux, a good practice is to create `$HOME/.local/bin` and put binaries there; most distributions automatically add `$HOME/.local/bin` to your path if it exists
* don't forget to run `chmod +x $HOME/.local/bin/skaffold`
* on Windows, we suggest creating a `bin` folder in your home folder. Put the Skaffold binary there, then do the following:
* don't forget to run `chmod +x $HOME/.local/bin/tilt`
* on Windows, we suggest creating a `bin` folder in your home folder. Put the Tilt binary there, then do the following:
* go to your System properties, click the **Advanced** tab, and click **Environment Variables...**
* Click the Path variable (in either User or System, User is recommended) and click the **Edit...** button
* Add `C:\Users\YOUR_USER_NAME\bin` to the list and click **OK**
Expand Down
11 changes: 4 additions & 7 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,15 @@ tasks:
# k8s
up:
interactive: true
aliases: [backend-up]
cmds:
- skaffold dev --cleanup=false --kube-context docker-desktop
- tilt up

# dev
infra-up:
desc: 'Starts infrastructure for our ui and api, if you want port forwarding use k8s:infra-forward'
desc: 'Starts infrastructure for our ui and api, does not forward ports for api, if you want port forwarding use k8s:infra-forward'
cmds:
- skaffold run --cleanup=false --kube-context docker-desktop --profile=infra
backend-up:
desc: Starts entire backend for our ui (including the LexBox api)
cmds:
- skaffold dev --cleanup=false --kube-context docker-desktop --profile=no-frontend
- tilt up -- --lexbox-api-local

ui-dev:
aliases: [ ui ]
Expand Down
Loading

0 comments on commit 950f127

Please sign in to comment.