diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 06dbb094d2..f6788a095c 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -1,36 +1,71 @@ +# This GitHub Actions workflow is named "CD" and is triggered manually via the `workflow_dispatch` event. +# It accepts the following inputs: +# - major: Year (number, required, default: '24') +# - minor: Release (number, required, default: '4') +# - build: Beta (number, required, default: '0') +# - revision: Alpha (number, required, default: '0') +# - SSLCert: Add Certificate (choice, required, default: 'No', options: ['Yes', 'No']) +# +# The workflow consists of the following jobs: +# 1. Create-version-Number: +# - Runs on `ubuntu-latest`. +# - Generates version numbers and tags based on the input values. +# - Outputs `version_number` and `version_tag`. +# - Caches the generated version text file. +# +# 2. CI: +# - Depends on the `Create-version-Number` job. +# - Uses the `.github/workflows/CI.yml` workflow. +# - Inherits secrets. +# +# 3. Release: +# - Depends on the `CI` job. +# - Uses the `.github/workflows/Release.yml` workflow. +# - Inherits secrets. +# +# 4. Deploy: +# - Depends on the `Release` job. +# - Uses the `.github/workflows/Deploy.yml` workflow. +# +# 5. Docker: +# - Depends on the `CI` job. +# - Uses the `.github/workflows/Docker.yml` workflow. +# - Inherits secrets. + name: CD on: + # Trigger the workflow manually with the `workflow_dispatch` event workflow_dispatch: - inputs: - major: - description: Year - type: number - required: true - default: '24' - minor: - description: Release - type: number - required: true - default: '4' - build: - description: Beta - type: number - required: true - default: '0' - revision: - description: Alpha - type: number - required: true - default: '0' - SSLCert: - description: "Add Certificate" - type: choice - required: true - default: 'No' - options: - - 'Yes' - - 'No' + inputs: + major: + description: Year # The year of the release, e.g., 24 for 2024 + type: number + required: true + default: '24' + minor: + description: Release # The minor version of the release, e.g., 4 for the fourth release of the year + type: number + required: true + default: '4' + build: + description: Beta # The build number, typically used for beta versions + type: number + required: true + default: '0' + revision: + description: Alpha # The revision number, typically used for alpha versions + type: number + required: true + default: '0' + SSLCert: + description: "Add Certificate" # Option to add an SSL certificate + type: choice + required: true + default: 'No' + options: + - 'Yes' # Add SSL certificate + - 'No' # Do not add SSL certificate jobs: Create-version-Number: runs-on: ubuntu-latest diff --git a/.github/workflows/CI-2.yml b/.github/workflows/CI-2.yml index ad7b6fea86..1b47e7447d 100644 --- a/.github/workflows/CI-2.yml +++ b/.github/workflows/CI-2.yml @@ -21,10 +21,10 @@ jobs: Build: name: Build Stage # needs: Codacy - uses: ./.github/workflows/GingerBuild-2.yml + uses: ./.github/workflows/GingerBuild.yml Test: name: Test Stage needs: Build - uses: ./.github/workflows/GingerTests-2.yml + uses: ./.github/workflows/GingerTests.yml secrets: inherit diff --git a/.github/workflows/GingerBuild-2.yml b/.github/workflows/GingerBuild-2.yml deleted file mode 100644 index 1c443627d7..0000000000 --- a/.github/workflows/GingerBuild-2.yml +++ /dev/null @@ -1,104 +0,0 @@ -name: Ginger_Builder - -on: - workflow_call: - -jobs: - build: - runs-on: windows-latest - - env: - BUILD_CONFIGURATION: Release - - steps: -# ------------------------------------------------------------------------------------------------------ -# Createin version Tag & Number variables - only for CD Job -# ------------------------------------------------------------------------------------------------------ - - name: Restore Version text file - if: ${{github.workflow == 'CD'}} - uses: actions/cache@v3.2.6 - with: - path: ./version.txt - key: cache-version-${{ github.run_number }} - enableCrossOsArchive: - true - - - name: Create variables from Artifacts file - if: ${{github.workflow == 'CD'}} - shell: bash - run: | - source version.txt - echo $TAG - echo "gingernumber=$NUMBER" >> $GITHUB_ENV - echo "gingertag=$TAG" >> $GITHUB_ENV - -# ------------------------------------------------------------------------------------------------------ -# Copy Ginger repo -# ------------------------------------------------------------------------------------------------------ - - uses: actions/checkout@v3 - -# ------------------------------------------------------------------------------------------------------ -# Update Ginger Version -# ------------------------------------------------------------------------------------------------------ - - name: 'Update Assembly' - if: ${{github.workflow == 'CD'}} - run: | - $save=((Get-Content .\Ginger\GingerCoreCommon/GingerCoreCommon.csproj) -replace '*.*.*.*','${{ env.gingernumber}}') -replace '*.*.*.*','${{ env.gingernumber}}' - echo $save > .\Ginger\GingerCoreCommon/GingerCoreCommon.csproj - $save=(Get-Content .\Ginger\GingerInstallerScript.iss) -replace '#define MyAppVersion "*.*.*.*"','#define MyAppVersion "${{ env.gingernumber}}"' - echo $save > .\Ginger\GingerInstallerScript.iss - $save=(Get-Content .\Ginger\GingerCore\Drivers\JavaDriverLib\GingerJavaAgent\agent\com\amdocs\ginger\GingerAgent.java) -replace 'public static final String GINGER_JAVA_AGENT_VERSION="*.*.*.*";','public static final String GINGER_JAVA_AGENT_VERSION="${{ env.gingernumber}}";' - echo $save > .\Ginger\GingerCore\Drivers\JavaDriverLib\GingerJavaAgent\agent\com\amdocs\ginger\GingerAgent.java - $save=(Get-Content .\Ginger\GingerInstallerScriptGithub.iss) -replace '#define MyAppVersion "*.*.*.*"','#define MyAppVersion "${{ env.gingernumber}}"' - echo $save > .\Ginger\GingerInstallerScriptGithub.iss - -# ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 8.0.100 -# ------------------------------------------------------------------------------------------------------ - - name: 'Install .NET 8' - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.100 - -# ------------------------------------------------------------------------------------------------------ -# Install Nuget tool v1.0.5 -# ------------------------------------------------------------------------------------------------------ - - name: 'Setup Nuget' - uses: Nuget/setup-nuget@v1.0.5 - -# ------------------------------------------------------------------------------------------------------ -# Restore Ginger solution NuGet packages -# ------------------------------------------------------------------------------------------------------ - - name: 'Restore nuget packages' - run: nuget restore ./Ginger/Ginger.sln - -# ------------------------------------------------------------------------------------------------------ -# Install msbild && Build Ginger Solution -# ------------------------------------------------------------------------------------------------------ - - name: 'Add msbuild to PATH' - uses: microsoft/setup-msbuild@v1.0.2 - - - name: 'Build Ginger Solution' - run: msbuild ./Ginger/Ginger.sln /p:DebugSymbols=true /p:DebugType=full /p:Configuration=$env:BUILD_CONFIGURATION - -# ------------------------------------------------------------------------------------------------------ -# Publish GingerRuntime -# ------------------------------------------------------------------------------------------------------ - - name: 'Publish GingerRuntime' - run: dotnet publish ./Ginger/GingerRuntime/GingerRuntime.csproj --runtime linux-x64 --self-contained true -c Release - -# ------------------------------------------------------------------------------------------------------ -# Upload Artifacts -# ------------------------------------------------------------------------------------------------------ - - name: Cache static site content - id: cache - uses: actions/cache@v3.2.6 - with: - path: - ./** - key: - cache-site-${{ github.run_number }} - enableCrossOsArchive: - true - - diff --git a/.github/workflows/GingerBuild.yml b/.github/workflows/GingerBuild.yml index 7f8aab65d5..1c443627d7 100644 --- a/.github/workflows/GingerBuild.yml +++ b/.github/workflows/GingerBuild.yml @@ -14,11 +14,14 @@ jobs: # ------------------------------------------------------------------------------------------------------ # Createin version Tag & Number variables - only for CD Job # ------------------------------------------------------------------------------------------------------ - - name: Download Version Artifacts - if: ${{github.workflow == 'CD'}} - uses: actions/download-artifact@v3 + - name: Restore Version text file + if: ${{github.workflow == 'CD'}} + uses: actions/cache@v3.2.6 with: - name: ginger-version + path: ./version.txt + key: cache-version-${{ github.run_number }} + enableCrossOsArchive: + true - name: Create variables from Artifacts file if: ${{github.workflow == 'CD'}} @@ -50,12 +53,12 @@ jobs: echo $save > .\Ginger\GingerInstallerScriptGithub.iss # ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 6.0.301 +# Install .Net core SDK 8.0.100 # ------------------------------------------------------------------------------------------------------ - - name: 'Install .NET Core' + - name: 'Install .NET 8' uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.x.x + dotnet-version: 8.0.100 # ------------------------------------------------------------------------------------------------------ # Install Nuget tool v1.0.5 @@ -83,12 +86,19 @@ jobs: # ------------------------------------------------------------------------------------------------------ - name: 'Publish GingerRuntime' run: dotnet publish ./Ginger/GingerRuntime/GingerRuntime.csproj --runtime linux-x64 --self-contained true -c Release - + # ------------------------------------------------------------------------------------------------------ # Upload Artifacts -# ------------------------------------------------------------------------------------------------------ - - name: 'Upload static site content' - uses: actions/upload-artifact@v3 +# ------------------------------------------------------------------------------------------------------ + - name: Cache static site content + id: cache + uses: actions/cache@v3.2.6 with: - name: ginger-artifact - path: ./ + path: + ./** + key: + cache-site-${{ github.run_number }} + enableCrossOsArchive: + true + + diff --git a/.github/workflows/GingerTests-2.yml b/.github/workflows/GingerTests-2.yml deleted file mode 100644 index 0f2cef45a2..0000000000 --- a/.github/workflows/GingerTests-2.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Ginger-Tests - -on: - workflow_call - -jobs: - windows: - uses: ./.github/workflows/WindowsTest-2.yml - secrets: inherit - Linux: - uses: ./.github/workflows/LinuxTest-2.yml -# MacOS: -# uses: ./.github/workflows/MacOSTest-2.yml diff --git a/.github/workflows/GingerTests.yml b/.github/workflows/GingerTests.yml index 1215874795..241a6ea9b2 100644 --- a/.github/workflows/GingerTests.yml +++ b/.github/workflows/GingerTests.yml @@ -1,15 +1,13 @@ name: Ginger-Tests - + on: workflow_call - + jobs: windows: uses: ./.github/workflows/WindowsTest.yml secrets: inherit - Linux: uses: ./.github/workflows/LinuxTest.yml - -# MacOS: -# uses: ./.github/workflows/MacOSTest.yml + MacOS: + uses: ./.github/workflows/MacOSTest.yml diff --git a/.github/workflows/LinuxBuild.yml b/.github/workflows/LinuxBuild.yml deleted file mode 100644 index 0f0e041162..0000000000 --- a/.github/workflows/LinuxBuild.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: Ginger Linux Build - -on: - # pull_request: - # branches: - # - master - # - Features/Linux-Migration - # - Releases/* - # - Releases/*/* - - workflow_dispatch: - - -jobs: - build: - - runs-on: ubuntu-latest - - env: - BUILD_CONFIGURATION: Release - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.100' - - - - - name: 'printing file - GingerConsole.dll' - if: success() || failure() # run this step even if previous step failed - run: | - ls -alt Ginger/GingerUtilsTest -# ------------------------------------------------------------------------------------------------------ -# start Testing -# ------------------------------------------------------------------------------------------------------ - - name: Testing GingerUtilsTest - run: dotnet test Ginger/GingerUtilsTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'printing file - GingerConsole.dll' - if: success() || failure() # run this step even if previous step failed - run: | - ls -alt Ginger/GingerUtilsTest - - - name: 'Testing GingerCoreCommonTest' - run: dotnet test Ginger/GingerCoreCommonTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - # for GingerCoreNET we use run setting to limit to have one worker thread due to workspace limitation - - name: 'Testing GingerCoreNETUnitTest' - run: dotnet test Ginger/GingerCoreNETUnitTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerPluginCoreTest' - run: dotnet test Ginger/GingerPluginCoreTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerConsoleTest' - run: dotnet test Ginger/GingerConsoleTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerAutoPilotTest' - run: dotnet test Ginger/GingerAutoPilotTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - -# ------------------------------------------------------------------------------------------------------ -# Publish GingerRuntime -# ------------------------------------------------------------------------------------------------------ - - name: 'Publish GingerRuntime' - run: dotnet publish Ginger/GingerRuntime -c Release - - - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Results -# ------------------------------------------------------------------------------------------------------ - - name: Test Report - uses: dorny/test-reporter@v1 - if: success() || failure() # run this step even if previous step failed - with: - name: Ginger Linux UnitTests # Name of the check run which will be created - path: "**/*.trx" # Path to test results - reporter: dotnet-trx # Format of test results - - - -# ------------------------------------------------------------------------------------------------------ -# Run Standalone CLI Test -# ------------------------------------------------------------------------------------------------------ - - name: Run Standalone CLI Test - if: success() || failure() # run this step even if previous step failed - run: | - chmod +x CLITestsGithub.ps1 - ./CLITestsGithub.ps1 diff --git a/.github/workflows/LinuxTest-2.yml b/.github/workflows/LinuxTest-2.yml deleted file mode 100644 index dd7baf1ac6..0000000000 --- a/.github/workflows/LinuxTest-2.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Ginger Linux Test - -on: - workflow_dispatch: - workflow_call: - -jobs: - build: - name: Linux Test - runs-on: ubuntu-latest - - env: - BUILD_CONFIGURATION: Release - - steps: - -# ------------------------------------------------------------------------------------------------------ -# Copy Ginger repo -# ------------------------------------------------------------------------------------------------------ - - name: Code Checkout - if: ${{github.workflow == 'Ginger Linux Test'}} - uses: actions/checkout@v3 - - - - name: Restore static site content - if: ${{github.workflow != 'Ginger Linux Test'}} - uses: actions/cache@v3.2.6 - with: - path: ./** - key: cache-site-${{ github.run_number }} - enableCrossOsArchive: - true - -# ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 8.0.100 -# ------------------------------------------------------------------------------------------------------ - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.100' - -# ------------------------------------------------------------------------------------------------------ -# start Testing -# ------------------------------------------------------------------------------------------------------ - - name: 'Testing GingerUtilsTest' - run: dotnet test Ginger/GingerUtilsTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerCoreCommonTest' - run: dotnet test Ginger/GingerCoreCommonTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - # for GingerCoreNET we use run setting to limit to have one worker thread due to workspace limitation - - name: 'Testing GingerCoreNETUnitTest' - run: dotnet test Ginger/GingerCoreNETUnitTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerPluginCoreTest' - run: dotnet test Ginger/GingerPluginCoreTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerConsoleTest' - run: dotnet test Ginger/GingerConsoleTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerAutoPilotTest' - run: dotnet test Ginger/GingerAutoPilotTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - -# ------------------------------------------------------------------------------------------------------ -# Publish GingerRuntime -# ------------------------------------------------------------------------------------------------------ - - name: 'Publish GingerRuntime' - if: ${{github.event_name == 'Ginger Linux Test' }} - run: dotnet publish Ginger/GingerRuntime -c Release - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Results -# ------------------------------------------------------------------------------------------------------ - - name: Test Report - uses: dorny/test-reporter@v1 - if: success() || failure() # run this step even if previous step failed - with: - name: Ginger Linux UnitTests # Name of the check run which will be created - path: "**/*.trx" # Path to test results - reporter: dotnet-trx # Format of test results - -# ------------------------------------------------------------------------------------------------------ -# Run Standalone CLI Test -# ------------------------------------------------------------------------------------------------------ - - name: Run Standalone CLI Test - if: success() || failure() # run this step even if previous step failed - shell: bash - run: | - pwd - ls -alt - chmod +x CLITestsGithub.sh - sudo apt install dos2unix - dos2unix -b CLITestsGithub.sh - ./CLITestsGithub.sh - - diff --git a/.github/workflows/LinuxTest.yml b/.github/workflows/LinuxTest.yml index 9e97912e11..dd7baf1ac6 100644 --- a/.github/workflows/LinuxTest.yml +++ b/.github/workflows/LinuxTest.yml @@ -22,18 +22,21 @@ jobs: uses: actions/checkout@v3 - - name: Download Airtifacts + - name: Restore static site content if: ${{github.workflow != 'Ginger Linux Test'}} - uses: actions/download-artifact@v3 + uses: actions/cache@v3.2.6 with: - name: ginger-artifact + path: ./** + key: cache-site-${{ github.run_number }} + enableCrossOsArchive: + true # ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 6.0.301 +# Install .Net core SDK 8.0.100 # ------------------------------------------------------------------------------------------------------ - uses: actions/setup-dotnet@v3 with: - dotnet-version: '7.x.x' + dotnet-version: '8.0.100' # ------------------------------------------------------------------------------------------------------ # start Testing diff --git a/.github/workflows/MacBuild.yml b/.github/workflows/MacBuild.yml deleted file mode 100644 index 2fd09e921e..0000000000 --- a/.github/workflows/MacBuild.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: Ginger Mac Build - -on: - # pull_request: - # branches: - # - master - # - Features/Linux-Migration - # - Releases/* - # - Releases/*/* - - workflow_dispatch: - - -jobs: - build: - - runs-on: macOS-latest - - env: - BUILD_CONFIGURATION: Release - - steps: - - uses: actions/checkout@v3 - - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.100' - - - -# ------------------------------------------------------------------------------------------------------ -# start Testing -# ------------------------------------------------------------------------------------------------------ - - name: Testing GingerUtilsTest - run: dotnet test Ginger/GingerUtilsTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerCoreCommonTest' - run: dotnet test Ginger/GingerCoreCommonTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerCoreNETUnitTest' - run: dotnet test Ginger/GingerCoreNETUnitTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerPluginCoreTest' - run: dotnet test Ginger/GingerPluginCoreTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerConsoleTest' - run: dotnet test Ginger/GingerConsoleTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerAutoPilotTest' - run: dotnet test Ginger/GingerAutoPilotTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Results -# ------------------------------------------------------------------------------------------------------ - - - - name: Test Report - uses: dorny/test-reporter@v1 - if: success() || failure() # run this step even if previous step failed - with: - name: Ginger MacOS UnitTests # Name of the check run which will be created - path: "**/*.trx" # Path to test results - reporter: dotnet-trx # Format of test results diff --git a/.github/workflows/MacOSTest-2.yml b/.github/workflows/MacOSTest-2.yml deleted file mode 100644 index 9cde25f597..0000000000 --- a/.github/workflows/MacOSTest-2.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Ginger MacOS Test - -on: - workflow_call: - workflow_dispatch: - - -jobs: - build: - name: MacOS Test - runs-on: macOS-latest - - env: - BUILD_CONFIGURATION: Release - - steps: - -# ------------------------------------------------------------------------------------------------------ -# Copy Ginger repo -# ------------------------------------------------------------------------------------------------------ - - name: Code Checkout - if: ${{github.workflow == 'Ginger MacOS Test'}} - uses: actions/checkout@v3 - - - name: Restore static site content - if: ${{github.workflow != 'Ginger MacOS Test'}} - uses: actions/cache@v3.2.6 - with: - path: ./** - key: cache-site-${{ github.run_number }} - enableCrossOsArchive: - truet - -# ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 8.0.100 -# ------------------------------------------------------------------------------------------------------ - - uses: actions/setup-dotnet@v3 - with: - dotnet-version: '8.0.100' - -# ------------------------------------------------------------------------------------------------------ -# start Testing -# ------------------------------------------------------------------------------------------------------ - - name: 'Testing GingerUtilsTest' - run: dotnet test Ginger/GingerUtilsTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerCoreCommonTest' - run: dotnet test Ginger/GingerCoreCommonTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerCoreNETUnitTest' - run: dotnet test Ginger/GingerCoreNETUnitTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerPluginCoreTest' - run: dotnet test Ginger/GingerPluginCoreTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerConsoleTest' - run: dotnet test Ginger/GingerConsoleTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - - - name: 'Testing GingerAutoPilotTest' - run: dotnet test Ginger/GingerAutoPilotTest --configuration ${BUILD_CONFIGURATION} --logger trx --verbosity=normal - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Results -# ------------------------------------------------------------------------------------------------------ - - name: Test Report - uses: dorny/test-reporter@v1 - if: success() || failure() # run this step even if previous step failed - with: - name: Ginger MacOS UnitTests # Name of the check run which will be created - path: "**/*.trx" # Path to test results - reporter: dotnet-trx # Format of test results diff --git a/.github/workflows/MacOSTest.yml b/.github/workflows/MacOSTest.yml index 152e051df9..9cde25f597 100644 --- a/.github/workflows/MacOSTest.yml +++ b/.github/workflows/MacOSTest.yml @@ -22,18 +22,21 @@ jobs: if: ${{github.workflow == 'Ginger MacOS Test'}} uses: actions/checkout@v3 - - name: Download Airtifacts + - name: Restore static site content if: ${{github.workflow != 'Ginger MacOS Test'}} - uses: actions/download-artifact@v3 + uses: actions/cache@v3.2.6 with: - name: ginger-artifact + path: ./** + key: cache-site-${{ github.run_number }} + enableCrossOsArchive: + truet # ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 6.0.301 +# Install .Net core SDK 8.0.100 # ------------------------------------------------------------------------------------------------------ - uses: actions/setup-dotnet@v3 with: - dotnet-version: '7.x.x' + dotnet-version: '8.0.100' # ------------------------------------------------------------------------------------------------------ # start Testing diff --git a/.github/workflows/WindowsBuild.yml b/.github/workflows/WindowsBuild.yml deleted file mode 100644 index db3eec294c..0000000000 --- a/.github/workflows/WindowsBuild.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: Ginger Windows Build - -on: - # pull_request: - # branches: - # - master - # - Features/Linux-Migration - # - Releases/* - # - Releases/*/* - - workflow_dispatch: - -jobs: - build: - - runs-on: windows-latest - - env: - BUILD_CONFIGURATION: Release - - steps: - - uses: actions/checkout@v3 - -# ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 8.0.100 -# ------------------------------------------------------------------------------------------------------ - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.100 - -# ------------------------------------------------------------------------------------------------------ -# Install Nuget tool v1.0.5 -# ------------------------------------------------------------------------------------------------------ - - name: Setup Nuget - uses: Nuget/setup-nuget@v1.0.5 - -# ------------------------------------------------------------------------------------------------------ -# Restore Ginger solution NuGet packages -# ------------------------------------------------------------------------------------------------------ - - name: Restore nuget packages - run: nuget restore ./Ginger/Ginger.sln - - - -# ------------------------------------------------------------------------------------------------------ -# SeaLight -# --------------------------------------------------------------------------------------------------- - - - - -# ------------------------------------------------------------------------------------------------------ -# Install msbuild && Build Ginger Solution -# ------------------------------------------------------------------------------------------------------ - - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1.0.2 - - - - name: Build - run: msbuild ./Ginger/Ginger.sln /p:DebugSymbols=true /p:DebugType=full /p:Configuration=Release - -# ------------------------------------------------------------------------------------------------------ -# Start Testing -# ------------------------------------------------------------------------------------------------------ - - name: Testing GingerUtilsTest - run: dotnet test Ginger/GingerUtilsTest --configuration Release --logger trx --verbosity=normal - - - name: 'Testing GingerCoreCommonTest' - if: success() || failure() - run: dotnet test Ginger/GingerCoreCommonTest --configuration Release --logger trx --verbosity=normal - - - name: 'Testing GingerCoreNETUnitTest' - if: success() || failure() - run: dotnet test Ginger/GingerCoreNETUnitTest --configuration Release --logger trx --verbosity=normal - - - name: 'Testing GingerPluginCoreTest' - if: success() || failure() - run: dotnet test Ginger/GingerPluginCoreTest --configuration Release --logger trx --verbosity=normal - - - name: 'Testing GingerConsoleTest' - if: success() || failure() - run: dotnet test Ginger/GingerConsoleTest --configuration Release --logger trx --verbosity=normal - - - name: 'Testing GingerAutoPilotTest' - if: success() || failure() - run: dotnet test Ginger/GingerAutoPilotTest --configuration Release --logger trx --verbosity=normal - -# ------------------------------------------------------------------------------------------------------ -# Run .Net Framework tests using powershell and publish the results -# ------------------------------------------------------------------------------------------------------ - - - name: Run tests for Ginger .NetFramework *Test Dlls - if: success() || failure() # run this step even if previous step failed - run: powershell -file "TestDotNetFrameworkGithub.ps1" - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Results -# ------------------------------------------------------------------------------------------------------ - - name: Test Report - uses: dorny/test-reporter@v1 - if: success() || failure() # run this step even if previous step failed - with: - name: Ginger Windows UnitTests # Name of the check run which will be created - path: "**/*.trx" # Path to test results - reporter: dotnet-trx # Format of test results - - -# ------------------------------------------------------------------------------------------------------ -# Stop Sealight -# ------------------------------------------------------------------------------------------------------ -# - task: EndTestExecution@2 -# inputs: -# sealightsToken: "$(SLAGENTTOKEN)" -# SealightsBuildSessionId : $(Build.ArtifactStagingDirectory)\SealightsBuildSessionId.txt - - diff --git a/.github/workflows/WindowsTest-2.yml b/.github/workflows/WindowsTest-2.yml deleted file mode 100644 index eb4be322c1..0000000000 --- a/.github/workflows/WindowsTest-2.yml +++ /dev/null @@ -1,185 +0,0 @@ -name: Ginger Windows Test - -on: - workflow_dispatch: - workflow_call: - -jobs: - build: - name: Windows Test - runs-on: windows-latest - - env: - BUILD_CONFIGURATION: "Release" - SLDOMAIN: "amdocs.sealights.co" - APP_NAME: "Ginger" - APP_NAMESPACE: "Amdocs.*,ginger.*" - PR_NUMBER: ${{github.event.pull_request.number}} - PR_TARGET_BRANCH: "Releases/${{github.base_ref}}" - PR_LAST_COMMIT: ${{ github.event.pull_request.head.sha }} - REPO_URL: ${{github.repositoryUrl }} - - steps: -# ------------------------------------------------------------------------------------------------------ -# Copy Ginger repo -# ------------------------------------------------------------------------------------------------------ - - name: Code Checkout - if: ${{github.workflow == 'Ginger Windows Test'}} - uses: actions/checkout@v3 - - - - name: Restore static site content - if: ${{github.workflow != 'Ginger Windows Test'}} - uses: actions/cache@v3.2.6 - with: - path: ./** - key: cache-site-${{ github.run_number }} - enableCrossOsArchive: - true - - -# ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 8.0.100 -# ------------------------------------------------------------------------------------------------------ - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.100 - -# ------------------------------------------------------------------------------------------------------ -# Install Nuget tool v1.0.5 -# ------------------------------------------------------------------------------------------------------ - - name: Setup Nuget - uses: Nuget/setup-nuget@v1.0.5 - -# ------------------------------------------------------------------------------------------------------ -# Restore Ginger solution NuGet packages -# ------------------------------------------------------------------------------------------------------ - - name: Restore nuget packages - run: nuget restore ./Ginger/Ginger.sln - -# ------------------------------------------------------------------------------------------------------ -# SeaLight - Downloading the .NET agent files && Scanning a build using MSBuild -# --------------------------------------------------------------------------------------------------- - -# - name: Download Sealights .Net agent -# run: | -# Write-Output "Build Reason = ${{github.event_name}}" -# echo $env:SLDOMAIN -# echo $env:BUILD_CONFIGURATION -# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -# Write-Output "Download the Sealights DotNet agent version set in settings..." -# $agentversion = ((iwr -Uri https://amdocs.sealights.co/api/v2/agents/dotnet/recommended -Headers @{'Accept' = 'application/json'; 'Authorization' = "Bearer ${{ secrets.SLT }}"}).Content | ConvertFrom-Json | Select-Object agent).agent.version -# Write-Output "*** start download ***" -# iwr -OutFile sealights-dotnet-agent.zip -Uri http://agents.sealights.co/SL.DotNet/SL.DotNet-$($agentversion).zip -# Expand-Archive .\sealights-dotnet-agent.zip -DestinationPath SL.DotNet -Force -# Write-Output "Sealights agent version used is:$(Get-Content .\SL.DotNet\version.txt)" - -# - name: Sealights - Generating a Pull Request Session ID -# id: SealightsPR -# if: ${{github.event_name == 'pull_request'}} -# run: | -# Write-Output "*** Create PR BSID ***" -# .\SL.DotNet\x64\SL.DotNet prConfig --token ${{ secrets.SLT }} --appName ${{ env.APP_NAME }} --includeNamespace ${{ env.APP_NAMESPACE }} --pullRequestNumber 25 --latestCommit a51d0f337dc7547d20dbf5fbfea1c45831249325 --targetBranch Release/master --repositoryUrl ${{ env.REPO_URL }} - -# - name: Sealights - Generating a Standard Session ID -# id: SealightsStandard -# if: ${{github.event_name != 'pull_request'}} -# run: | -# Write-Output "*** Create Standard SID ***" -# .\SL.DotNet\x64\SL.DotNet config --token ${{ secrets.SLT }} --includeNamespace ${{ env.APP_NAMESPACE }} --appName ${{ env.APP_NAME }} --branchName Release/master --buildName "Github.Nadeem.${{ github.run_number }}" - -# - name: Sealights - Prepare for MSBuild -# id: SealightsMSBuild -# if: steps.SealightsStandard.outcome == 'success' || steps.SealightsPR.outcome == 'success' -# run: | -# Write-Output "*** Prepare for MSBuild ***" -# .\SL.DotNet\x64\SL.DotNet.exe prepareForMsBuild --buildSessionIdFile buildSessionId --workspacePath .\Ginger --baseDir . --ignoreGeneratedCode true --debugMode true --logEnabled true --logAppendConsole true --ignoreCertificateErrors true --token ${{ secrets.SLT }} --scm git --scmProvider vsts - -# # ------------------------------------------------------------------------------------------------------ -# # SeaLights- Starting test stage && Starting Background test listener -# # ------------------------------------------------------------------------------------------------------ -# - name: Sealights - Starting test stage -# if: steps.SealightsMSBuild.outcome == 'success' -# run: | -# .\SL.DotNet\x64\SL.DotNet.exe startExecution --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" - -# - name: Sealights - Starting Background test listener -# if: steps.SealightsMSBuild.outcome == 'success' -# run: | -# .\SL.DotNet\x64\SL.DotNet.exe startBackgroundTestListener --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testListenerSessionKey ${{ github.run_number }} --testStage "Unit Tests" - -# ------------------------------------------------------------------------------------------------------ -# Install msbild && Build Ginger Solution -# ------------------------------------------------------------------------------------------------------ - - name: Add msbuild to PATH - if: ${{github.workflow == 'Ginger Windows Test'}} - uses: microsoft/setup-msbuild@v1.0.2 - - - name: Build Ginger Solution - if: ${{github.workflow == 'Ginger Windows Test'}} - run: msbuild ./Ginger/Ginger.sln /p:DebugSymbols=true /p:DebugType=full /p:Configuration=$env:BUILD_CONFIGURATION - -# ------------------------------------------------------------------------------------------------------ -# Start Testing -# ------------------------------------------------------------------------------------------------------ - - name: 'Testing GingerUtilsTest' - if: success() || failure() - run: dotnet test Ginger/GingerUtilsTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal - - - name: 'Testing GingerCoreCommonTest' - if: success() || failure() - run: dotnet test Ginger/GingerCoreCommonTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal - - - name: 'Testing GingerCoreNETUnitTest' - if: success() || failure() - run: dotnet test Ginger/GingerCoreNETUnitTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal - - - name: 'Testing GingerPluginCoreTest' - if: success() || failure() - run: dotnet test Ginger/GingerPluginCoreTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal - - - name: 'Testing GingerConsoleTest' - if: success() || failure() - run: dotnet test Ginger/GingerConsoleTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal - - - name: 'Testing GingerAutoPilotTest' - if: success() || failure() - run: dotnet test Ginger/GingerAutoPilotTest --configuration ${{ env.BUILD_CONFIGURATION }} --logger trx --results-directory D:\a\TestResults --verbosity=normal - -# ------------------------------------------------------------------------------------------------------ -# Run .Net Framework tests using powershell and publish the results -# ------------------------------------------------------------------------------------------------------ - - name: Run tests for Ginger .NetFramework *Test Dlls - if: success() || failure() # run this step even if previous step failed - run: powershell -file "TestDotNetFrameworkGithub.ps1" - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Results -# ------------------------------------------------------------------------------------------------------ - - name: Test Report - uses: dorny/test-reporter@v1 - if: success() || failure() # run this step even if previous step failed - with: - name: Ginger Windows UnitTests # Name of the check run which will be created - path: "D:/a/TestResults/*.trx" # Path to test results - reporter: dotnet-trx # Format of test results - - -# ------------------------------------------------------------------------------------------------------ -# Sealight - Stop Background test listener && Ending a test stage && Upload report files -# ------------------------------------------------------------------------------------------------------ - # - name: Sealights - Stop Background test listener - # if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed - # run: | - # .\SL.DotNet\x64\SL.DotNet.exe stopBackgroundTestListener --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testListenerSessionKey ${{ github.run_number }} - # - name: Sealights - Ending test stage - # if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed - # run: | - # .\SL.DotNet\x64\SL.DotNet.exe endExecution --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" - - # - name: Sealights - Upload test report - # if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed - # run: | - # .\SL.DotNet\x64\SL.DotNet.exe uploadTestReport --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" --report "D:\\a\\TestResults" - diff --git a/.github/workflows/WindowsTest.yml b/.github/workflows/WindowsTest.yml index 8f61173c17..eb4be322c1 100644 --- a/.github/workflows/WindowsTest.yml +++ b/.github/workflows/WindowsTest.yml @@ -28,11 +28,15 @@ jobs: uses: actions/checkout@v3 - - name: Download Artifacts + - name: Restore static site content if: ${{github.workflow != 'Ginger Windows Test'}} - uses: actions/download-artifact@v3 + uses: actions/cache@v3.2.6 with: - name: ginger-artifact + path: ./** + key: cache-site-${{ github.run_number }} + enableCrossOsArchive: + true + # ------------------------------------------------------------------------------------------------------ # Install .Net core SDK 8.0.100 @@ -58,52 +62,52 @@ jobs: # SeaLight - Downloading the .NET agent files && Scanning a build using MSBuild # --------------------------------------------------------------------------------------------------- - - name: Download Sealights .Net agent - run: | - Write-Output "Build Reason = ${{github.event_name}}" - echo $env:SLDOMAIN - echo $env:BUILD_CONFIGURATION - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - Write-Output "Download the Sealights DotNet agent version set in settings..." - $agentversion = ((iwr -Uri https://amdocs.sealights.co/api/v2/agents/dotnet/recommended -Headers @{'Accept' = 'application/json'; 'Authorization' = "Bearer ${{ secrets.SLT }}"}).Content | ConvertFrom-Json | Select-Object agent).agent.version - Write-Output "*** start download ***" - iwr -OutFile sealights-dotnet-agent.zip -Uri http://agents.sealights.co/SL.DotNet/SL.DotNet-$($agentversion).zip - Expand-Archive .\sealights-dotnet-agent.zip -DestinationPath SL.DotNet -Force - Write-Output "Sealights agent version used is:$(Get-Content .\SL.DotNet\version.txt)" +# - name: Download Sealights .Net agent +# run: | +# Write-Output "Build Reason = ${{github.event_name}}" +# echo $env:SLDOMAIN +# echo $env:BUILD_CONFIGURATION +# [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +# Write-Output "Download the Sealights DotNet agent version set in settings..." +# $agentversion = ((iwr -Uri https://amdocs.sealights.co/api/v2/agents/dotnet/recommended -Headers @{'Accept' = 'application/json'; 'Authorization' = "Bearer ${{ secrets.SLT }}"}).Content | ConvertFrom-Json | Select-Object agent).agent.version +# Write-Output "*** start download ***" +# iwr -OutFile sealights-dotnet-agent.zip -Uri http://agents.sealights.co/SL.DotNet/SL.DotNet-$($agentversion).zip +# Expand-Archive .\sealights-dotnet-agent.zip -DestinationPath SL.DotNet -Force +# Write-Output "Sealights agent version used is:$(Get-Content .\SL.DotNet\version.txt)" - - name: Sealights - Generating a Pull Request Session ID - id: SealightsPR - if: ${{github.event_name == 'pull_request'}} - run: | - Write-Output "*** Create PR BSID ***" - .\SL.DotNet\x64\SL.DotNet prConfig --token ${{ secrets.SLT }} --appName ${{ env.APP_NAME }} --includeNamespace ${{ env.APP_NAMESPACE }} --pullRequestNumber 25 --latestCommit a51d0f337dc7547d20dbf5fbfea1c45831249325 --targetBranch Release/master --repositoryUrl ${{ env.REPO_URL }} +# - name: Sealights - Generating a Pull Request Session ID +# id: SealightsPR +# if: ${{github.event_name == 'pull_request'}} +# run: | +# Write-Output "*** Create PR BSID ***" +# .\SL.DotNet\x64\SL.DotNet prConfig --token ${{ secrets.SLT }} --appName ${{ env.APP_NAME }} --includeNamespace ${{ env.APP_NAMESPACE }} --pullRequestNumber 25 --latestCommit a51d0f337dc7547d20dbf5fbfea1c45831249325 --targetBranch Release/master --repositoryUrl ${{ env.REPO_URL }} - - name: Sealights - Generating a Standard Session ID - id: SealightsStandard - if: ${{github.event_name != 'pull_request'}} - run: | - Write-Output "*** Create Standard SID ***" - .\SL.DotNet\x64\SL.DotNet config --token ${{ secrets.SLT }} --includeNamespace ${{ env.APP_NAMESPACE }} --appName ${{ env.APP_NAME }} --branchName Release/master --buildName "Github.Nadeem.${{ github.run_number }}" +# - name: Sealights - Generating a Standard Session ID +# id: SealightsStandard +# if: ${{github.event_name != 'pull_request'}} +# run: | +# Write-Output "*** Create Standard SID ***" +# .\SL.DotNet\x64\SL.DotNet config --token ${{ secrets.SLT }} --includeNamespace ${{ env.APP_NAMESPACE }} --appName ${{ env.APP_NAME }} --branchName Release/master --buildName "Github.Nadeem.${{ github.run_number }}" - - name: Sealights - Prepare for MSBuild - id: SealightsMSBuild - if: steps.SealightsStandard.outcome == 'success' || steps.SealightsPR.outcome == 'success' - run: | - Write-Output "*** Prepare for MSBuild ***" - .\SL.DotNet\x64\SL.DotNet.exe prepareForMsBuild --buildSessionIdFile buildSessionId --workspacePath .\Ginger --baseDir . --ignoreGeneratedCode true --debugMode true --logEnabled true --logAppendConsole true --ignoreCertificateErrors true --token ${{ secrets.SLT }} --scm git --scmProvider vsts +# - name: Sealights - Prepare for MSBuild +# id: SealightsMSBuild +# if: steps.SealightsStandard.outcome == 'success' || steps.SealightsPR.outcome == 'success' +# run: | +# Write-Output "*** Prepare for MSBuild ***" +# .\SL.DotNet\x64\SL.DotNet.exe prepareForMsBuild --buildSessionIdFile buildSessionId --workspacePath .\Ginger --baseDir . --ignoreGeneratedCode true --debugMode true --logEnabled true --logAppendConsole true --ignoreCertificateErrors true --token ${{ secrets.SLT }} --scm git --scmProvider vsts -# ------------------------------------------------------------------------------------------------------ -# SeaLights- Starting test stage && Starting Background test listener -# ------------------------------------------------------------------------------------------------------ - - name: Sealights - Starting test stage - if: steps.SealightsMSBuild.outcome == 'success' - run: | - .\SL.DotNet\x64\SL.DotNet.exe startExecution --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" +# # ------------------------------------------------------------------------------------------------------ +# # SeaLights- Starting test stage && Starting Background test listener +# # ------------------------------------------------------------------------------------------------------ +# - name: Sealights - Starting test stage +# if: steps.SealightsMSBuild.outcome == 'success' +# run: | +# .\SL.DotNet\x64\SL.DotNet.exe startExecution --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" - - name: Sealights - Starting Background test listener - if: steps.SealightsMSBuild.outcome == 'success' - run: | - .\SL.DotNet\x64\SL.DotNet.exe startBackgroundTestListener --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testListenerSessionKey ${{ github.run_number }} --testStage "Unit Tests" +# - name: Sealights - Starting Background test listener +# if: steps.SealightsMSBuild.outcome == 'success' +# run: | +# .\SL.DotNet\x64\SL.DotNet.exe startBackgroundTestListener --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testListenerSessionKey ${{ github.run_number }} --testStage "Unit Tests" # ------------------------------------------------------------------------------------------------------ # Install msbild && Build Ginger Solution @@ -165,17 +169,17 @@ jobs: # ------------------------------------------------------------------------------------------------------ # Sealight - Stop Background test listener && Ending a test stage && Upload report files # ------------------------------------------------------------------------------------------------------ - - name: Sealights - Stop Background test listener - if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed - run: | - .\SL.DotNet\x64\SL.DotNet.exe stopBackgroundTestListener --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testListenerSessionKey ${{ github.run_number }} - - name: Sealights - Ending test stage - if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed - run: | - .\SL.DotNet\x64\SL.DotNet.exe endExecution --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" + # - name: Sealights - Stop Background test listener + # if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed + # run: | + # .\SL.DotNet\x64\SL.DotNet.exe stopBackgroundTestListener --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testListenerSessionKey ${{ github.run_number }} + # - name: Sealights - Ending test stage + # if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed + # run: | + # .\SL.DotNet\x64\SL.DotNet.exe endExecution --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" - - name: Sealights - Upload test report - if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed - run: | - .\SL.DotNet\x64\SL.DotNet.exe uploadTestReport --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" --report "D:\\a\\TestResults" - \ No newline at end of file + # - name: Sealights - Upload test report + # if: (success() || failure()) && steps.SealightsMSBuild.outcome == 'success' # run this step even if previous step failed + # run: | + # .\SL.DotNet\x64\SL.DotNet.exe uploadTestReport --token ${{ secrets.SLT }} --buildSessionIdFile buildSessionId --logEnabled true --logAppendConsole true --testStage "Unit Tests" --report "D:\\a\\TestResults" + diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/ActUIElementEditPage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/ActUIElementEditPage.xaml.cs index b790f94208..775d3944de 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/ActUIElementEditPage.xaml.cs +++ b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/ActUIElementEditPage.xaml.cs @@ -276,6 +276,9 @@ private Page GetControlSpecificPageContent() pageContent = new UIElementXYCoordinatePage(mAction); break; + case eElementAction.ScrollToElement: + pageContent = new UIElementScrollToElementOptionsPage(mAction); + break; case eElementAction.DoubleClick: case eElementAction.WinClick: diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementScrollToOptionsPage.xaml b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementScrollToOptionsPage.xaml new file mode 100644 index 0000000000..269b7d6b44 --- /dev/null +++ b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementScrollToOptionsPage.xaml @@ -0,0 +1,23 @@ + + + + + + + + + + + diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementScrollToOptionsPage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementScrollToOptionsPage.xaml.cs new file mode 100644 index 0000000000..4503166e38 --- /dev/null +++ b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementScrollToOptionsPage.xaml.cs @@ -0,0 +1,27 @@ +using GingerCore.Actions.Common; +using System.Collections.Generic; +using System.Windows.Controls; +using static GingerCoreNET.GeneralLib.General; + +namespace Ginger.Actions._Common.ActUIElementLib +{ + /// + /// Interaction logic for UIElementScrollToOptionsPage.xaml + /// + public partial class UIElementScrollToElementOptionsPage : Page + { + public UIElementScrollToElementOptionsPage(ActUIElement action) + { + InitializeComponent(); + + List verticalAlignments = [ + eScrollAlignment.Start, + eScrollAlignment.Center, + eScrollAlignment.End, + eScrollAlignment.Nearest, + ]; + + verticalScrollAlignmentComboBox.Init(action.GetOrCreateInputParam(ActUIElement.Fields.VerticalScrollAlignment, nameof(eScrollAlignment.Start)), verticalAlignments, false); + } + } +} diff --git a/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementXYCoordinatePage.xaml.cs b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementXYCoordinatePage.xaml.cs index e1c5914702..807c63b418 100644 --- a/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementXYCoordinatePage.xaml.cs +++ b/Ginger/Ginger/Actions/ActionEditPages/ActUIElementLib/UIElementXYCoordinatePage.xaml.cs @@ -41,9 +41,9 @@ public UIElementXYCoordinatePage(ActUIElement Act) if (mAct.ElementData != null) { string[] spliter = new string[] { "," }; - string[] cordinations = Convert.ToString(mAct.ElementData).Split(spliter, StringSplitOptions.RemoveEmptyEntries); - mAct.AddOrUpdateInputParamValue("XCoordinate", cordinations[0]); - mAct.AddOrUpdateInputParamValue("YCoordinate", cordinations[1]); + string[] coordinates = Convert.ToString(mAct.ElementData).Split(spliter, StringSplitOptions.RemoveEmptyEntries); + mAct.AddOrUpdateInputParamValue("XCoordinate", coordinates[0]); + mAct.AddOrUpdateInputParamValue("YCoordinate", coordinates[1]); } if (mAct.ElementAction == ActUIElement.eElementAction.SendKeysXY) diff --git a/Ginger/Ginger/App.xaml.cs b/Ginger/Ginger/App.xaml.cs index 3a6bb77fe2..9fbc2513f7 100644 --- a/Ginger/Ginger/App.xaml.cs +++ b/Ginger/Ginger/App.xaml.cs @@ -33,7 +33,10 @@ limitations under the License. using GingerWPF.WorkSpaceLib; using System; using System.Collections.Generic; +using System.IO; +using System.Linq; using System.Runtime.InteropServices; +using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; @@ -280,11 +283,12 @@ private async void Application_Startup(object sender, StartupEventArgs e) await RunNewCLI(parserResult); } } - catch (Exception ex) { + catch (Exception ex) + { Reporter.ToLog(eLogLevel.ERROR, "Unhandled exception in Application_Startup", ex); } - } + /// /// Initializes the logging mechanism for the application using log4net. @@ -306,15 +310,37 @@ private bool ShouldStartGrid(string[] args) } /// - /// Parses command-line arguments and returns the result. - /// If no arguments are provided, returns null. + /// Parses the command line arguments and returns the parsed result. /// - /// Command-line arguments. - /// ParserResult containing parsed arguments or null. + /// The command line arguments. + /// The parsed result of the command line arguments. private ParserResult ParseCommandLineArguments(string[] args) { + string[] arguments; + //Added this codition if only user want to launch Ginger without any solution from browser. + if (args.Length == 1 && System.Web.HttpUtility.UrlDecode(args[0]).Equals("ginger:///", StringComparison.OrdinalIgnoreCase)) + { + return null; + } + if (args.Length == 1) + { + string input = args[0]; + input = System.Web.HttpUtility.UrlDecode(input); + if (input.StartsWith("ginger://")) + { + input = input.Substring("ginger://".Length); + } + List resultList = General.SplitWithPaths(input).Select(s => s.Trim('\"', '\'')).ToList(); + arguments = resultList.ToArray(); + } + else + { + arguments = args; + } + + cliProcessor = new CLIProcessor(); - return args.Length != 0 ? cliProcessor.ParseArguments(args) : null; + return arguments.Length != 0 ? cliProcessor.ParseArguments(arguments) : null; } /// @@ -341,6 +367,10 @@ private DoOptions ExtractDoOptions(ParserResult parserResult) /// True if the application is in execution mode, otherwise false. private bool IsExecutionMode(string[] args, DoOptions doOptions) { + if (args.Length == 1 && System.Web.HttpUtility.UrlDecode(args[0]).Equals("ginger:///", StringComparison.OrdinalIgnoreCase)) + { + return false; + } return args.Length != 0 && doOptions == null; } @@ -387,7 +417,15 @@ private void ProcessGingerUIStartup(DoOptions doOptions) if (doOptions != null && !string.IsNullOrWhiteSpace(doOptions.Solution)) { - DoOptionsHandler.Run(doOptions); + if(Directory.Exists(doOptions.Solution)) + { + DoOptionsHandler.Run(doOptions); + } + else + { + Reporter.ToLog(eLogLevel.ERROR, "The specified solution folder path does not exist. Please check the path and try again."); + } + } } finally @@ -423,6 +461,11 @@ public static void ShowConsoleWindow() ShowWindow(handle, SW_SHOW); } + /// + /// Runs the new CLI process with the provided parsed arguments. + /// + /// The parsed result of the command line arguments. + /// A task representing the asynchronous operation. private async Task RunNewCLI(ParserResult parserResult) { try @@ -440,9 +483,11 @@ private async Task RunNewCLI(ParserResult parserResult) { System.Windows.Application.Current.Shutdown(Environment.ExitCode); } - } + /// + /// Starts the Ginger UI. Initializes dictionaries and the main window. + /// public void StartGingerUI() { if (WorkSpace.Instance.RunningFromUnitTest) diff --git a/Ginger/Ginger/GeneralLib/General.cs b/Ginger/Ginger/GeneralLib/General.cs index 2f178a57db..e9ef940c3a 100644 --- a/Ginger/Ginger/GeneralLib/General.cs +++ b/Ginger/Ginger/GeneralLib/General.cs @@ -21,12 +21,14 @@ limitations under the License. using Amdocs.Ginger.Repository; using Ginger.Help; using System; +using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Security.Principal; +using System.Text.RegularExpressions; using System.Windows; using System.Windows.Controls; using System.Windows.Forms; @@ -663,5 +665,28 @@ public static string EscapeAccessKey(string s) return s.Replace("_", "__"); } + + /// + /// Splits the input string into a list of strings, preserving paths enclosed in quotes. + /// + /// The input string to split. + /// A list of strings split from the input. + public static List SplitWithPaths(string input) + { + if (string.IsNullOrWhiteSpace(input)) + { + return []; + } + var pattern = @"[^\s""']+|""([^""]*)""|'([^']*)'"; + var matches = Regex.Matches(input, pattern); + List results = []; + + foreach (Match match in matches) + { + results.Add(match.Value.Trim()); + } + + return results; + } } } diff --git a/Ginger/Ginger/RunSetPageLib/RunnerItemPage.xaml.cs b/Ginger/Ginger/RunSetPageLib/RunnerItemPage.xaml.cs index 3688d9ae0c..fa747495ad 100644 --- a/Ginger/Ginger/RunSetPageLib/RunnerItemPage.xaml.cs +++ b/Ginger/Ginger/RunSetPageLib/RunnerItemPage.xaml.cs @@ -21,13 +21,16 @@ limitations under the License. using Amdocs.Ginger.Common.Enums; using Amdocs.Ginger.Common.Repository.BusinessFlowLib; using Amdocs.Ginger.CoreNET.Execution; +using Amdocs.Ginger.Repository; using Amdocs.Ginger.UserControls; using Ginger.MoveToGingerWPF.Run_Set_Pages; using GingerCore; using GingerCore.Actions; using GingerCore.DataSource; using System; +using System.Collections.Generic; using System.ComponentModel; +using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Data; @@ -161,15 +164,6 @@ public void LoadChildRunnerItems() { foreach (Activity ac in ((BusinessFlow)ItemObject).Activities) { - if (ac.GetType() == typeof(ErrorHandler)) - { - continue;//do not show Error Handler for now - } - - if (ac.GetType() == typeof(CleanUpActivity)) - { - continue;//do not show Clean Up Activity for now - } RunnerItemPage ri = new RunnerItemPage(Runnerobj: ac, runnerItemEventHandler: _runnerItemEventHandler); this.Context.BusinessFlow = (BusinessFlow)ItemObject; @@ -190,20 +184,25 @@ public void LoadChildRunnerItems() mItemChilds.Add(ri); } } - else if (ItemObject.GetType() == typeof(Activity)) + else if (ItemObject is Activity activity) { - foreach (GingerCore.Actions.Act act in ((Activity)ItemObject).Acts) + IEnumerable acts = null; + if (acts != null) { - RunnerItemPage ri = new RunnerItemPage(Runnerobj: act, runnerItemEventHandler: _runnerItemEventHandler); - this.Context.Activity = (Activity)ItemObject; - ri.Context = this.Context; - act.Context = this.Context; - ri.xItemSeparator.Visibility = Visibility.Collapsed; - ri.ItemName = act.Description; - ri.ItemGuid = act.Guid; - ri.xViewRunnerItem.Visibility = Visibility.Visible; - ri.xDetailView.ToolTip = "Expand / Collapse Action"; - mItemChilds.Add(ri); + + foreach (GingerCore.Actions.Act act in acts) + { + RunnerItemPage ri = new RunnerItemPage(Runnerobj: act, runnerItemEventHandler: _runnerItemEventHandler); + this.Context.Activity = activity; + ri.Context = this.Context; + act.Context = this.Context; + ri.xItemSeparator.Visibility = Visibility.Collapsed; + ri.ItemName = act.Description; + ri.ItemGuid = act.Guid; + ri.xViewRunnerItem.Visibility = Visibility.Visible; + ri.xDetailView.ToolTip = "Expand / Collapse Action"; + mItemChilds.Add(ri); + } } } } @@ -224,10 +223,10 @@ public RunnerItemPage(object Runnerobj = null, bool ViewMode = false, EventHandl xRunnerItemContinue.ToolTip = "Resume Run from this " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); xViewRunnerItem.ToolTip = "View " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow); } - else if (ItemObject.GetType() == typeof(GingerCore.Activity)) + else if (ItemObject is Activity activity) { GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xStatus, StatusItem.StatusProperty, ItemObject, nameof(Activity.Status), BindingMode.OneWay); - PropertyChangedEventManager.AddHandler(source: ((Activity)ItemObject), handler: RunnerItem_ActivityPropertyChanged, propertyName: allProperties); + PropertyChangedEventManager.AddHandler(source: activity, handler: RunnerItem_ActivityPropertyChanged, propertyName: allProperties); xRunnerItemContinue.ToolTip = "Resume Run from this " + GingerDicser.GetTermResValue(eTermResKey.Activity); xViewRunnerItem.ToolTip = "View " + GingerDicser.GetTermResValue(eTermResKey.Activity); xRunnerItemMenu.Visibility = Visibility.Collapsed; @@ -531,4 +530,4 @@ public RunnerItemEventArgs(eEventType EventType, RunnerItemPage runnerItemPage, this.RunnerItemObject = runnerItemObject; } } -} \ No newline at end of file +} diff --git a/Ginger/GingerCoreCommon/Actions/UI Element/ActUIElement.cs b/Ginger/GingerCoreCommon/Actions/UI Element/ActUIElement.cs index 395a81a4ab..4fe27fdc04 100644 --- a/Ginger/GingerCoreCommon/Actions/UI Element/ActUIElement.cs +++ b/Ginger/GingerCoreCommon/Actions/UI Element/ActUIElement.cs @@ -141,6 +141,9 @@ public override List Platforms //used for SelectandValidate public static string SubElementLocateBy = "SubElementLocateBy"; public static string SubElementLocatorValue = "SubElementLocatorValue"; + + //used for ScrollToElement + public static string VerticalScrollAlignment = "VerticalScrollAlignment"; } // Fields Helper for specific action, will create AIV with param name based on enum diff --git a/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs b/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs index c729b0a013..61274b7108 100644 --- a/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs +++ b/Ginger/GingerCoreCommon/Repository/BusinessFlowLib/Activity.cs @@ -929,10 +929,7 @@ public static Activity CopySharedRepositoryActivity(Activity srActivity, bool or action.ParentGuid = action.Guid; oldNewActionGuidList.Add(new(action.ParentGuid, action.Guid)); } - foreach (VariableBase variable in copy.Variables) - { - variable.ParentGuid = variable.Guid; - } + foreach (FlowControl fc in copy.Acts.SelectMany(a => a.FlowControls)) { Guid targetGuid = fc.GetGuidFromValue(); diff --git a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/ChromeDriverEx.cs b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/ChromeDriverEx.cs index a23c0827f6..b9ed1582eb 100644 --- a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/ChromeDriverEx.cs +++ b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/ChromeDriverEx.cs @@ -26,36 +26,63 @@ public static class ChromeDriverEx { public static Screenshot GetFullPageScreenshot(this ChromiumDriver driver) { - //Dictionary will contain the parameters needed to get the full page screen shot + // Capture the original scroll position + Dictionary originalScrollPosition; + try + { + originalScrollPosition = (Dictionary)driver.ExecuteScript("return { x: window.pageXOffset, y: window.pageYOffset };") + ?? new Dictionary { ["x"] = 0, ["y"] = 0 }; + } + catch + { + // Fallback to default values if script execution fails + originalScrollPosition = new Dictionary { ["x"] = 0, ["y"] = 0 }; + } + + // Capture page dimensions and device metrics Dictionary metrics = new Dictionary { - ["width"] = driver.ExecuteScript("return Math.max(window.innerWidth,document.body.scrollWidth,document.documentElement.scrollWidth)"), - ["height"] = driver.ExecuteScript("return Math.max(window.innerHeight,document.body.scrollHeight,document.documentElement.scrollHeight)") + ["width"] = driver.ExecuteScript("return Math.max(window.innerWidth, document.body.scrollWidth, document.documentElement.scrollWidth)"), + ["height"] = driver.ExecuteScript("return Math.max(window.innerHeight, document.body.scrollHeight, document.documentElement.scrollHeight)"), + ["mobile"] = driver.ExecuteScript("return typeof window.orientation !== 'undefined'") }; + object devicePixelRatio = driver.ExecuteScript("return window.devicePixelRatio"); if (devicePixelRatio != null) { - double doubleValue = 0; - if (double.TryParse(devicePixelRatio.ToString(), out doubleValue)) + if (double.TryParse(devicePixelRatio.ToString(), out var doubleValue)) { metrics["deviceScaleFactor"] = doubleValue; } else { - long longValue = 0; - if (long.TryParse(devicePixelRatio.ToString(), out longValue)) + if (long.TryParse(devicePixelRatio.ToString(), out var longValue)) { metrics["deviceScaleFactor"] = longValue; } } } - metrics["mobile"] = driver.ExecuteScript("return typeof window.orientation !== 'undefined'"); - //Execute the emulation Chrome Command to change browser to a custom device that is the size of the entire page - driver.ExecuteCdpCommand("Emulation.setDeviceMetricsOverride", metrics); - //You can then just screenshot it as it thinks everything is visible - Screenshot screenshot = driver.GetScreenshot(); - //This command will return your browser back to a normal, usable form if you need to do anything else with it. - driver.ExecuteCdpCommand("Emulation.clearDeviceMetricsOverride", []); + + // Execute the emulation Chrome command to change browser to a custom device that is the size of the entire page + Screenshot screenshot = null; + try + { + driver.ExecuteCdpCommand("Emulation.setDeviceMetricsOverride", metrics); + screenshot = driver.GetScreenshot(); + } + finally + { + try + { + // Always attempt to restore original state + driver.ExecuteCdpCommand("Emulation.clearDeviceMetricsOverride", []); + driver.ExecuteScript($"window.scrollTo({{ top: {originalScrollPosition["y"]}, left: {originalScrollPosition["x"]}, behavior: 'instant' }});"); + } + catch (WebDriverException) + { + // Log warning if restoration fails + } + } return screenshot; } diff --git a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs index 927140ad99..890a35403a 100644 --- a/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs +++ b/Ginger/GingerCoreNET/Drivers/CoreDrivers/Web/Selenium/SeleniumDriver.cs @@ -70,6 +70,7 @@ limitations under the License. using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using static GingerCoreNET.GeneralLib.General; using DevToolsDomains = OpenQA.Selenium.DevTools.V125.DevToolsSessionDomains; @@ -803,12 +804,19 @@ public override void StartDriver() SetUnhandledPromptBehavior(EDOpts); if (IsUserProfileFolderPathValid()) { - EDOpts.AddAdditionalEdgeOption("user-data-dir=", UserProfileFolderPath); + EDOpts.AddArgument($"--user-data-dir={UserProfileFolderPath}"); } else { SetProxy(EDOpts); } + if (SeleniumUserArgs != null) + { + foreach (string arg in SeleniumUserArgs) + { + EDOpts.AddArgument(arg); + } + } SetCurrentPageLoadStrategy(EDOpts); driverService = EdgeDriverService.CreateDefaultService();//CreateDefaultServiceFromOptions(EDOpts); AddCustomDriverPath(driverService); @@ -6802,7 +6810,7 @@ ObservableList IWindowExplorer.GetElementLocators(ElementInfo El else { //e = LocateElementByLocators(ElementInfo.Locators); - e = Driver.FindElement(By.XPath(((HTMLElementInfo)ElementInfo).HTMLElementObject.XPath)); + e = Driver.FindElement(By.XPath(((HTMLElementInfo)ElementInfo).HTMLElementObject?.XPath)); ElementInfo.ElementObject = e; } @@ -9010,7 +9018,41 @@ public void HandleActUIElement(ActUIElement act) case ActUIElement.eElementAction.ScrollToElement: try { - ((IJavaScriptExecutor)Driver).ExecuteScript("arguments[0].scrollIntoView(true);", e); + var js = (IJavaScriptExecutor)Driver; + string command = string.Empty; + string scrollAlignment = act.GetInputParamCalculatedValue(ActUIElement.Fields.VerticalScrollAlignment); + + switch (scrollAlignment) + { + case nameof(eScrollAlignment.Center): + try + { + long elementPosition = e.Location.Y; + long viewportHeight = (long)js.ExecuteScript("return window.innerHeight"); + long scrollPosition = elementPosition - (viewportHeight / 2); + command = $"window.scrollTo(0, {scrollPosition});"; + } + catch (Exception ex) + { + // Log the exception with a detailed message + Reporter.ToLog(eLogLevel.DEBUG, $"An error occurred while calculating the scroll position: {ex.Message}"); + + // Prepare the fallback scroll command + command = "arguments[0].scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' });"; + } + break; + case nameof(eScrollAlignment.End): + command = "arguments[0].scrollIntoView(false);"; + break; + case nameof(eScrollAlignment.Nearest): + command = "arguments[0].scrollIntoView({ behavior: 'auto', block: 'nearest', inline: 'nearest' });"; + break; + case nameof(eScrollAlignment.Start): + default: + command = "arguments[0].scrollIntoView(true);"; + break; + } + js.ExecuteScript(command, e); } catch (Exception) { diff --git a/Ginger/GingerCoreNET/GeneralLib/General.cs b/Ginger/GingerCoreNET/GeneralLib/General.cs index 98e1471607..be074d4553 100644 --- a/Ginger/GingerCoreNET/GeneralLib/General.cs +++ b/Ginger/GingerCoreNET/GeneralLib/General.cs @@ -121,6 +121,33 @@ public override String ToString() } + /// + /// Defines the possible vertical alignment options for scrolling elements into view. + /// + public enum eScrollAlignment + { + /// + /// Aligns the top of the element with the top of the visible area of the scrollable ancestor. + /// + Start, + + /// + /// Centers the element vertically in the visible area of the scrollable ancestor. + /// + Center, + + /// + /// Aligns the bottom of the element with the bottom of the visible area of the scrollable ancestor. + /// + End, + + /// + /// Aligns the element with the nearest edge of the visible area of the scrollable ancestor, + /// either the top or bottom, depending on which is closer. + /// sssss + Nearest + } + #endregion ENUM static Regex rxvarPattern = new Regex(@"{(\bVar Name=)\w+\b[^{}]*}", RegexOptions.Compiled); diff --git a/Ginger/GingerCoreNET/Repository/SharedRepositoryOperations.cs b/Ginger/GingerCoreNET/Repository/SharedRepositoryOperations.cs index b83ed40d14..9c14417927 100644 --- a/Ginger/GingerCoreNET/Repository/SharedRepositoryOperations.cs +++ b/Ginger/GingerCoreNET/Repository/SharedRepositoryOperations.cs @@ -104,14 +104,7 @@ public Boolean UploadItemToRepository(Context context, UploadItemSelection itemT } srAction.ParentGuid = Guid.Empty; } - foreach (VariableBase srVariable in srActivity.Variables) - { - if (srVariable.ParentGuid != Guid.Empty) - { - srVariable.Guid = srVariable.ParentGuid; - } - srVariable.ParentGuid = Guid.Empty; - } + foreach (Act action in srActivity.Acts.Cast()) { foreach (FlowControl fc in action.FlowControls) @@ -135,10 +128,6 @@ public Boolean UploadItemToRepository(Context context, UploadItemSelection itemT { bfAction.ParentGuid = bfAction.Guid; } - foreach (VariableBase bfVariable in bfActivity.Variables) - { - bfVariable.ParentGuid = bfVariable.Guid; - } } } @@ -629,14 +618,6 @@ public static async Task SaveLinkedActivity(Activity LinkedActivity, string Excl } action.ParentGuid = Guid.Empty; } - foreach (VariableBase variable in sharedActivity.Variables) - { - if (variable.ParentGuid != Guid.Empty) - { - variable.Guid = variable.ParentGuid; - } - variable.ParentGuid = Guid.Empty; - } foreach (FlowControl fc in sharedActivity.Acts.SelectMany(a => a.FlowControls)) { Guid targetGuid = fc.GetGuidFromValue(); diff --git a/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs b/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs index 277848b57c..5cc2a8c61c 100644 --- a/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs +++ b/Ginger/GingerCoreNET/Run/GingerExecutionEngine.cs @@ -4411,21 +4411,6 @@ public void RunBusinessFlow(BusinessFlow businessFlow, bool standaloneExecution while (ExecutingActivity != null) { - if (ExecutingActivity.GetType() == typeof(ErrorHandler) || ExecutingActivity.GetType() == typeof(CleanUpActivity)) - { - if (!CurrentBusinessFlow.Activities.IsLastItem()) - { - GotoNextActivity(); - ExecutingActivity = (Activity)CurrentBusinessFlow.Activities.CurrentItem; - } - else - { - ExecutingActivity = null; - } - continue; - } - else - { ExecutingActivity.Status = eRunStatus.Running; GiveUserFeedback(); SetMappedValuesToActivityVariables(ExecutingActivity, previouslyExecutedActivities.ToArray()); @@ -4497,7 +4482,7 @@ public void RunBusinessFlow(BusinessFlow businessFlow, bool standaloneExecution } } - } + } } catch (Exception ex) diff --git a/Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs b/Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs index 22fc3d47cb..0c1ab24fa2 100644 --- a/Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs +++ b/Ginger/GingerCoreNET/RunLib/CLILib/CLIHelper.cs @@ -351,7 +351,7 @@ private bool CheckforReRunConfig() List accountReportRunset = accountReportApiHandler.GetRunsetExecutionDataFromCentralDB((Guid)mRunSetConfig.ReRunConfigurations.ReferenceExecutionID); if (accountReportRunset != null && accountReportRunset.Count > 0) { - if (accountReportRunset.Any(x => !x.Status.Equals(eRunStatus.Failed.ToString(), StringComparison.CurrentCultureIgnoreCase))) + if (accountReportRunset.Any(x => !x.Status.Equals(AccountReport.Contracts.Enum.eExecutionStatus.Failed.ToString(), StringComparison.CurrentCultureIgnoreCase))) { Reporter.ToLog(eLogLevel.INFO, string.Format("The Runset is already Passed or In_progress for provided reference execution id: {0}", mRunSetConfig.ReRunConfigurations.ReferenceExecutionID)); Result = false; @@ -368,9 +368,9 @@ private bool CheckforReRunConfig() List accountReportRunnerList = accountReportApiHandler.GetRunnerExecutionDataFromCentralDB((Guid)mRunSetConfig.ReRunConfigurations.ReferenceExecutionID); if (accountReportRunnerList != null) { - if (accountReportRunnerList.Any(x => x.RunStatus.Equals(eRunStatus.Failed))) + if (accountReportRunnerList.Any(x => x.RunStatus.Equals(AccountReport.Contracts.Enum.eExecutionStatus.Failed))) { - var FailedRunnerGuidList = accountReportRunnerList.Where(x => x.RunStatus.Equals(eRunStatus.Failed)).Select(x => x.EntityId); + var FailedRunnerGuidList = accountReportRunnerList.Where(x => x.RunStatus.Equals(AccountReport.Contracts.Enum.eExecutionStatus.Failed)).Select(x => x.EntityId); foreach (GingerRunner runner in mRunsetExecutor.RunSetConfig.GingerRunners) { if (!FailedRunnerGuidList.Contains(runner.Guid)) @@ -396,10 +396,10 @@ private bool CheckforReRunConfig() List accountReportBusinessFlows = accountReportApiHandler.GetBusinessflowExecutionDataFromCentralDB((Guid)mRunSetConfig.ReRunConfigurations.ReferenceExecutionID); if (accountReportBusinessFlows != null && accountReportBusinessFlows.Count > 0) { - if (accountReportBusinessFlows.Any(x => x.RunStatus.Equals(eRunStatus.Failed))) + if (accountReportBusinessFlows.Any(x => x.RunStatus.Equals(AccountReport.Contracts.Enum.eExecutionStatus.Failed))) { - var FailedBFGuidList = accountReportBusinessFlows.Where(x => x.RunStatus.Equals(eRunStatus.Failed)).Select(x => x.InstanceGUID); + var FailedBFGuidList = accountReportBusinessFlows.Where(x => x.RunStatus.Equals(AccountReport.Contracts.Enum.eExecutionStatus.Failed)).Select(x => x.InstanceGUID); foreach (GingerRunner runner in mRunsetExecutor.RunSetConfig.GingerRunners) { foreach (BusinessFlowRun business in runner.BusinessFlowsRunList) diff --git a/Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs b/Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs index c995ec9242..21c8095184 100644 --- a/Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs +++ b/Ginger/GingerCoreNET/RunLib/CLILib/DoOptions.cs @@ -17,6 +17,9 @@ limitations under the License. #endregion using CommandLine; +using System; +using System.IO; +using System.Net; namespace Amdocs.Ginger.CoreNET.RunLib.CLILib { @@ -35,8 +38,27 @@ public enum DoOperation [Option('o', "operation", Required = true, HelpText = "Select operation to run on solution")] public DoOperation Operation { get; set; } + private string _solution; + [Option('s', "solution", Required = true, HelpText = "Set solution folder")] - public string Solution { get; set; } + public string Solution + { + get => _solution; + set + { + if (string.IsNullOrWhiteSpace(value)) + { + return; + } + if (value.IndexOf("Ginger.Solution.xml", StringComparison.OrdinalIgnoreCase) >= 0) + { + value = Path.GetDirectoryName(value)?.Trim() ?? string.Empty; + + } + _solution = value; + } + } + } diff --git a/azure-linux-pipeline.yml b/azure-linux-pipeline.yml deleted file mode 100644 index 189ff3abad..0000000000 --- a/azure-linux-pipeline.yml +++ /dev/null @@ -1,103 +0,0 @@ -trigger: -- master -pr: [master, Features/Linux-Migration, Releases/*, Releases/*/* ] - -jobs: - -# ------------------------------------------------------------------------------------------------------ -# Request latest Ubunto/Linux -# ------------------------------------------------------------------------------------------------------ -- job: Linux - pool: - vmImage: 'ubuntu-latest' - -# ------------------------------------------------------------------------------------------------------ -# Job Variables -# ------------------------------------------------------------------------------------------------------ - variables: - solution: '**/*.sln' # = /home/vsts/work/1/s/Ginger - buildConfiguration: 'Release' - # artifactsFolder: 'D:\a\1\a' - - steps: - -# ------------------------------------------------------------------------------------------------------ -# installs version 8.0.100 latest -# ------------------------------------------------------------------------------------------------------ - - task: UseDotNet@2 - displayName: 'Use .NET Core sdk 8.0.100' - inputs: - packageType: sdk - version: 8.0.100 - installationPath: $(Agent.ToolsDirectory)/dotnet - - -# ------------------------------------------------------------------------------------------------------ -# start Testing -# ------------------------------------------------------------------------------------------------------ - - script: dotnet test Ginger/GingerUtilsTest --configuration $(buildConfiguration) --logger trx --verbosity=normal - displayName: 'Testing GingerUtilsTest' - - - script: dotnet test Ginger/GingerCoreCommonTest --configuration $(buildConfiguration) --logger trx --verbosity=normal - displayName: 'Testing GingerCoreCommonTest' - - # for GingerCoreNET we use run setting to limit to have one worker thread due to workspace limitation - - script: dotnet test Ginger/GingerCoreNETUnitTest --configuration $(buildConfiguration) --logger trx --verbosity=normal - displayName: 'Testing GingerCoreNETUnitTest' - - - script: dotnet test Ginger/GingerPluginCoreTest --configuration $(buildConfiguration) --logger trx --verbosity=normal - displayName: 'Testing GingerPluginCoreTest' - - - script: dotnet test Ginger/GingerConsoleTest --configuration $(buildConfiguration) --logger trx --verbosity=normal - displayName: 'Testing GingerConsoleTest' - - - script: dotnet test Ginger/GingerAutoPilotTest --configuration $(buildConfiguration) --logger trx --verbosity=normal - displayName: 'Testing GingerAutoPilotTest' - -# ------------------------------------------------------------------------------------------------------ -# Publish GingerRuntime -# ------------------------------------------------------------------------------------------------------ - - script: dotnet publish Ginger/GingerRuntime -c Release - displayName: 'Publish GingerRuntime' - - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Results -# ------------------------------------------------------------------------------------------------------ - - - task: PublishTestResults@2 - displayName: Publish test result - condition: succeededOrFailed() - inputs: - testRunner: VSTest - testResultsFiles: '**/*.trx' - -# ------------------------------------------------------------------------------------------------------ -# Run Standalone CLI Test -# ------------------------------------------------------------------------------------------------------ - - - task: PowerShell@2 - displayName: Run Standalone CLI Test - inputs: - filePath: CLITests.ps1 - condition: succeededOrFailed() - - -# ------------------------------------------------------------------------------------------------------ -# Package Test Artifacts -# ------------------------------------------------------------------------------------------------------ -# -# - task: PowerShell@2 -# displayName: Package test artifacts -# inputs: -# filePath: PackageTestArtifacts.ps1 -# condition: succeededOrFailed() - - - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Artifacts -# ------------------------------------------------------------------------------------------------------ - - - task: PublishBuildArtifacts@1 - condition: succeededOrFailed() diff --git a/azure-pipelines-3.yml b/azure-pipelines-3.yml deleted file mode 100644 index 3bafe6cf12..0000000000 --- a/azure-pipelines-3.yml +++ /dev/null @@ -1,51 +0,0 @@ -trigger: -- master -pr: [master, Features/Linux-Migration, Releases/*, Releases/*/* ] - -pool: - vmImage: 'macOS-latest' - -variables: - solution: '**/*.sln' - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - -steps: -- task: UseDotNet@2 - inputs: - packageType: 'sdk' - version: '8.0.100' - -- script: dotnet test Ginger/GingerUtilsTest --configuration $(buildConfiguration) --logger trx - displayName: 'Testing GingerUtilsTest' - -- script: dotnet test Ginger/GingerCoreCommonTest --configuration $(buildConfiguration) --logger trx - displayName: 'Testing GingerCoreCommonTest' - -- script: dotnet test Ginger/GingerCoreNETUnitTest --configuration $(buildConfiguration) --logger trx - displayName: 'Testing GingerCoreNETUnitTest' - -- script: dotnet test Ginger/GingerPluginCoreTest --configuration $(buildConfiguration) --logger trx - displayName: 'Testing GingerPluginCoreTest' - -- script: dotnet test Ginger/GingerConsoleTest --configuration $(buildConfiguration) --logger trx - displayName: 'Testing GingerConsoleTest' - -- script: dotnet test Ginger/GingerAutoPilotTest --configuration $(buildConfiguration) --logger trx - displayName: 'Testing GingerAutoPilotTest' - - -- task: PublishTestResults@2 - displayName: Publish test result - condition: succeededOrFailed() - inputs: - testRunner: VSTest - testResultsFiles: '**/*.trx' - - -# ------------------------------------------------------------------------------------------------------ -# Publish Test Artifacts -# ------------------------------------------------------------------------------------------------------ - -#- task: PublishBuildArtifacts@1 -# condition: succeededOrFailed() diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index f2856e3130..0000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,165 +0,0 @@ -# .NET -trigger: -- master -pr: [master, Features/Linux-Migration, Releases/*, Releases/*/* ] - -jobs: - -# ------------------------------------------------------------------------------------------------------ -# Request Windows VM Windows windows-2022 with Visual Studio 2022 - set Ginger solution -# ------------------------------------------------------------------------------------------------------ - -- job: Windows - pool: - vmImage: 'windows-2022' #Visual Studio 2022 Preview on Windows Server 2019 - workspace: - clean: outputs - -# ------------------------------------------------------------------------------------------------------ -# Job Variables -# ------------------------------------------------------------------------------------------------------ - variables: - solution: '**/*.sln' # = D:\a\1\s\Ginger\Ginger.sln - buildPlatform: 'Any CPU' - buildConfiguration: 'Release' - solutionDirectory: 'Ginger-Automation/Ginger' - testDLLs: | - **\GingerUtilsTest\bin\$(buildConfiguration)\net8.0\GingerUtilsTest.dll - **\GingerCoreCommonTest\bin\$(buildConfiguration)\net8.0\GingerCoreCommonTest.dll - **\GingerCoreNETUnitTest\bin\$(buildConfiguration)\net8.0\GingerCoreNETUnitTest.dll - **\GingerConsoleTest\bin\$(buildConfiguration)\net8.0\GingerConsoleTest.dll - **\GingerAutoPilotTest\bin\$(buildConfiguration)\net8.0\GingerAutoPilotTest.dll - **\GingerPluginCoreTest\bin\$(buildConfiguration)\net8.0\GingerPluginCoreTest.dll - - artifactsFolder: 'D:\a\1\a' - - -# ------------------------------------------------------------------------------------------------------ -# Steps task -# ------------------------------------------------------------------------------------------------------ - steps: -# ------------------------------------------------------------------------------------------------------ -# Install .Net core SDK 8.0.100 -# ------------------------------------------------------------------------------------------------------ - - - task: UseDotNet@2 - inputs: - packageType: 'sdk' - version: '8.0.100' -# ------------------------------------------------------------------------------------------------------ -# Install Nuget tool -# ------------------------------------------------------------------------------------------------------ - - task: NuGetToolInstaller@1 - displayName: NuGet Tool Installer - -# ------------------------------------------------------------------------------------------------------ -# Restore Ginger solution NuGet packages -# ------------------------------------------------------------------------------------------------------ - - task: NuGetCommand@2 - inputs: - command: restore - restoreSolution: '$(solution)' - displayName: Restore Ginger Solution Nuget Packages - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: | - Write-Output "Build Reason = $(Build.Reason)" - $sldomain="amdocs.sealights.co" - $slagenttoken= "$(SLAGENTTOKEN)" - $APP_NAME='Ginger' - $APP_NAMESPACE='Amdocs.*,ginger.*' - Write-Output "Token $($SLAGENTTOKEN.SubString($SLAGENTTOKEN.Length-5))" - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - Write-Output "Download the Sealights DotNet agent version set in settings..." - $agentversion = ((iwr -Uri https://$($sldomain)/api/v2/agents/dotnet/recommended -Headers @{'Accept' = 'application/json'; 'Authorization' = "Bearer $($slagenttoken)"}).Content | ConvertFrom-Json | Select-Object agent).agent.version - iwr -OutFile sealights-dotnet-agent.zip -Uri http://agents.sealights.co/SL.DotNet/SL.DotNet-$($agentversion).zip - Expand-Archive .\sealights-dotnet-agent.zip -DestinationPath SL.DotNet -Force - Write-Output "Sealights agent version used is:$(Get-Content .\SL.DotNet\version.txt)" - #Retrieve the same name of target branch as reported in Sealights Dashboard by removing the uncecessary prefix - $PR_NUMBER="$(system.pullRequest.pullRequestNumber)" - $REPO_URL="$(System.PullRequest.SourceRepositoryURI)" - $PR_TARGET_BRANCH="Releases/" + "$(System.PullRequest.TargetBranch)".Replace("refs/heads/","") - #Retrieve the last Commit Hash from the PR branch and not the one from the ADO local Merge (via git log history) - $PR_LAST_COMMIT=$(git log -2 --format=%H).Split(" ")[1] - Write-Output "`n*** Create PR BSID ***" - .\SL.DotNet\x64\SL.DotNet.exe prConfig --appName $APP_NAME --pullRequestNumber $PR_NUMBER --targetBranch $PR_TARGET_BRANCH --latestCommit $PR_LAST_COMMIT --repositoryUrl $REPO_URL --includeNamespace $APP_NAMESPACE --buildSessionIdFile $(Build.ArtifactStagingDirectory)\SealightsBuildSessionId.txt --token $($slagenttoken) --logEnabled true --logAppendConsole true --ignoreCertificateErrors true - Write-Output "`n*** Prepare for MSBuild ***" - .\SL.DotNet\x64\SL.DotNet.exe prepareForMsBuild --buildSessionIdFile $(Build.ArtifactStagingDirectory)\SealightsBuildSessionId.txt --workspacePath $(Build.Repository.LocalPath)\Ginger --baseDir $(Build.Repository.LocalPath) --ignoreGeneratedCode true --debugMode true --logEnabled true --logAppendConsole true --ignoreCertificateErrors true --token $($slagenttoken) --scm git --scmProvider vsts - displayName: Prepare for PR Build - continueOnError: true -# ------------------------------------------------------------------------------------------------------ -# Build Ginger Solution -# ------------------------------------------------------------------------------------------------------ - - task: VSBuild@1 - inputs: - solution: '$(solution)' # = D:\a\1\s\Ginger\Ginger.sln - # platform: 'x86' - # clean: true - configuration: '$(buildConfiguration)' - msbuildArgs: /NoLogo /m - # /TargetFrameworkVersion /TargetCompactFramework - # msbuildArchitecture: 'x86' # Optional. Options: x86, x64 - # TreatWarningsAsErrors / NoWarn -- do not allow warnings - do it later when we have zero warnings - displayName: Build Ginger solution - - - task: StartTestExecution@2 - inputs: - testStage: 'Unit Tests' - profilerArchitecture: 'x86' - sealightsToken: "$(SLAGENTTOKEN)" - SealightsBuildSessionId : $(Build.ArtifactStagingDirectory)\SealightsBuildSessionId.txt -# ------------------------------------------------------------------------------------------------------ -# Run Unit Test for .NET Core test DLLs -# ------------------------------------------------------------------------------------------------------ - - - task: VSTest@2 - displayName: 'Run tests for Ginger .Net Core *Test DLLs' - inputs: - testAssemblyVer2: $(testDLLs) - runInParallel: True - codeCoverageEnabled: True - - - - -# ------------------------------------------------------------------------------------------------------ -# Run .Net Framework tests using powershell and publish the results -# ------------------------------------------------------------------------------------------------------ - - - task: PowerShell@2 - displayName: Run tests for Ginger .NetFramework *Test Dlls - inputs: - filePath: TestDotNetFramework.ps1 - - - - task: PublishTestResults@2 - displayName: Publish .Net Framework test result - condition: succeededOrFailed() - inputs: - testResultsFormat: VSTest - testResultsFiles: '**/DotNetFramework/*.trx' - - - task: EndTestExecution@2 - inputs: - sealightsToken: "$(SLAGENTTOKEN)" - SealightsBuildSessionId : $(Build.ArtifactStagingDirectory)\SealightsBuildSessionId.txt -# ------------------------------------------------------------------------------------------------------ -# Package Ginger EXE -# ------------------------------------------------------------------------------------------------------ -# -# - task: PowerShell@2 -# displayName: Package Ginger EXE -# inputs: -# filePath: PackageGingerEXE.ps1 -# condition: succeededOrFailed() -# - - -# ------------------------------------------------------------------------------------------------------ -# PublishBuildArtifacts -# ------------------------------------------------------------------------------------------------------ - -# - task: PublishBuildArtifacts@1 -# condition: succeededOrFailed()