Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
f1e22af
Initial commit for rca-tool
fede2cr Nov 19, 2025
448c53c
Adding rca-tool branch to deploy
fede2cr Nov 19, 2025
9641321
Moving .github to root of tree
fede2cr Nov 19, 2025
6e82c44
Fixing paths for website deploy
fede2cr Nov 19, 2025
3502986
Fixing paths for website deploy
fede2cr Nov 19, 2025
d6eb960
Adding c file missing in build
fede2cr Nov 19, 2025
22a340f
Moving wasm to correct dir
fede2cr Nov 19, 2025
23a456d
properties of undefined, error in github pages
fede2cr Nov 19, 2025
1cf3d75
properties of undefined, error in github pages, adding build
fede2cr Nov 20, 2025
055c39e
Adding testing with playwright and MS Edge
fede2cr Nov 21, 2025
5a20578
Running tests on all branches
fede2cr Nov 21, 2025
c78c9b1
Fixing paths for tests
fede2cr Nov 21, 2025
cd4bc5d
Fixing paths for tests, typo
fede2cr Nov 21, 2025
ceb5994
Adding missing lock file
fede2cr Nov 21, 2025
1a27747
Adding edge channel for browser
fede2cr Nov 21, 2025
1c0223d
Building fixtures, adding tests as a dependency before building
fede2cr Nov 21, 2025
1292a84
Fixing results path
fede2cr Nov 21, 2025
fba18b6
Always using streaming, to fix failing tests
fede2cr Nov 21, 2025
8cd0c38
Adding accessibility testing, and IBM Colorblind Safe Palette
fede2cr Nov 24, 2025
b783e67
Fixing tests after adding IBM Colorblind safe palette
fede2cr Nov 24, 2025
139f828
Using only edge for accesibility checks, was failing on CI
fede2cr Nov 24, 2025
8f441ec
Adding kernel parameters detection (sysctl) and validation. Including…
alvarofigueroa-ms Nov 24, 2025
13385ed
Adding BYOS/PAYG detection with tests
alvarofigueroa-ms Nov 24, 2025
4cc09f9
Fixing Error: statusBorderClass is not defined on sosreport
alvarofigueroa-ms Nov 24, 2025
ff2292c
Testing license detection
alvarofigueroa-ms Nov 24, 2025
308b207
distro info from sysinfo, SAP and EPIC detection, app console mode, c…
alvarofigueroa-ms Nov 26, 2025
6d43544
Fixing and adding tests for new code
alvarofigueroa-ms Nov 26, 2025
6f9cec3
Fixing and adding tests for new code
alvarofigueroa-ms Nov 26, 2025
151e7ae
Fixing object printing instead of it's content
alvarofigueroa-ms Nov 26, 2025
c1a4792
Adding illumio detection
alvarofigueroa-ms Nov 27, 2025
7816c74
Adding trend micro to the list of AVs
alvarofigueroa-ms Nov 27, 2025
daa3e7f
Adding raw fstab support
alvarofigueroa-ms Nov 28, 2025
3301dda
Adding corruption or truncated detection by checking tar chunks
alvarofigueroa-ms Nov 28, 2025
6da8d0b
README rewrite, adding Mermaid flowchart
alvarofigueroa-ms Nov 28, 2025
8cca18e
Correct mermaid for gh markdown
alvarofigueroa-ms Nov 28, 2025
2abe24a
Adding developer doc
alvarofigueroa-ms Nov 29, 2025
129699c
Fixing build script for ubuntu lts (--host), better parity with diffe…
alvarofigueroa-ms Dec 2, 2025
3d12859
pre-wrap to CSS, DLM detection, func table to DEVELOPER doc
alvarofigueroa-ms Dec 3, 2025
f15be4b
Counting DLM in warnings. Excluding totem transport for non-Suse
alvarofigueroa-ms Dec 3, 2025
0fd4f60
Adding ASR and Guardicore detection
alvarofigueroa-ms Dec 4, 2025
0d2c8da
Creating util functions to better handle detectors. Adding doc for ut…
alvarofigueroa-ms Dec 4, 2025
08bc1d3
Copying new file to deployed site
alvarofigueroa-ms Dec 4, 2025
a97488d
Fixing mde sap url, moving code to utils, typo in readme
alvarofigueroa-ms Dec 4, 2025
478dfa7
Adding post-deploy testing
alvarofigueroa-ms Dec 4, 2025
8a457a4
Fixing post-deploy tests
alvarofigueroa-ms Dec 4, 2025
31514ec
Fixing testing on deployed site
alvarofigueroa-ms Dec 5, 2025
9461e0e
Creating fixtures in post-deploy
alvarofigueroa-ms Dec 5, 2025
5fb80c2
Adding more utility funct, adding xfs corruption and xfs duplicate uuid
alvarofigueroa-ms Dec 5, 2025
55b332f
Adding nvme detection, fixing xfs failed tests
alvarofigueroa-ms Dec 5, 2025
55f6cc7
Testing was running pre and post tests, without applying changes
alvarofigueroa-ms Dec 5, 2025
0b16d53
Hor scrolling for nvme list, addind recommended and optional network …
alvarofigueroa-ms Dec 8, 2025
68a05a7
Adding network tunning to doc
alvarofigueroa-ms Dec 8, 2025
d7b72a4
Improving XML parsing, this allow to improve resources, add contraint…
alvarofigueroa-ms Dec 11, 2025
d5c5c95
Adding rawRpm and rawDeb, also fixing cluster resources with class, p…
alvarofigueroa-ms Dec 12, 2025
147ed22
Adding storage type detection, improving parity of detection between …
alvarofigueroa-ms Dec 12, 2025
a7920f3
Adding console log processing, and emergency detection
alvarofigueroa-ms Dec 15, 2025
213365e
Adding cloudregister parsing: for license first, fixing offline bug i…
alvarofigueroa-ms Dec 17, 2025
578d8d5
Adding ASR kernel/runtime and build module versions
alvarofigueroa-ms Dec 17, 2025
ccb3a0b
Missing changes to create ASR fixtures
alvarofigueroa-ms Dec 17, 2025
2a452bd
Adding ASR version detection, suse raw package list, cluster resource…
alvarofigueroa-ms Dec 18, 2025
132b492
Adding automation (ansible, puppet, chef) detection. Reorganizing for…
alvarofigueroa-ms Dec 20, 2025
88a6817
Changing host none to host wasm
alvarofigueroa-ms Dec 20, 2025
02407ab
Fixing CI tests
alvarofigueroa-ms Dec 20, 2025
4f1286f
Continuing splitting categories into files. Adding nested compression
alvarofigueroa-ms Dec 23, 2025
22475f6
Fixing tests
alvarofigueroa-ms Dec 23, 2025
9e17468
Trying to fix remote deployed tests, using /dist/
alvarofigueroa-ms Dec 23, 2025
c5a4868
Large commit: adding CLI, moving parsers to prepare for npm lib, addi…
fede2cr Feb 3, 2026
91103a0
Fixing 2 failing tests by mostly adding fixtures
fede2cr Feb 3, 2026
a28ba03
Adding fencing auth dect, iscsi, fw rules, net interfaces, SDB, fenci…
fede2cr Feb 16, 2026
b72db16
Adding fencing auth dect, iscsi, fw rules, net interfaces, SDB, fenci…
fede2cr Feb 16, 2026
7f8bc97
Adding test-helpers, moving formatting of options to table
fede2cr Feb 16, 2026
e2854b6
analysis spec file has been split
fede2cr Feb 16, 2026
d93ebf2
Calling rca/build to create docs
fede2cr Feb 16, 2026
d22cc07
Moving from requires() to imports in accesibility checks
fede2cr Feb 16, 2026
308eb27
Fixing deployed tests
fede2cr Feb 16, 2026
94dfe18
Adding coverage testing
fede2cr Feb 16, 2026
d42be00
Individual files coverage
fede2cr Feb 16, 2026
56369e9
Adding individual coverage in CI, adding packages.spec into tests
fede2cr Feb 16, 2026
356a818
Adding cluster events for scc
fede2cr Feb 17, 2026
6829826
Adding ais disk support, sync of tests/ to src/, adding coverage and …
fede2cr Mar 9, 2026
6bdd4bd
Adding create fixtures to generate iaas zip
fede2cr Mar 9, 2026
914348f
Output dir of tests
fede2cr Mar 9, 2026
b255147
Tests have been split into individual files
fede2cr Mar 9, 2026
0fc14fe
Fixing cli tests
fede2cr Mar 9, 2026
fde54a9
Better screen reader support
fede2cr Mar 9, 2026
634a624
Improving package list, storage, unix, inspect iaas disk, accesibilit…
fede2cr Apr 9, 2026
ddf0429
Fixing av failed test
fede2cr Apr 9, 2026
7652041
Fixing doc testing with leptos ui
fede2cr Apr 9, 2026
1aefb95
Fixing failed tests post-deploy
fede2cr Apr 9, 2026
4617db9
Fixing failed tests post-deploy
fede2cr Apr 9, 2026
b686f74
Merge branch 'Azure:master' into rca-tool
fede2cr Apr 29, 2026
6268eab
Testing build of python and rust libraries, publishing commented
fede2cr Apr 29, 2026
bf35a86
Forgot the workflow for building packages...
fede2cr Apr 29, 2026
4609da2
Removing docker from rust+python build
fede2cr Apr 29, 2026
4406ace
Adding readme for python lib for pkg build
fede2cr Apr 29, 2026
970ee65
Adding readme for supportfile_core
fede2cr Apr 29, 2026
8a813d0
Moving cli to bin/
fede2cr Apr 29, 2026
e34f659
Wrong path for rca_cli
fede2cr Apr 29, 2026
f79b5e7
Improving rust cli perf, and avoid getting stuck
fede2cr Apr 30, 2026
a4fce16
Speed improvements in rca_cli.py and adding cargo publishing
fede2cr Apr 30, 2026
ce1b0d5
Improving rust library and rust cli, as well as python cli
fede2cr May 1, 2026
439e16c
Removing obsolete build
fede2cr May 1, 2026
9c47d61
Improvents in speed and fstab parsing
fede2cr May 12, 2026
c7b9a62
Adding lib wasm component
fede2cr May 12, 2026
b3f2efe
Adding wasm-pack in CI
fede2cr May 12, 2026
e858ebb
Adding wasm bridge
fede2cr May 12, 2026
c419d5d
Fixing web build
fede2cr May 12, 2026
0fab6bd
Fixing tests
fede2cr May 12, 2026
a23d825
Fixing cargo for crate
fede2cr May 12, 2026
61263b8
Fixing tests
fede2cr May 12, 2026
c1ed2f7
Updating CI to remove old web interface
fede2cr May 12, 2026
b380aea
Fixing post deploy tests
fede2cr May 12, 2026
d885f9d
Moving to lzma-rs with streaming branch, optimizing rs parsers, addin…
fede2cr May 21, 2026
37d189f
Fixing building in CI
fede2cr May 21, 2026
f7eeb55
Adding stream_wasm
fede2cr May 21, 2026
6101f0a
Reviewing playwright edge install
fede2cr May 21, 2026
27623ac
Moving coverage to rust lib
fede2cr May 21, 2026
5c8c483
Fixing errors in instrument covg
fede2cr May 21, 2026
1852a46
Updating test helpers to fix playright
fede2cr May 21, 2026
555c754
No retry in playwright to make it fail faster
fede2cr May 21, 2026
4c45919
Changing timeouts, removing web/ playright tests
fede2cr May 21, 2026
31dad1b
Fixing leptos web for tests
fede2cr May 21, 2026
c29a346
Fixing leptos web for tests
fede2cr May 21, 2026
9c92866
Fixing leptos web for tests
fede2cr May 21, 2026
3c9c860
Moving more code to rust for leptos
fede2cr May 22, 2026
ac38906
Moving more code to rust for leptos
fede2cr May 22, 2026
aaaf917
Moving more code to rust for leptos
fede2cr May 23, 2026
880b6f2
Moving more code to rust for leptos
fede2cr May 23, 2026
9171c38
Moving more code to rust for leptos
fede2cr May 23, 2026
056533c
Fixing nested gz, adding new detector of secureboot
fede2cr May 25, 2026
34d75e4
Testing crate version from github tags
fede2cr May 26, 2026
e885319
Adding --dirty to rust crate publishing, for dynamic version from GH …
fede2cr May 26, 2026
df37f9e
Fixing wrong arch while submitting to pypi
fede2cr May 26, 2026
21df18d
Adding hana specific detectors, lib mcp
fede2cr Jun 18, 2026
3caa367
Adding for failing leptos
fede2cr Jun 18, 2026
1b71384
Updating dev doc, adding sccache to all builds except when release, f…
fede2cr Jun 18, 2026
b13facd
Fixing testing
fede2cr Jun 18, 2026
fa41ab1
Fixing tests
fede2cr Jun 18, 2026
9a400be
Adding experimental fixtures-gen, adding hana tests, dynamic version …
fede2cr Jun 19, 2026
de149e3
Deploying web only on releases, adding fixes for macos
fede2cr Jun 19, 2026
00e2a97
Changes to CI, and vscode publisher
fede2cr Jun 25, 2026
f4b3866
Adding publisher and PAT
fede2cr Jun 26, 2026
9e68102
Testing PAT lenght
fede2cr Jun 26, 2026
77e1f97
Removing version tag for gh pages, but still using it as trigger
fede2cr Jun 26, 2026
ca12c10
Removing version tag for gh pages, but still using it as trigger
fede2cr Jun 26, 2026
d2e103e
Merge branch 'Azure:master' into rca-tool
fede2cr Jul 1, 2026
e2ca34a
Removing test output files
fede2cr Jul 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions .github/scripts/set-crate-version-from-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/usr/bin/env bash
# Bump the version of the supportfile Rust crates from the pushed git tag.
#
# Used by .github/workflows/rust-python-packages.yml when the workflow is
# triggered by a tag of the form `v<semver>` (e.g. `v0.1.2`). The leading
# `v` is stripped and the resulting version is written to all three crate
# Cargo.toml files so the published artifacts match the tag:
#
# - rca-tool/lib/supportfile_core (published to crates.io as `supportfile`)
# - rca-tool/lib/supportfile_py (built as a Python wheel)
# - rca-tool/lib/supportfile_wasm (used by the Leptos front-end build)
#
# After updating Cargo.toml files, the corresponding Cargo.lock entries
# are refreshed so subsequent `cargo --locked` invocations stay green.
#
# Environment:
# GITHUB_REF_NAME — tag name as provided by GitHub Actions (e.g. `v0.1.2`).
# Falls back to parsing `GITHUB_REF` if unset.

set -euo pipefail

ref_name="${GITHUB_REF_NAME:-}"
if [[ -z "$ref_name" && -n "${GITHUB_REF:-}" ]]; then
ref_name="${GITHUB_REF#refs/tags/}"
fi

if [[ -z "$ref_name" ]]; then
echo "ERROR: neither GITHUB_REF_NAME nor GITHUB_REF is set" >&2
exit 1
fi

if [[ ! "$ref_name" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-].+)?$ ]]; then
echo "ERROR: tag '$ref_name' does not look like a semver tag (expected vX.Y.Z)" >&2
exit 1
fi

version="${ref_name#v}"
echo "Setting supportfile crate versions to $version (from tag $ref_name)"

# Repo root is the working directory when invoked by Actions; resolve relative
# to this script so it can also be run locally from anywhere.
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
repo_root="$(cd "$script_dir/../.." && pwd)"

declare -a crate_dirs=(
"$repo_root/rca-tool/lib/supportfile_core"
"$repo_root/rca-tool/lib/supportfile_py"
"$repo_root/rca-tool/lib/supportfile_wasm"
)

for dir in "${crate_dirs[@]}"; do
toml="$dir/Cargo.toml"
if [[ ! -f "$toml" ]]; then
echo "ERROR: $toml not found" >&2
exit 1
fi
# Replace the FIRST `version = "..."` line only (package version, not
# dependency versions). Cargo convention places it in the [package]
# table at the top of the file.
sed -i -E "0,/^version[[:space:]]*=[[:space:]]*\".*\"/ s//version = \"$version\"/" "$toml"
echo " updated $toml"
done

# Refresh Cargo.lock entries for the renamed packages so `cargo --locked`
# continues to work in subsequent build/test/publish steps. Each crate has
# its own lockfile; path dependencies don't hit the network.
declare -A lock_updates=(
["$repo_root/rca-tool/lib/supportfile_core"]="supportfile"
["$repo_root/rca-tool/lib/supportfile_py"]="supportfile_py supportfile"
["$repo_root/rca-tool/lib/supportfile_wasm"]="supportfile-wasm supportfile"
)

for dir in "${!lock_updates[@]}"; do
pkgs="${lock_updates[$dir]}"
if [[ -f "$dir/Cargo.lock" ]]; then
args=()
for p in $pkgs; do
args+=(-p "$p")
done
echo " refreshing $dir/Cargo.lock for: $pkgs"
(cd "$dir" && cargo update "${args[@]}" --offline 2>/dev/null \
|| cd "$dir" && cargo update "${args[@]}")
fi
done

echo "Done."
304 changes: 304 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,304 @@
name: Build and Deploy to GitHub Pages

on:
push:
branches: [ main, master, rca-tool ]
tags: [ 'v*' ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
tests:
uses: ./.github/workflows/test.yml

build:
# Local tests (the `tests` job above) run on every push, but the GitHub
# Pages build/deploy only happens for version releases (v* tags) or a
# manual run. The tag only gates the deploy — no version is injected into
# the built site.
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
needs: tests
runs-on: ubuntu-latest
outputs:
leptos_js: ${{ steps.asset_manifest.outputs.leptos_js }}
leptos_wasm: ${{ steps.asset_manifest.outputs.leptos_wasm }}
leptos_css: ${{ steps.asset_manifest.outputs.leptos_css }}

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'

- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown

- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: |
rca-tool/web-leptos -> target
rca-tool/lib/lzma_stream_wasm -> target

# sccache speeds up the Leptos/WASM compilation on regular pushes. It is
# skipped on release tag builds.
- name: Restore sccache files
id: restore-sccache
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/.sccache
key: leptos-web-${{ runner.os }}-${{ runner.arch }}-sccache-
restore-keys: leptos-web-${{ runner.os }}-${{ runner.arch }}-sccache-

- name: Install sccache
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: taiki-e/install-action@v2
with:
tool: sccache

- name: Configure sccache
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
set -euo pipefail
SCCACHE_PATH="$(command -v sccache)"
SCCACHE_DIR="${GITHUB_WORKSPACE}/.sccache"
mkdir -p "$SCCACHE_DIR"

echo "Cache restore matched key: ${{ steps.restore-sccache.outputs.cache-matched-key }}"
du -sh "$SCCACHE_DIR" 2>/dev/null || true

echo "SCCACHE_DIR=$SCCACHE_DIR" | tee -a "$GITHUB_ENV"
echo "SCCACHE_CACHE_SIZE=2G" | tee -a "$GITHUB_ENV"
echo "CARGO_INCREMENTAL=0" | tee -a "$GITHUB_ENV"
echo "RUSTC_WRAPPER=$SCCACHE_PATH" | tee -a "$GITHUB_ENV"

SCCACHE_DIR="$SCCACHE_DIR" SCCACHE_CACHE_SIZE=2G "$SCCACHE_PATH" --start-server
"$SCCACHE_PATH" --zero-stats || true
"$SCCACHE_PATH" --show-stats || true

- name: Install Trunk
uses: taiki-e/install-action@v2
with:
tool: trunk

- name: Install wasm-pack
uses: taiki-e/install-action@v2
with:
tool: wasm-pack

- name: Build Leptos UI
run: ./build.sh
working-directory: rca-tool/web-leptos

- name: Prepare deployment directory
run: |
cd rca-tool/
rm -rf _site
mkdir -p _site
cp -r web-leptos/dist/* _site/
cp README.md _site/ || true
touch _site/.nojekyll

- name: List deployment files
run: |
echo "Files to be deployed:"
ls -lh rca-tool/_site/

- name: Capture Leptos asset manifest
id: asset_manifest
run: |
set -euo pipefail
cd rca-tool/_site
leptos_js=$(grep -o 'rca-tool-leptos-[^"]*\.js' index.html | head -n 1)
leptos_wasm=$(grep -o 'rca-tool-leptos-[^"]*_bg\.wasm' index.html | head -n 1)
leptos_css=$(grep -o 'styles-[^"]*\.css' index.html | head -n 1)

echo "Leptos JS: ${leptos_js}"
echo "Leptos WASM: ${leptos_wasm}"
echo "Leptos CSS: ${leptos_css}"

echo "leptos_js=${leptos_js}" >> "$GITHUB_OUTPUT"
echo "leptos_wasm=${leptos_wasm}" >> "$GITHUB_OUTPUT"
echo "leptos_css=${leptos_css}" >> "$GITHUB_OUTPUT"

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'rca-tool/_site'

- name: Show sccache stats
if: ${{ always() && !startsWith(github.ref, 'refs/tags/') }}
run: sccache --show-stats || true

- name: Prepare sccache files for saving
id: prepare-save-sccache
if: ${{ always() && !startsWith(github.ref, 'refs/tags/') }}
run: echo "SCCACHE_TIMESTAMP=$(date -u +%F-%T)" | tee -a "$GITHUB_OUTPUT"

- name: Save sccache files
if: ${{ always() && !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache/save@v5
with:
key: ${{ steps.restore-sccache.outputs.cache-primary-key }}${{ steps.prepare-save-sccache.outputs.SCCACHE_TIMESTAMP }}
path: ${{ github.workspace }}/.sccache

deploy:
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
outputs:
page_url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

post-deploy-test:
if: ${{ startsWith(github.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
needs: [build, deploy]

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'

- name: Install dependencies
run: npm ci
working-directory: rca-tool/tests

- name: Generate test fixtures
run: |
chmod +x create-fixtures.sh
./create-fixtures.sh
working-directory: rca-tool/tests

- name: Install Playwright Edge
run: npx playwright install --with-deps msedge
working-directory: rca-tool/tests

- name: Wait for deployment to be ready
env:
DEPLOYED_URL: ${{ needs.deploy.outputs.page_url }}
EXPECTED_LEPTOS_JS: ${{ needs.build.outputs.leptos_js }}
EXPECTED_LEPTOS_WASM: ${{ needs.build.outputs.leptos_wasm }}
EXPECTED_LEPTOS_CSS: ${{ needs.build.outputs.leptos_css }}
run: |
set -euo pipefail
CACHE_BUSTER="${GITHUB_RUN_ID}-${GITHUB_SHA}"
ROOT_URL="${DEPLOYED_URL%/}/"
ROOT_URL_BUSTED="${ROOT_URL}?cb=${CACHE_BUSTER}"
WORKER_URL="${ROOT_URL}assets/liblzma-streaming-worker.js?v=${CACHE_BUSTER}"
LEPTOS_JS_URL="${ROOT_URL}${EXPECTED_LEPTOS_JS}?cb=${CACHE_BUSTER}"
LEPTOS_WASM_URL="${ROOT_URL}${EXPECTED_LEPTOS_WASM}?cb=${CACHE_BUSTER}"
LEPTOS_CSS_URL="${ROOT_URL}${EXPECTED_LEPTOS_CSS}?cb=${CACHE_BUSTER}"

echo "Waiting for GitHub Pages to serve the freshly built site..."
echo "Root URL: ${ROOT_URL}"
echo "Expected JS: ${EXPECTED_LEPTOS_JS}"
echo "Expected WASM: ${EXPECTED_LEPTOS_WASM}"
echo "Expected CSS: ${EXPECTED_LEPTOS_CSS}"

for attempt in {1..30}; do
root_html="$(curl -fsSL "${ROOT_URL_BUSTED}" || true)"
worker_source="$(curl -fsSL "${WORKER_URL}" || true)"

root_ok=0
worker_ok=0
js_ok=0
wasm_ok=0
css_ok=0

if [[ "${root_html}" == *'RCA Tool'* \
&& "${root_html}" == *"${EXPECTED_LEPTOS_JS}"* \
&& "${root_html}" == *"${EXPECTED_LEPTOS_WASM}"* \
&& "${root_html}" == *"${EXPECTED_LEPTOS_CSS}"* ]]; then
root_ok=1
fi
# Check that the bundled worker asset is present and contains expected
# sentinel strings: versionedAsset (from worker.js) and parsers/services
# (from services.js, bundled into liblzma-streaming-worker.js).
if [[ "${worker_source}" == *'versionedAsset'* \
&& "${worker_source}" == *'parsers/services'* ]]; then
worker_ok=1
fi
if curl -fsI "${LEPTOS_JS_URL}" >/dev/null; then
js_ok=1
fi
if curl -fsI "${LEPTOS_WASM_URL}" >/dev/null; then
wasm_ok=1
fi
if curl -fsI "${LEPTOS_CSS_URL}" >/dev/null; then
css_ok=1
fi

echo "Attempt ${attempt}/30: root=${root_ok} worker=${worker_ok} js=${js_ok} wasm=${wasm_ok} css=${css_ok}"

if [[ ${root_ok} -eq 1 && ${worker_ok} -eq 1 && ${js_ok} -eq 1 && ${wasm_ok} -eq 1 && ${css_ok} -eq 1 ]]; then
echo "Deployment is ready."
break
fi

if [[ ${attempt} -eq 30 ]]; then
echo "Deployment did not become ready in time."
echo "--- Root preview ---"
printf '%s\n' "${root_html}" | head -n 40 || true
echo "--- Worker preview ---"
printf '%s\n' "${worker_source}" | sed -n '1,40p' || true
exit 1
fi

sleep 10
done

- name: Run post-deployment tests against Leptos
env:
DEPLOYED_URL: ${{ needs.deploy.outputs.page_url }}
CACHE_BUSTER: ${{ github.run_id }}-${{ github.sha }}
run: |
echo "Testing deployed Leptos UI at ${DEPLOYED_URL} (cache buster: ${CACHE_BUSTER})"
npx playwright test --config=playwright.leptos.config.js --project=deployed-leptos --reporter=list
working-directory: rca-tool/tests

- name: Upload post-deployment test results
if: always()
uses: actions/upload-artifact@v7
with:
name: post-deploy-test-results
path: |
rca-tool/tests/playwright-report*/
rca-tool/tests/test-results/
retention-days: 30

- name: Upload post-deployment coverage report
if: always()
uses: actions/upload-artifact@v7
with:
name: post-deploy-coverage-report
path: rca-tool/tests/coverage-report*/
retention-days: 30
Loading