feat(button): in the meantime #5
This file contains hidden or 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
| name: Reusable CI Checks | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| runall: | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| secrets: | ||
| UNITTESTS_APPSETTINGS_DEVELOPMENT: | ||
| required: true | ||
| WASMSTATICCLIENT_APPSETTINGS_DEVELOPMENT: | ||
| required: true | ||
| WASMSERVERHOSTCLIENT_APPSETTINGS_DEVELOPMENT: | ||
| required: true | ||
| WASMSERVERHOST_APPSETTINGS_DEVELOPMENT: | ||
| required: true | ||
| FAKE_WASMSERVERHOST_APPSETTINGS_DEVELOPMENT: | ||
| required: false # Set to true if it's always required | ||
| PACKAGES_TOKEN: | ||
| required: true | ||
| env: | ||
| # Permission | ||
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| PACKAGES_TOKEN: ${{ secrets.PACKAGES_TOKEN }} | ||
| # GITHUB_USERNAME: "Phil-NHS" | ||
| # Nuget Set Up | ||
| TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH: ${{ github.workspace }}/CICDPackageLocation | ||
| TELBLAZOR_PACKAGE_SOURCE: ${{ github.workspace }}/CICDPackageLocation | ||
| #TELBLAZOR_PACKAGE_SOURCE: "https://nuget.pkg.github.com/TechnologyEnhancedLearning/index.json" | ||
| # Build Set Up | ||
| USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE: false | ||
| DISABLE_PACKAGE_GENERATION: true | ||
| E2E_TRACING_ENABLED: false | ||
| # Check Dummy Data | ||
| TELBLAZOR_PACKAGE_VERSION: "0.0.0-ci-checks" | ||
| HEADLESS_TESTING: true | ||
| jobs: | ||
| # Build Package | ||
| # Build Solution useing package | ||
| reuseable-ci-checks-solution-build: | ||
| name: Check solution builds | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: ${{ inputs.runall }} | ||
| outputs: | ||
| status: ${{ job.status }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json | ||
| - name: Replace local environment variable in nuget config because cant provide it as a parameter | ||
| run: sed -i "s|%TELBlazorPackageSource%|$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH|g" nuget.config | ||
| - name: Create appsettings development from secrets | ||
| run: | | ||
| declare -A paths | ||
| paths["./TELBlazor.Components.UnitTests/appsettings.Development.json"]='${{ secrets.UNITTESTS_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Development.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.UnitTests/appsettings.Production.json"]='${{ secrets.UNITTESTS_APPSETTINGS_PRODUCTION }}' | ||
| paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Production.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_PRODUCTION }}' | ||
| for path in "${!paths[@]}"; do | ||
| mkdir -p "$(dirname "$path")" | ||
| printf '%s' "${paths[$path]}" > "$path" | ||
| done | ||
| - name: Clean lock files because the newly generated package file will superseed the locks | ||
| run: | | ||
| find . -name "packages.lock.json" -type f -exec rm -f {} \; | ||
| - name: Set up Node.js so we have gulp for retrieving TEL Frontend Css | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Install npm packages so we have gulp for retrieving TEL Frontend Css | ||
| working-directory: ./TELBlazor.Components | ||
| run: npm ci | ||
| - name: Build and create package locally | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: false | ||
| run: | | ||
| dotnet build TELBlazor.Components -c Release \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED | ||
| - name: Build solution without generating new package | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: true | ||
| run: | | ||
| dotnet build TELBlazor.sln -c Release \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED | ||
| reuseable-ci-checks-branch-name-check: | ||
| name: Check branch names | ||
| if: success() || failure() | ||
| continue-on-error: ${{ inputs.runall }} | ||
| outputs: | ||
| status: ${{ job.status }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Validate Branch Name | ||
| run: | | ||
| #BRANCH_NAME="${GITHUB_HEAD_REF}" | ||
| BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}" | ||
| echo "Validating branch name: $BRANCH_NAME" | ||
| if [[ "$BRANCH_NAME" =~ ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|sample|security|config|bugfix|hotfix)-[a-zA-Z0-9._/-]+$ ]] || [[ "$BRANCH_NAME" == "master" ]]; then | ||
| echo "✅ Branch name is valid" | ||
| else | ||
| echo "❌ Invalid branch name: $BRANCH_NAME" | ||
| echo "Branch names must follow one of the allowed prefixes:" | ||
| echo " build-*, feat-*, fix-*, bugfix-*, hotfix-*, build-*, chore-*, ci-*, docs-*, perf-*, refactor-*, revert-*, style-*, test-*, sample-*, security-*, config-*, bugfix-*, hotfix-*" | ||
| exit 1 | ||
| fi | ||
| reuseable-ci-checks-commitlint: | ||
| name: Check commit names | ||
| runs-on: ubuntu-latest | ||
| if: success() || failure() | ||
| continue-on-error: ${{ inputs.runall }} | ||
| outputs: | ||
| status: ${{ job.status }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: wagoid/commitlint-github-action@v5 | ||
| with: | ||
| configFile: .commitlintrc.json | ||
| reuseable-ci-checks-unit-tests: | ||
| name: Unit test components | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| if: success() || failure() | ||
| continue-on-error: ${{ inputs.runall }} | ||
| outputs: | ||
| status: ${{ job.status }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json | ||
| - name: Replace local environment variable in nuget config because cant provide it as a parameter | ||
| run: sed -i "s|%TELBlazorPackageSource%|$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH|g" nuget.config | ||
| - name: Create appsettings development from secrets | ||
| run: | | ||
| declare -A paths | ||
| paths["./TELBlazor.Components.UnitTests/appsettings.Development.json"]='${{ secrets.UNITTESTS_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Development.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_DEVELOPMENT }}' | ||
| # paths["./TELBlazor.Components.UnitTests/appsettings.Production.json"]='${{ secrets.UNITTESTS_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Production.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_PRODUCTION }}' | ||
| for path in "${!paths[@]}"; do | ||
| mkdir -p "$(dirname "$path")" | ||
| printf '%s' "${paths[$path]}" > "$path" | ||
| done | ||
| - name: Clean lock files because the newly generated package file will superseed the locks | ||
| run: | | ||
| find . -name "packages.lock.json" -type f -exec rm -f {} \; | ||
| - name: Set up Node.js so we have gulp for retrieving TEL Frontend Css | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Install npm packages so we have gulp for retrieving TEL Frontend Css | ||
| working-directory: ./TELBlazor.Components | ||
| run: npm ci | ||
| - name: Build and create package locally | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: false | ||
| run: | | ||
| dotnet build TELBlazor.Components -c Debug \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED | ||
| - name: Build solution without generating new package | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: true | ||
| run: | | ||
| dotnet build TELBlazor.sln -c Debug \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED | ||
| - name: Run Unit tests | ||
| run: dotnet test "TELBlazor.Components.UnitTests.csproj" --no-build --verbosity normal | ||
| working-directory: "./TELBlazor.Components.UnitTests" | ||
| reuseable-ci-checks-e2e-tests: | ||
| name: Check with end to end testing including nojs | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| if: success() || failure() | ||
| continue-on-error: ${{ inputs.runall }} | ||
| outputs: | ||
| status: ${{ job.status }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json | ||
| - name: Replace local environment variable in nuget config because cant provide it as a parameter | ||
| run: sed -i "s|%TELBlazorPackageSource%|$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH|g" nuget.config | ||
| - name: Clean lock files because the newly generated package file will superseed the locks | ||
| run: | | ||
| find . -name "packages.lock.json" -type f -exec rm -f {} \; | ||
| - name: Create appsettings development from secrets | ||
| run: | | ||
| declare -A paths | ||
| paths["./TELBlazor.Components.UnitTests/appsettings.Development.json"]='${{ secrets.UNITTESTS_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Development.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_DEVELOPMENT }}' | ||
| # paths["./TELBlazor.Components.UnitTests/appsettings.Production.json"]='${{ secrets.UNITTESTS_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Production.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_PRODUCTION }}' | ||
| for path in "${!paths[@]}"; do | ||
| mkdir -p "$(dirname "$path")" | ||
| printf '%s' "${paths[$path]}" > "$path" | ||
| done | ||
| - name: Set up Node.js so we have gulp for retrieving TEL Frontend Css | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Install npm packages so we have gulp for retrieving TEL Frontend Css | ||
| working-directory: ./TELBlazor.Components | ||
| run: npm ci | ||
| - name: Build and create package locally | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: false | ||
| run: | | ||
| dotnet build TELBlazor.Components -c Debug \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED \ | ||
| /p:HeadlessTesting=$HEADLESS_TESTING | ||
| - name: Build solution without generating new package | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: true | ||
| run: | | ||
| dotnet build TELBlazor.sln -c Debug \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED \ | ||
| /p:HeadlessTesting=$HEADLESS_TESTING | ||
| - name: Ensure browsers are installed | ||
| run: pwsh TELBlazor.Components.ShowCase.E2ETests/bin/Debug/net8.0/playwright.ps1 install --with-deps | ||
| - name: E2E tests except filtered | ||
| env: | ||
| TELBlazorPackageVersion: ${{ env.TELBLAZOR_PACKAGE_VERSION }} | ||
| NupkgOutputPath: ${{ env.TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH }} | ||
| UseTELBlazorComponentsProjectReference: ${{ env.USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE }} | ||
| TELBlazorPackageSource: ${{ env.TELBLAZOR_PACKAGE_SOURCE }} | ||
| DisablePackageGeneration: ${{ env.DISABLE_PACKAGE_GENERATION }} | ||
| E2ETracingEnabled: ${{ env.E2E_TRACING_ENABLED }} | ||
| HeadlessTesting: ${{ env.HEADLESS_TESTING }} | ||
| run: | | ||
| dotnet test --filter "Category!=LocalOnly & Category!=HeadlessFalse" TELBlazor.Components.ShowCase.E2ETests.csproj --no-build --no-restore --verbosity minimal | ||
| working-directory: ./TELBlazor.Components.ShowCase.E2ETests | ||
| reuseable-ci-checks-code-coverage: | ||
| name: Check for code coverage | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| if: success() || failure() | ||
| continue-on-error: ${{ inputs.runall }} | ||
| outputs: | ||
| status: ${{ job.status }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| global-json-file: global.json | ||
| - name: Replace local environment variable in nuget config because cant provide it as a parameter | ||
| run: sed -i "s|%TELBlazorPackageSource%|$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH|g" nuget.config | ||
| - name: Clean lock files because the newly generated package file will superseed the locks | ||
| run: | | ||
| find . -name "packages.lock.json" -type f -exec rm -f {} \; | ||
| - name: Create appsettings development from secrets | ||
| run: | | ||
| declare -A paths | ||
| paths["./TELBlazor.Components.UnitTests/appsettings.Development.json"]='${{ secrets.UNITTESTS_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Development.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_DEVELOPMENT }}' | ||
| paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Development.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_DEVELOPMENT }}' | ||
| # paths["./TELBlazor.Components.UnitTests/appsettings.Production.json"]='${{ secrets.UNITTESTS_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.WasmStaticClient/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSTATICCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost.Client/wwwroot/appsettings.Production.json"]='${{ secrets.WASMSERVERHOSTCLIENT_APPSETTINGS_PRODUCTION }}' | ||
| # paths["./TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/TELBlazor.Components.ShowCase.E2ETests.WasmServerHost/appsettings.Production.json"]='${{ secrets.WASMSERVERHOST_APPSETTINGS_PRODUCTION }}' | ||
| for path in "${!paths[@]}"; do | ||
| mkdir -p "$(dirname "$path")" | ||
| printf '%s' "${paths[$path]}" > "$path" | ||
| done | ||
| - name: Set up Node.js so we have gulp for retrieving TEL Frontend Css | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| - name: Install npm packages so we have gulp for retrieving TEL Frontend Css | ||
| working-directory: ./TELBlazor.Components | ||
| run: npm ci | ||
| - name: Install ReportGenerator | ||
| run: dotnet tool restore | ||
| - name: Build and create package locally | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: false | ||
| run: | | ||
| dotnet build TELBlazor.Components -c Debug \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED \ | ||
| /p:HeadlessTesting=$HEADLESS_TESTING | ||
| - name: Build solution without generating new package | ||
| env: | ||
| #Overwrite package generation | ||
| DISABLE_PACKAGE_GENERATION: true | ||
| run: | | ||
| dotnet build TELBlazor.sln -c Debug \ | ||
| /p:TELBlazorPackageVersion=$TELBLAZOR_PACKAGE_VERSION \ | ||
| /p:NupkgOutputPath=$TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH \ | ||
| /p:UseTELBlazorComponentsProjectReference=$USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE \ | ||
| /p:TELBlazorPackageSource=$TELBLAZOR_PACKAGE_SOURCE \ | ||
| /p:DisablePackageGeneration=$DISABLE_PACKAGE_GENERATION \ | ||
| /p:E2ETracingEnabled=$E2E_TRACING_ENABLED \ | ||
| /p:HeadlessTesting=$HEADLESS_TESTING | ||
| - name: Ensure browsers are installed | ||
| run: pwsh TELBlazor.Components.ShowCase.E2ETests/bin/Debug/net8.0/playwright.ps1 install --with-deps | ||
| - name: Run tests with coverage | ||
| env: | ||
| TELBlazorPackageVersion: ${{ env.TELBLAZOR_PACKAGE_VERSION }} | ||
| NupkgOutputPath: ${{ env.TELBLAZOR_PACKAGE_LOCAL_OUTPUT_PATH }} | ||
| UseTELBlazorComponentsProjectReference: ${{ env.USE_TEL_BLAZOR_COMPONENTS_PROJECT_REFERENCE }} | ||
| TELBlazorPackageSource: ${{ env.TELBLAZOR_PACKAGE_SOURCE }} | ||
| DisablePackageGeneration: ${{ env.DISABLE_PACKAGE_GENERATION }} | ||
| E2ETracingEnabled: ${{ env.E2E_TRACING_ENABLED }} | ||
| HeadlessTesting: ${{ env.HEADLESS_TESTING }} | ||
| run: | | ||
| dotnet test --collect:"XPlat Code Coverage" | ||
| - name: Generate Coverage Report | ||
| run: | | ||
| dotnet reportgenerator \ | ||
| -reports:"**/TestResults/**/coverage.cobertura.xml" \ | ||
| -targetdir:coveragereport \ | ||
| -reporttypes:Html \ | ||
| -thresholdtype:line \ | ||
| -threshold:80 | ||
| - name: upload coverage report | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: coverage-report | ||
| path: coveragereport | ||
| - name: Debug PACKAGES_TOKEN value (Optional) | ||
| run: | | ||
| echo "PACKAGES_TOKEN is set." | ||
| echo "PACKAGES_TOKEN=$PACKAGES_TOKEN" # This should print nothing, it's a secret! | ||
| - name: Get artifact location | ||
| env: | ||
| PACKAGES_TOKEN: ${{ secrets.PACKAGES_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.PACKAGES_TOKEN }} | ||
| run: | | ||
| # Get the artifact list for the current workflow run | ||
| ARTIFACT_LIST=$(gh api "repos/TechnologyEnhancedLearning/TELBlazor/actions/runs/${GITHUB_RUN_ID}/artifacts") | ||
| # Echo the entire artifact list for debugging purposes | ||
| echo "Artifact List: $ARTIFACT_LIST" | ||
| # Extract the download URL from the artifact list (first artifact in the list) | ||
| #ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[0].archive_download_url') | ||
| ARTIFACT_URL=$(echo "$ARTIFACT_LIST" | jq -r '.artifacts[0].url') | ||
| # Echo the artifact URL to confirm | ||
| echo "Artifact URL: $ARTIFACT_URL" | ||
| echo "artifact_url=$ARTIFACT_URL" >> $GITHUB_ENV | ||
| - name: Trigger workflow in TELBlazor-CodeReport repo | ||
| env: | ||
| PACKAGES_TOKEN: ${{ secrets.PACKAGES_TOKEN }} | ||
| GH_TOKEN: ${{ secrets.PACKAGES_TOKEN }} | ||
| run: | | ||
| repo_owner="TechnologyEnhancedLearning" | ||
| repo_name="TELBlazor-CodeReport" | ||
| event_type="artifact_ready" | ||
| # Trigger the workflow | ||
| curl -L \ | ||
| -X POST \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "Authorization: Bearer $PACKAGES_TOKEN" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| https://api.github.com/repos/$repo_owner/$repo_name/dispatches \ | ||
| -d "{\"event_type\": \"$event_type\", \"client_payload\": {\"artifact_url\": \"$artifact_url\"}}" | ||
| reuseable-ci-checks-check-for-failed-jobs: | ||
| name: Check for failures | ||
| if: ${{ inputs.runall }} | ||
| needs: | ||
| - reuseable-ci-checks-solution-build | ||
| - reuseable-ci-checks-branch-name-check | ||
| - reuseable-ci-checks-commitlint | ||
| - reuseable-ci-checks-unit-tests | ||
| - reuseable-ci-checks-e2e-tests | ||
| - reuseable-ci-checks-code-coverage | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check Job Results | ||
| run: | | ||
| echo "Solution Build: ${{ needs.reuseable-ci-checks-solution-build.outputs.status }}" | ||
| echo "Branch Name Check: ${{ needs.reuseable-ci-checks-branch-name-check.outputs.status }}" | ||
| echo "Commitlint: ${{ needs.reuseable-ci-checks-commitlint.outputs.status }}" | ||
| echo "Unit Tests: ${{ needs.reuseable-ci-checks-unit-tests.outputs.status }}" | ||
| echo "E2E Tests: ${{ needs.reuseable-ci-checks-e2e-tests.outputs.status }}" | ||
| echo "Code Coverage: ${{ needs.reuseable-ci-checks-code-coverage.outputs.status }}" | ||
| # Check if any job is not success (failure, cancelled, skipped) | ||
| if [[ "${{ needs.reuseable-ci-checks-solution-build.outputs.status }}" != "success" || \ | ||
| "${{ needs.reuseable-ci-checks-branch-name-check.outputs.status }}" != "success" || \ | ||
| "${{ needs.reuseable-ci-checks-commitlint.outputs.status }}" != "success" || \ | ||
| "${{ needs.reuseable-ci-checks-unit-tests.outputs.status }}" != "success" || \ | ||
| "${{ needs.reuseable-ci-checks-e2e-tests.outputs.status }}" != "success" || \ | ||
| "${{ needs.reuseable-ci-checks-code-coverage.outputs.status }}" != "success" ]]; then | ||
| echo "❌ One or more jobs failed." | ||
| exit 1 | ||
| fi | ||
| continue-on-error: false | ||