WIP: SF-3076 Simplify guest role sharing settings #7518
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 | |
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-20.04"] | |
dotnet_version: ["8.0.x"] | |
node_version: ["18.20.2"] | |
npm_version: ["10.9.0"] | |
# Continue building in other environments to see which are working. | |
fail-fast: false | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: "Deps: .NET" | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{matrix.dotnet_version}} | |
- name: "Deps: Node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node_version}} | |
- name: "Deps: npm" | |
run: npm install --global npm@${{matrix.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. | |
run: | | |
set -xueo pipefail | |
[[ $(node --version) == v${{matrix.node_version}} ]] | |
[[ $(npm --version) == ${{matrix.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]*\" | |
- name: "Test: Frontend" | |
run: cd src/SIL.XForge.Scripture/ClientApp && npm run test:gha | |
- 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-20.04"] | |
dotnet_version: ["8.0.x"] | |
node_version: ["18.20.2"] | |
npm_version: ["10.9.0"] | |
fail-fast: false | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: "Deps: .NET" | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{matrix.dotnet_version}} | |
- name: "Deps: Node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{matrix.node_version}} | |
- name: "Deps: npm" | |
run: npm install --global npm@${{matrix.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" | |
run: | | |
set -xueo pipefail | |
[[ $(node --version) == v${{matrix.node_version}} ]] | |
[[ $(npm --version) == ${{matrix.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 |