Skip to content

fix(powerbi): recover from transient FailedToLoadModel errors #2127

fix(powerbi): recover from transient FailedToLoadModel errors

fix(powerbi): recover from transient FailedToLoadModel errors #2127

Workflow file for this run

name: Edge App Checks
on:
push:
branches:
- master
paths:
- "edge-apps/**"
pull_request:
branches:
- "**"
paths:
- "edge-apps/**"
jobs:
detect-changes:
name: Detect Changed Edge Apps
runs-on: ubuntu-latest
outputs:
changed-apps: ${{ steps.extract-changes.outputs.changed-apps }}
apps-with-build-system: ${{ steps.build-system-check.outputs.apps-with-build-system }}
apps-without-build-system: ${{ steps.no-build-system-check.outputs.apps-without-build-system }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v47
with:
files: |
edge-apps/**
files_ignore: |
edge-apps/**/node_modules/**
edge-apps/**/dist/**
edge-apps/**/.git/**
edge-apps/**/*.log
- name: Extract changed Edge Apps
id: extract-changes
run: |
# Get list of changed files
CHANGED_FILES="${{ steps.changed-files.outputs.all_changed_files }}"
# Read CHANGED_FILES into an array
read -ra FILES_ARRAY <<< "$CHANGED_FILES"
# Function to add app to list if not already included
add_app_if_valid() {
local app="$1"
if [[ -n "$app" && "$app" != "helpers" && "$app" != ".bun-create" ]]; then
if [[ -d "edge-apps/$app" ]]; then
if [[ " $CHANGED_APPS " != *" $app "* ]]; then
CHANGED_APPS="$CHANGED_APPS $app"
fi
fi
fi
}
# Extract unique Edge App directories from changed files
CHANGED_APPS=""
for file in "${FILES_ARRAY[@]}"; do
if [[ "$file" == edge-apps/* ]]; then
# Extract the app name (first directory after edge-apps/)
APP_NAME=$(echo "$file" | cut -d'/' -f2)
add_app_if_valid "$APP_NAME"
fi
done
# Remove leading space and set output
CHANGED_APPS="${CHANGED_APPS# }"
echo "changed-apps=$CHANGED_APPS" >> "$GITHUB_OUTPUT"
echo "Changed Edge Apps: $CHANGED_APPS"
- name: Check which apps have build systems
id: build-system-check
run: |
CHANGED_APPS="${{ steps.extract-changes.outputs.changed-apps }}"
APPS_WITH_BUILD_SYSTEM=""
# Read CHANGED_APPS into an array
read -ra APPS_ARRAY <<< "$CHANGED_APPS"
for app in "${APPS_ARRAY[@]}"; do
if [[ -f "edge-apps/$app/package.json" ]]; then
APPS_WITH_BUILD_SYSTEM="$APPS_WITH_BUILD_SYSTEM $app"
fi
done
# Remove leading space and convert to JSON array
APPS_WITH_BUILD_SYSTEM="${APPS_WITH_BUILD_SYSTEM# }"
if [[ -n "$APPS_WITH_BUILD_SYSTEM" ]]; then
# Convert space-separated string to JSON array
JSON_ARRAY=$(echo "$APPS_WITH_BUILD_SYSTEM" | tr ' ' '\n' | jq -R . | jq -s -c .)
echo "apps-with-build-system=$JSON_ARRAY" >> "$GITHUB_OUTPUT"
else
echo "apps-with-build-system=[]" >> "$GITHUB_OUTPUT"
fi
echo "Apps with build system: $APPS_WITH_BUILD_SYSTEM"
- name: Check which apps don't have build systems
id: no-build-system-check
run: |
CHANGED_APPS="${{ steps.extract-changes.outputs.changed-apps }}"
APPS_WITHOUT_BUILD_SYSTEM=""
read -ra APPS_ARRAY <<< "$CHANGED_APPS"
for app in "${APPS_ARRAY[@]}"; do
if [[ ! -f "edge-apps/$app/package.json" ]]; then
APPS_WITHOUT_BUILD_SYSTEM="$APPS_WITHOUT_BUILD_SYSTEM $app"
fi
done
APPS_WITHOUT_BUILD_SYSTEM="${APPS_WITHOUT_BUILD_SYSTEM# }"
if [[ -n "$APPS_WITHOUT_BUILD_SYSTEM" ]]; then
JSON_ARRAY=$(echo "$APPS_WITHOUT_BUILD_SYSTEM" | tr ' ' '\n' | jq -R . | jq -s -c .)
echo "apps-without-build-system=$JSON_ARRAY" >> "$GITHUB_OUTPUT"
else
echo "apps-without-build-system=[]" >> "$GITHUB_OUTPUT"
fi
echo "Apps without build system: $APPS_WITHOUT_BUILD_SYSTEM"
run-full-checks:
name: Run Full Checks for ${{ matrix.app }}
runs-on: ubuntu-latest
needs: detect-changes
strategy:
matrix:
app: ${{ fromJSON(needs.detect-changes.outputs.apps-with-build-system) }}
fail-fast: false
if: needs.detect-changes.outputs.apps-with-build-system != '[]'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- name: Install dependencies
working-directory: edge-apps/${{ matrix.app }}
run: bun install
- name: Run linting
working-directory: edge-apps/${{ matrix.app }}
run: bun run lint
- name: Run formatting check
working-directory: edge-apps/${{ matrix.app }}
run: bun run format:check
- name: Run unit tests
working-directory: edge-apps/${{ matrix.app }}
run: bun run test:unit
- name: Build application
working-directory: edge-apps/${{ matrix.app }}
run: bun run build
- name: Check for E2E tests
id: check-e2e
working-directory: edge-apps/${{ matrix.app }}
run: |
if grep -q '"test:e2e"' package.json; then
echo "has-e2e=true" >> "$GITHUB_OUTPUT"
else
echo "has-e2e=false" >> "$GITHUB_OUTPUT"
fi
- name: Install E2E dependencies
if: steps.check-e2e.outputs.has-e2e == 'true'
working-directory: edge-apps/${{ matrix.app }}
run: npx playwright install --with-deps
- name: Run E2E tests
if: steps.check-e2e.outputs.has-e2e == 'true'
uses: nick-fields/retry@v4
with:
timeout_minutes: 5
max_attempts: 5
retry_on: error
command: cd edge-apps/${{ matrix.app }} && bun run test:e2e
run-simple-checks:
name: Run Simple Checks for ${{ matrix.app }}
runs-on: ubuntu-latest
needs: detect-changes
strategy:
matrix:
app: ${{ fromJSON(needs.detect-changes.outputs.apps-without-build-system) }}
fail-fast: false
if: needs.detect-changes.outputs.apps-without-build-system != '[]'
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- name: Run formatting check
run: |
bunx prettier --check \
--config edge-apps/.prettierrc.json \
--no-error-on-unmatched-pattern \
"edge-apps/${{ matrix.app }}/**/*.{html,css,js,json,yml,yaml,md}"
- name: Run Markdown lint
run: |
bunx markdownlint-cli2 \
--config edge-apps/.markdownlint.json \
"edge-apps/${{ matrix.app }}/**/*.md"
- name: Run HTML lint
run: |
find "edge-apps/${{ matrix.app }}" \
-name "*.html" \
-not -path "*/static/*" \
-not -path "*/dist/*" \
-not -path "*/node_modules/*" \
-print0 | xargs -0 -r bunx htmlhint
- name: Run CSS lint
run: |
find "edge-apps/${{ matrix.app }}" \
-name "*.css" \
-not -path "*/dist/*" \
-not -path "*/node_modules/*" \
-print0 | xargs -0 -r bunx stylelint \
--config edge-apps/.stylelintrc.json
- name: Run JavaScript lint
run: |
find "edge-apps/${{ matrix.app }}" \
-name "*.js" \
-not -name "*.min.js" \
-not -name "eslint.config.js" \
-not -path "*/dist/*" \
-not -path "*/node_modules/*" \
-print0 | xargs -0 -r bunx eslint \
--config edge-apps/eslint.config.cjs
summary:
name: Summary
runs-on: ubuntu-latest
needs: [detect-changes, run-full-checks, run-simple-checks]
if: always()
steps:
- name: Check if any apps were processed
run: |
if [[ "${{ needs.detect-changes.outputs.changed-apps }}" == "" ]]; then
echo "No Edge Apps were changed."
else
echo "Apps with build system: ${{ needs.detect-changes.outputs.apps-with-build-system }}"
echo "Apps without build system: ${{ needs.detect-changes.outputs.apps-without-build-system }}"
fi
- name: Check for failures
if: needs.run-full-checks.result == 'failure' || needs.run-simple-checks.result == 'failure'
run: |
echo "Some Edge App checks failed. Please review the logs above."
exit 1