From 8ae125d92d9c9bf75ccc30a753819980feada54f Mon Sep 17 00:00:00 2001 From: MarkS Date: Mon, 29 Sep 2025 14:11:59 -0600 Subject: [PATCH 1/4] ci: add isolated-tests.yml --- .github/workflows/isolated-tests.yml | 101 +++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 .github/workflows/isolated-tests.yml diff --git a/.github/workflows/isolated-tests.yml b/.github/workflows/isolated-tests.yml new file mode 100644 index 00000000000..a26b0ecd26c --- /dev/null +++ b/.github/workflows/isolated-tests.yml @@ -0,0 +1,101 @@ +# Github Action to build and run tests, but in more isolation + +name: Isolated tests +permissions: {} + +on: + push: + branches: [develop, master, sf-qa, sf-live] + pull_request: + merge_group: + workflow_dispatch: + +jobs: + build-development: + name: "Isolated tests" + 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@v5 + with: + persist-credentials: false + + - name: "Deps: .NET" + uses: actions/setup-dotnet@v5 + 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 + 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)\(" + # 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 + find src -name \*.spec.ts -exec npm run test:gha -- --include {} \; |& tee test_output.log + ! grep --perl-regex 'NG\d+|ERROR:|WARN:|LOG:|INFO:' test_output.log From b3c7552f0b144eb97e1db8988713c6bc6b208e37 Mon Sep 17 00:00:00 2001 From: MarkS Date: Mon, 1 Jun 2026 15:29:50 -0600 Subject: [PATCH 2/4] ci: align isolated-tests workflow with master baselines --- .github/workflows/isolated-tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/isolated-tests.yml b/.github/workflows/isolated-tests.yml index a26b0ecd26c..d3cbea2a2d6 100644 --- a/.github/workflows/isolated-tests.yml +++ b/.github/workflows/isolated-tests.yml @@ -17,27 +17,27 @@ jobs: 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"] + os: ["ubuntu-24.04"] + dotnet_version: ["10.0.x"] node_version: ["22.13.0"] - npm_version: ["10.9.2"] + npm_version: ["11.11.0"] # Continue building in other environments to see which are working. fail-fast: false runs-on: ${{matrix.os}} steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false - name: "Deps: .NET" - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 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 + uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 with: node-version: ${{matrix.node_version}} cache: "npm" From ab96a9fe89ab2d5fb7bd2ab1300a1c0ace2a151e Mon Sep 17 00:00:00 2001 From: MarkS Date: Tue, 2 Jun 2026 14:04:15 -0600 Subject: [PATCH 3/4] Improve output for finding source of problem --- .github/workflows/isolated-tests.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/isolated-tests.yml b/.github/workflows/isolated-tests.yml index d3cbea2a2d6..0f063b70c41 100644 --- a/.github/workflows/isolated-tests.yml +++ b/.github/workflows/isolated-tests.yml @@ -95,7 +95,12 @@ jobs: # Run the tests while making sure none of the common/known warnings are printed - name: "Test: Frontend" run: | - set -euo pipefail + set -xeuo pipefail cd src/SIL.XForge.Scripture/ClientApp - find src -name \*.spec.ts -exec npm run test:gha -- --include {} \; |& tee test_output.log - ! grep --perl-regex 'NG\d+|ERROR:|WARN:|LOG:|INFO:' test_output.log + find src -name \*.spec.ts -exec echo Checking {} \; -exec npm run test:gha -- --include {} \; |& tee test_output.log + echo "Checking output logs." + ! grep --perl-regex 'NG\d+' test_output.log + ! grep --perl-regex 'ERROR:' test_output.log + ! grep --perl-regex 'WARN:' test_output.log + ! grep --perl-regex 'LOG:' test_output.log + ! grep --perl-regex 'INFO:' test_output.log From 0507cb3bc720fe2b5c72bbfd082153cfd36fa19d Mon Sep 17 00:00:00 2001 From: MarkS Date: Tue, 2 Jun 2026 14:24:12 -0600 Subject: [PATCH 4/4] Check for bad output as the process is going --- .github/workflows/isolated-tests.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/isolated-tests.yml b/.github/workflows/isolated-tests.yml index 0f063b70c41..5ea6c15795d 100644 --- a/.github/workflows/isolated-tests.yml +++ b/.github/workflows/isolated-tests.yml @@ -97,10 +97,12 @@ jobs: run: | set -xeuo pipefail cd src/SIL.XForge.Scripture/ClientApp - find src -name \*.spec.ts -exec echo Checking {} \; -exec npm run test:gha -- --include {} \; |& tee test_output.log - echo "Checking output logs." - ! grep --perl-regex 'NG\d+' test_output.log - ! grep --perl-regex 'ERROR:' test_output.log - ! grep --perl-regex 'WARN:' test_output.log - ! grep --perl-regex 'LOG:' test_output.log - ! grep --perl-regex 'INFO:' test_output.log + for SPEC in $(find src -name \*.spec.ts ); do + echo "Checking ${SPEC}" + npm run test:gha -- --include "${SPEC}" |& tee test_output.log + echo "Checking output logs." + if grep --perl-regex '\bNG\d+\b|ERROR:|WARN:|LOG:|INFO:' test_output.log; then + echo "Error: Disallowed token found in test run output, as shown above."; + exit 1; + fi + done