Add support for arbitrary number of sources in Serval admin component… #8558
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Github Action to build and run tests | |
name: Build | |
permissions: {} | |
on: | |
push: | |
branches: [develop, master, sf-qa, sf-live] | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-development: | |
name: "Build and test" | |
strategy: | |
matrix: | |
# Environments in which to run, such as those used in development and production, or which are candidates to | |
# move to. | |
os: ["ubuntu-22.04"] | |
dotnet_version: ["8.0.x"] | |
node_version: ["22.13.0"] | |
npm_version: ["10.9.2"] | |
# Continue building in other environments to see which are working. | |
fail-fast: false | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: "Deps: .NET" | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{matrix.dotnet_version}} | |
cache: true | |
cache-dependency-path: src/SIL.XForge.Scripture/packages.lock.json | |
- name: "Deps: Node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node_version}} | |
cache: "npm" | |
cache-dependency-path: | | |
src/SIL.XForge.Scripture/ClientApp/package-lock.json | |
src/RealtimeServer/package-lock.json | |
- name: "Deps: npm" | |
env: | |
NPM_VERSION: ${{matrix.npm_version}} | |
run: | | |
set -xueo pipefail | |
npm install --global npm@${NPM_VERSION} | |
- name: Pre-build report | |
run: | | |
set -xueo pipefail | |
lsb_release -a | |
which dotnet | |
dotnet --version | |
dpkg -l dotnet\* | |
dotnet --list-sdks | |
dotnet --list-runtimes | |
which node | |
node --version | |
which npm | |
npm --version | |
which chromium-browser | |
chromium-browser --version | |
- name: "Ensure desired tool versions" | |
# The build machine may come with newer tools than we are ready for. | |
env: | |
NODE_VERSION: ${{matrix.node_version}} | |
NPM_VERSION: ${{matrix.npm_version}} | |
run: | | |
set -xueo pipefail | |
[[ $(node --version) == v${NODE_VERSION} ]] | |
[[ $(npm --version) == ${NPM_VERSION} ]] | |
- name: "Deps: reportgenerator tool" | |
run: dotnet tool install --global dotnet-reportgenerator-globaltool | |
- name: "Deps: RealtimeServer npm" | |
run: cd src/RealtimeServer && (npm ci || (sleep 3m && npm ci)) | |
- name: "Deps: Backend nuget" | |
run: dotnet restore | |
- name: "Deps: Frontend npm" | |
run: cd src/SIL.XForge.Scripture/ClientApp && (npm ci || (sleep 3m && npm ci)) | |
- name: "Build: Backend, RealtimeServer" | |
run: dotnet build xForge.sln | |
- name: "Build: Frontend" | |
run: cd src/SIL.XForge.Scripture/ClientApp && npm run build | |
- name: "Test: Ensure tests not focused on a subset" | |
# grep returns code 123 when no matches are found. The operator ! negates the exit code. | |
run: | | |
! git ls-files | grep "\\.spec\\.ts" | xargs grep -P "^\s*(fdescribe|fit)\(" | |
- name: "Test: RealtimeServer" | |
run: cd src/RealtimeServer && npm run test:ci | |
- name: "Test: Backend" | |
run: | | |
dotnet test \ | |
-p:CollectCoverage=true \ | |
-e:CoverletOutputFormat=opencover \ | |
-e:Exclude=\"[NUnit3.TestAdapter]*,[SIL.XForge.*.Views]*,[SIL.XForge.Tests]*\" | |
# Run the tests while making sure none of the common/known warnings are printed | |
- name: "Test: Frontend" | |
run: | | |
set -euo pipefail | |
cd src/SIL.XForge.Scripture/ClientApp | |
npm run test:gha | tee test_output.log | |
! grep -P 'NG\d+|ERROR:|WARN:|LOG:|INFO:' test_output.log | |
- name: "Coverage: Backend" | |
run: | | |
reportgenerator \ | |
-reports:test/*/coverage.opencover.xml \ | |
-targetdir:coverage \ | |
"-reporttypes:HTML;TeamCitySummary" | |
- name: "Coverage: Publish to Codecov" | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
build-production: | |
name: "Production build and test" | |
strategy: | |
matrix: | |
os: ["ubuntu-22.04"] | |
dotnet_version: ["8.0.x"] | |
node_version: ["22.13.0"] | |
npm_version: ["10.9.2"] | |
fail-fast: false | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: "Deps: .NET" | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{matrix.dotnet_version}} | |
cache: true | |
cache-dependency-path: src/SIL.XForge.Scripture/packages.lock.json | |
- name: "Deps: Node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node_version}} | |
cache: "npm" | |
cache-dependency-path: | | |
src/SIL.XForge.Scripture/ClientApp/package-lock.json | |
src/RealtimeServer/package-lock.json | |
- name: "Deps: npm" | |
env: | |
NPM_VERSION: ${{matrix.npm_version}} | |
run: | | |
set -xueo pipefail | |
npm install --global npm@${NPM_VERSION} | |
- name: Pre-build report | |
run: | | |
set -xueo pipefail | |
lsb_release -a | |
which dotnet | |
dotnet --version | |
dpkg -l dotnet\* | |
dotnet --list-sdks | |
dotnet --list-runtimes | |
which node | |
node --version | |
which npm | |
npm --version | |
which chromium-browser | |
chromium-browser --version | |
- name: "Ensure desired tool versions" | |
env: | |
NODE_VERSION: ${{matrix.node_version}} | |
NPM_VERSION: ${{matrix.npm_version}} | |
run: | | |
set -xueo pipefail | |
[[ $(node --version) == v${NODE_VERSION} ]] | |
[[ $(npm --version) == ${NPM_VERSION} ]] | |
- name: "Production build" | |
run: scripts/build-production | |
- name: "Test: Backend" | |
run: dotnet test xForge.sln | |
- name: "Test: RealtimeServer" | |
run: cd src/RealtimeServer && npm run test:ci | |
- name: "Test: Frontend" | |
run: cd src/SIL.XForge.Scripture/ClientApp && npm run test:gha |