Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub actions migration #450

Merged
merged 75 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
50f68ea
github actions initial commit
Mar 1, 2024
9ae79aa
fixing typo in run
Mar 1, 2024
677a161
fixing typo in runs
Mar 1, 2024
7f6ca13
fixing envs
Mar 2, 2024
64258c4
fixing nuget absolute path
Mar 2, 2024
bd6d8e0
fixing nuget absolute path
Mar 2, 2024
f235f43
fixing nuget absolute path
Mar 2, 2024
a9e1c05
fixing nuget absolute path
Mar 2, 2024
897df88
fixing nuget absolute path
Mar 2, 2024
7fde1bc
fixing nuget absolute path
Mar 2, 2024
c3f40ac
fixing nuget absolute path
Mar 2, 2024
78f81ca
fixing nuget absolute path
Mar 2, 2024
9065b76
updating explicit csproj
Mar 2, 2024
d1dbbe4
updating explicit csproj
Mar 2, 2024
0ef58fc
fixing csprojs
Mar 3, 2024
a964f93
fixing csprojs
Mar 3, 2024
8b24d5c
fixing csprojs
Mar 3, 2024
1e6703e
fixing csprojs
Mar 3, 2024
5d34959
fixing uploading artifacts
Mar 3, 2024
8fc3cf8
fixing duplicates
Mar 3, 2024
33b0fb0
removing uploading whole build
Mar 3, 2024
205fb09
reverting not uploading build, changes to running tests on core
Mar 4, 2024
66a956d
zipping build and extraction
Mar 4, 2024
7f3b8f0
zip fix
Mar 4, 2024
19b87a7
running tests fixes core 1
Mar 4, 2024
33f33f7
ps modifications for github actions
Mar 4, 2024
473e156
ps modifications for github actions
Mar 4, 2024
e3d1cf1
ps modifications for github actions
Mar 4, 2024
947b7bc
ps modifications for github actions
Mar 4, 2024
b8c6e67
zip fix for core1
Mar 4, 2024
9b18419
testing vstest
Mar 5, 2024
59f481f
testing vstest
Mar 5, 2024
bac8ee2
testing vstest
Mar 5, 2024
5fa7e92
testing vstest
Mar 5, 2024
d11e73b
testing vstest
Mar 5, 2024
ba24129
testing vstest
Mar 5, 2024
45981e5
testing vstest
Mar 5, 2024
b388279
testing vstest
Mar 5, 2024
bc38147
testing vstest
Mar 6, 2024
a0604d4
testing vstest
Mar 6, 2024
9c15975
testing vstest
Mar 6, 2024
8c246c7
fixing zipping artifacts
Mar 6, 2024
2dd2bdf
fixing test_Stage_RunTestsOnWindowsCore2
Mar 6, 2024
77cdf73
fixing test_Stage_RunTestsOnWindowsCore2
Mar 6, 2024
26dbc46
fixing test_Stage_RunTestsOnWindowsCore2
Mar 6, 2024
3e4d5f2
fixing test_Stage_RunTestsOnWindowsCore2
Mar 6, 2024
56a198e
fixing test_Stage_RunTestsOnWindowsCore2 and linux
Mar 6, 2024
758fe0b
fixing linux 1
Mar 6, 2024
1eab910
fixing linux 1
Mar 7, 2024
42a6ae8
fixing linux 1 and windows framework
Mar 7, 2024
79d6b7e
fixing windows framework
Mar 7, 2024
135f407
fixing windows framework
Mar 7, 2024
7b4d99e
reverting changes in ps1 scripts, fixing linux browserstack
Mar 7, 2024
314c495
reverting changes in ps1 scripts, fixing linux browserstack
Mar 7, 2024
d1e3117
fixes windows browserstack
Mar 7, 2024
9d6bbdb
fixes windows browsestack and grid
Mar 7, 2024
b0161d1
fixes windows grid
Mar 7, 2024
b334fc8
fixes windows grid
Mar 7, 2024
aab2a69
refactor
Mar 7, 2024
3804690
docker fixes
Mar 7, 2024
78a4ca3
docker fixes
Mar 8, 2024
98c04a5
docker fixes
Mar 9, 2024
86d8b7e
docker fixes
Mar 9, 2024
3995958
docker fixes
Mar 9, 2024
767ae09
docker ignore
Mar 11, 2024
ebb5a05
docker ignore
Mar 11, 2024
7829a22
fixing test paths
Mar 12, 2024
beb1359
fixing test paths
Mar 12, 2024
0340533
updating actions
Mar 12, 2024
5516395
rolling back to dotnet vstest
Mar 12, 2024
ba059ce
rolling back to dotnet vstest
Mar 12, 2024
1a46a21
rolling back to dotnet vstest
Mar 12, 2024
c9a02e7
updating readme
Mar 12, 2024
6552a15
rolling back linux azure changes
Mar 12, 2024
b57e667
reverting changes from nunitextentreports
Mar 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
348 changes: 348 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
on:
push:
branches:
- '*'
paths-ignore:
- README.md
tags:
- '*'
schedule:
- cron: '0 18 * * 0'
env:
solution: ${{ github.workspace }}/Ocaramba.sln
buildPlatform: Any CPU
buildConfiguration: Release
frameworkVersion: 4.0.0
TestResultsDirWindows: D:\a\Ocaramba\Ocaramba\TestResults
CHROMEWEBDRIVER: C:\SeleniumWebDrivers\ChromeDriver
BuildVersion: 4.0.0${{ github.run_number }}
ChromeDriverVersion: 122.0.6261.9400
seleniumGridVersion: selenium-server-4.8.0.jar
seleniumGridUrl: https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.8.0/selenium-server-4.8.0.jar
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
build_Stage_BuildTestsOnWindows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- shell: powershell
run: |
$tags = git tag --sort=-creatordate
$tag = $tags[0]
Write-Host "##vso[task.setvariable variable=frameworkVersion]$tag"
if: startsWith(github.ref, 'refs/tags/')
- shell: powershell
run: '(Get-Content ''Ocaramba.sln'' -raw) -replace [regex](''.*?'' + ''Documentation'' + (''.*?\r\n'' * (5 + 1))) | set-content ''Ocaramba.sln'''
- name: Update ChromeDriver in csproj
run: |
Get-ChildItem ./ *.csproj -recurse |
Foreach-Object {
$c = ($_ | Get-Content)
$c = $c -replace '109.0.5414.7400','${{ env.ChromeDriverVersion }}'
[IO.File]::WriteAllText($_.FullName, ($c -join "`r`n"))
}
- name: Setup nuget
uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- name: Cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}\.nuget\packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} #hash of project files
restore-keys: |
${{ runner.os }}-nuget-
- name: NuGet restore
run: nuget restore ${{ env.solution }}
- name: Set project versions
id: update
uses: vers-one/[email protected]
with:
file: |
"**/Ocaramba.csproj", "**/OcarambaLite.csproj"
version: ${{ env.frameworkVersion }}
- run: msbuild '${{ env.solution }}' /p:configuration='${{ env.buildConfiguration }}' /p:platform='${{ env.buildPlatform }}' /v:minimal
- uses: actions/upload-artifact@v4
with:
path: ./Ocaramba/bin/Release/Ocaramba.${{ env.frameworkVersion }}.nupkg
name: Ocaramba${{ env.frameworkVersion }}
- uses: actions/upload-artifact@v4
with:
path: ./Ocaramba/bin/Release/Ocaramba.${{ env.frameworkVersion }}.snupkg
name: OcarambaS${{ env.frameworkVersion }}
- uses: actions/upload-artifact@v4
with:
path: ./OcarambaLite/bin/Release/OcarambaLite.${{ env.frameworkVersion }}.nupkg
name: OcarambaLite${{ env.frameworkVersion }}
- uses: actions/upload-artifact@v4
with:
path: ./OcarambaLite/bin/Release/OcarambaLite.${{ env.frameworkVersion }}.snupkg
name: OcarambaLiteS${{ env.frameworkVersion }}
- name: Zip artifact for deployment
run: Compress-Archive -Path ./ -Destination OcarambaBuild.zip
- uses: actions/upload-artifact@v4
with:
path: OcarambaBuild.zip
name: OcarambaBuild
compression-level: 0
if: (${{ job.status }} != 'cancelled')
test_Stage_RunTestsOnDocker:
runs-on: ubuntu-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- run: docker buildx build -f Dockerfile -t ***/selenium:latest
if: false
- run: docker push -t Dockerfile
if: false
- run: docker-compose -f docker-compose.yml up -d
- run: ./ExecutingTestsOnDockerGithubActions.ps1
if: false
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: false
with:
files: |
/home/runner/work/Ocaramba/Ocaramba/TestResults/Ocaramba.Tests.Docker.xml
test_Stage_RunTestsOnLinux:
runs-on: ubuntu-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- run: find . -name '*.csproj' -exec sed -i -e 's/109.0.5414.7400/${{ env.ChromeDriverVersion }}/g' {} \;
- run: |
ls

export ASPNETCORE_ENVIRONMENT=Linux

echo $ASPNETCORE_ENVIRONMENT

sudo apt-get install google-chrome-stable

sed -i '/Documentation/,+5 d' ./Ocaramba.sln
- run: dotnet build ./Ocaramba.sln --configuration ${{ env.buildConfiguration }}
- shell: pwsh
run: ./ExecutingTestsOnLinuxAzure.ps1
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: false
with:
files: |
/home/runner/work/Ocaramba/Ocaramba/TestResults/Ocaramba.Tests.netcoreapp.xml
test_Stage_RunTestsOnLinuxBrowserStack:
runs-on: ubuntu-latest
timeout-minutes: 10
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- run: |
ls

export ASPNETCORE_ENVIRONMENT=Linux

echo $ASPNETCORE_ENVIRONMENT

sed -i '/Documentation/,+5 d' ./Ocaramba.sln
- run: dotnet build ./Ocaramba.sln --configuration ${{ env.buildConfiguration }}
- shell: pwsh
if: false
env:
MAPPED_ENV_BROWSERSTACKKEY: ${{ env.browserstackkey }}
MAPPED_ENV_BROWSERSTACKUSER: ${{ env.browserstackuser }}
MAPPED_ENV_TESTINGBOTKEY: ${{ env.testingbotkey }}
MAPPED_ENV_TESTINGBOTSECRET: ${{ env.testingbotsecret }}
MAPPED_ENV_SAUCELABSACCESSKEY: ${{ env.saucelabsaccessKey }}
MAPPED_ENV_SAUCELABSUSERNAME: ${{ env.saucelabsusername }}
run: ./ExecutingTestsOnLinuxBrowserStackGithubActions.ps1
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: false
with:
files: |
/home/runner/work/Ocaramba/Ocaramba/TestResults/BrowserStacknetcoreapp.xml
test_Stage_RunTestsOnWindowsCore1:
runs-on: windows-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- uses: actions/download-artifact@v4
with:
name: OcarambaBuild
- run: Expand-Archive -Path OcarambaBuild.zip -DestinationPath ./
- run: ./ExecutingTestsOnWindowsGithubActions1.ps1
- run: Get-ChildItem .\ -Recurse
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: ${{ env.TestResultsDirWindows }}\Ocaramba.Tests.netcoreapp.trx
- name: Zip artifact
run: Compress-Archive -Path D:\a\Ocaramba\Ocaramba\Ocaramba\Ocaramba.Tests.NUnitExtentReports\bin\Release\net6.0\TestOutput -Destination ExtentReports_${{ github.run_id }}.zip
- uses: actions/upload-artifact@v4
with:
path: ExtentReports_${{ github.run_id }}.zip
name: ExtentTestReport
if: always()
test_Stage_RunTestsOnWindowsCore2:
runs-on: windows-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- uses: actions/download-artifact@v4
with:
name: OcarambaBuild
- run: Expand-Archive -Path OcarambaBuild.zip -DestinationPath ./
- run: ./ExecutingTestsOnWindowsGithubActions2.ps1
- run: Get-ChildItem .\ -Recurse
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: |
${{ env.TestResultsDirWindows }}\Ocaramba.Tests.netcoreapp.xml
${{ env.TestResultsDirWindows }}\Ocaramba.Tests.EdgeChrominum.xml
test_Stage_RunTestsOnWindowsFramework:
runs-on: windows-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- uses: actions/download-artifact@v4
with:
name: OcarambaBuild
- run: Expand-Archive -Path OcarambaBuild.zip -DestinationPath ./
- run: ./ExecutingTestsOnWindowsGithubActions3.ps1
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: ${{ env.TestResultsDirWindows }}\Ocaramba.Tests.net4.xml
test_Stage_RunTestsOnWindowsBrowserStack:
runs-on: windows-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- uses: actions/download-artifact@v4
with:
name: OcarambaBuild
- run: Expand-Archive -Path OcarambaBuild.zip -DestinationPath ./
- run: ./ExecutingTestsOnWindowsGithubActions4.ps1
env:
MAPPED_ENV_BROWSERSTACKKEY: ${{ env.browserstackkey }}
MAPPED_ENV_BROWSERSTACKUSER: ${{ env.browserstackuser }}
MAPPED_ENV_TESTINGBOTKEY: ${{ env.testingbotkey }}
MAPPED_ENV_TESTINGBOTSECRET: ${{ env.testingbotsecret }}
MAPPED_ENV_SAUCELABSACCESSKEY: ${{ env.saucelabsaccessKey }}
MAPPED_ENV_SAUCELABSUSERNAME: ${{ env.saucelabsusername }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: ${{ env.TestResultsDirWindows }}\Ocaramba.Tests.BrowserStack.xml
test_Stage_RunTestsSeleniumGrid:
runs-on: windows-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- uses: actions/download-artifact@v4
with:
name: OcarambaBuild
- run: Expand-Archive -Path OcarambaBuild.zip -DestinationPath ./
- run: ./ExecutingTestsOnWindowsGithubActions5.ps1
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: |
${{ env.TestResultsDirWindows }}\Ocaramba.Tests.NUnitGrid.xml
${{ env.TestResultsDirWindows }}\Ocaramba.Tests.CloudProviderCrossBrowserGrid.xml
test_Stage_RunTestsOnWindowsSaucelabs:
runs-on: windows-latest
needs:
- build_Stage_BuildTestsOnWindows
steps:
- uses: actions/checkout@v4
- uses: nuget/setup-nuget@v2
with:
nuget-version: latest
- uses: actions/download-artifact@v4
with:
name: OcarambaBuild
- run: Expand-Archive -Path OcarambaBuild.zip -DestinationPath ./
- run: ./ExecutingTestsOnWindowsGithubActions6.ps1
env:
MAPPED_ENV_BROWSERSTACKKEY: ${{ env.browserstackkey }}
MAPPED_ENV_BROWSERSTACKUSER: ${{ env.browserstackuser }}
MAPPED_ENV_TESTINGBOTKEY: ${{ env.testingbotkey }}
MAPPED_ENV_TESTINGBOTSECRET: ${{ env.testingbotsecret }}
MAPPED_ENV_SAUCELABSACCESSKEY: ${{ env.saucelabsaccessKey }}
MAPPED_ENV_SAUCELABSUSERNAME: ${{ env.saucelabsusername }}
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2
if: always()
with:
files: |
${{ env.TestResultsDirWindows }}\Ocaramba.Tests.saucelabsnet472.xml
release_Stage_PublishNuget:
runs-on: windows-latest
needs:
- build_Stage_BuildTestsOnWindows
- test_Stage_RunTestsOnDocker
- test_Stage_RunTestsOnLinux
- test_Stage_RunTestsOnLinuxBrowserStack
- test_Stage_RunTestsOnWindowsCore1
- test_Stage_RunTestsOnWindowsCore2
- test_Stage_RunTestsOnWindowsFramework
- test_Stage_RunTestsOnWindowsBrowserStack
- test_Stage_RunTestsSeleniumGrid
- test_Stage_RunTestsOnWindowsSaucelabs
steps:
- uses: actions/checkout@v4
- shell: powershell
run: |
$tags = git tag --sort=-creatordate
$tag = $tags[0]
Write-Host "##vso[task.setvariable variable=frameworkVersion]$tag"
if: startsWith(github.ref, 'refs/tags/')
- uses: actions/download-artifact@v4
with:
name: Ocaramba${{ env.frameworkVersion }}
- uses: actions/download-artifact@v4
with:
name: OcarambaS${{ env.frameworkVersion }}
- uses: actions/download-artifact@v4
with:
name: OcarambaLite${{ env.frameworkVersion }}
- uses: actions/download-artifact@v4
with:
name: OcarambaLiteS${{ env.frameworkVersion }}
- run: Get-ChildItem ./ -Recurse
- name: Push Nuget Package
run: dotnet custom push ${{ env.Agent.BuildDirectory }}\Ocaramba.${{ env.frameworkVersion }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ env.NuGetApiKey }}
if: (success() && startsWith(github.ref, 'refs/tags/'))
- name: Push Nuget Package
run: dotnet custom push ${{ env.Agent.BuildDirectory }}\OcarambaLite.${{ env.frameworkVersion }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ env.NuGetApiKey }}
if: (success() && startsWith(github.ref, 'refs/tags/'))
18 changes: 18 additions & 0 deletions ExecutingTestsOnDockerGithubActions.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
docker info

docker ps -a
docker exec ocaramba_selenium bash -c "ls ; sed -i '/Documentation/,+5 d' ./Ocaramba.sln ; dotnet build ./Ocaramba.sln"
docker exec ocaramba_selenium bash -c 'pwsh ./scripts/set_AppConfig_for_tests.ps1 \"./Ocaramba.Tests.NUnit/bin/Debug/net6.0\" \"appsettings.Linux.json\" \"appSettings\" \"browser|PathToChromeDriverDirectory\" \"Chrome|/chromedriver\" -logValues -json'
docker exec ocaramba_selenium bash -c 'dotnet vstest ./Ocaramba.Tests.NUnit/bin/Debug/net6.0/Ocaramba.Tests.NUnit.dll /TestCaseFilter:\"(TestCategory!=NotImplementedInCoreOrUploadDownload)\" /Parallel --logger:\"trx;LogFileName=Ocaramba.Tests.Docker.xml\"'

docker cp ocaramba_selenium:/Ocaramba/TestResults/Ocaramba.Tests.Docker.xml .


docker rm ocaramba_selenium --force

if($lastexitcode -ne 0)
{
echo 'lastexitcode' $lastexitcode
}

exit 0
2 changes: 1 addition & 1 deletion ExecutingTestsOnLinuxAzure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ if($lastexitcode -ne 0)
echo 'lastexitcode' $lastexitcode
}

exit 0
exit 0
20 changes: 20 additions & 0 deletions ExecutingTestsOnLinuxBrowserStackGithubActions.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
echo '********************************************CloudProviderCrossBrowser tests********************************************'

echo '********************************************BrowserStack tests********************************************'
$Env:ASPNETCORE_ENVIRONMENT="Linux"

echo $Env:ASPNETCORE_ENVIRONMENT

.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net6.0" "appsettings.Linux.json" "appSettings" "browser|PathToChromeDriverDirectory" "Chrome|$($env:CHROMEWEBDRIVER)" -logValues -json

.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net6.0" "appsettings.Linux.json" "appSettings" "RemoteWebDriverHub" "https://$($env:MAPPED_ENV_BROWSERSTACKUSER):$($env:MAPPED_ENV_BROWSERSTACKKEY)@hub-cloud.browserstack.com/wd/hub" -json

.\scripts\set_AppConfig_for_tests.ps1 ".\Ocaramba.Tests.CloudProviderCrossBrowser\bin\Release\net6.0" "appsettings.Linux.json" "DriverCapabilities" "buildName" "Ocaramba.Tests.BrowserStackCrossBrowser$($env:BuildVersion)" -logValues -json

dotnet vstest ./Ocaramba.Tests.CloudProviderCrossBrowser/bin/Release/net6.0/Ocaramba.Tests.CloudProviderCrossBrowser.dll /Logger:"trx;LogFileName=Ocaramba.Tests.BrowserStacknetcoreapp.xml"

if($lastexitcode -ne 0)
{
echo 'lastexitcode' $lastexitcode
}
exit 0
Loading
Loading