Bump MSTest.TestFramework from 4.0.2 to 4.1.0 #1795
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: test-all | ||
| on: | ||
| push: | ||
| branches-ignore: | ||
| - 'dependabot/**' #avoid duplicates: only run the PR, not the commit | ||
| - 'gh-pages' #github pages do not trigger all tests | ||
| tags-ignore: | ||
| - 'v*' #avoids rerun existing commit on release | ||
| paths-ignore: | ||
| - 'samples/**' #samples have a dedicated workflow | ||
| pull_request: | ||
| branches: | ||
| - 'main' | ||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| #if: ${{ false }} # disable for now | ||
| #avoids duplicate execution of pr from local repo, but allows pr from forked repos and dependabot | ||
| if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && (github.event.pull_request.head.repo.fork || startsWith(github.head_ref, 'dependabot/'))) | ||
| strategy: | ||
| matrix: | ||
| platform: [java, net] | ||
| version: [base] #baseline test versions | ||
| # Feb 2026: Selenoid is removed from the workflow because it is not compatible with the latest docker v29 | ||
| # (Minimum supported API version is 1.44), while Selenoid requires api v1.24 | ||
| mode: [headless, grid, preload-local, vcmock-local, preload-remote, vcmock-remote] | ||
| # Include testing some modes for compatibility: jdk11 with junit5 | ||
| include: | ||
| - platform: java | ||
| version: jdk11 | ||
| mode: headless | ||
| - platform: java | ||
| version: jdk11 | ||
| mode: preload-remote | ||
| #When dynamic grid address is localhost or 127.0.0.1, Net+Grid work on local, but fail with timeout when creating remote web driver in GHA. | ||
| #If set the address to ${hostname -i), then the driver is successfully created, but a different failure is raised: | ||
| #The HTTP request to the remote WebDriver server for URL http://10.1.0.124:4444/session timed out after 60 seconds | ||
| #Workaround: skip this combination | ||
| exclude: | ||
| - platform: net | ||
| mode: grid | ||
| fail-fast: false | ||
| defaults: | ||
| run: | ||
| working-directory: ${{ matrix.platform }} | ||
| permissions: | ||
| contents: read | ||
| checks: write | ||
| packages: read | ||
| #if: ${{ false }} # disable for now | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - if: ${{ matrix.platform=='java' && matrix.version=='base' }} | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '17' | ||
| cache: 'maven' | ||
| - if: ${{ matrix.platform=='java' && matrix.version=='jdk11' }} | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: '11' | ||
| cache: 'maven' | ||
| - if: ${{ matrix.platform=='net' }} | ||
| uses: actions/[email protected] | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
| - name: JAVA - Platform dependent report location | ||
| if: ${{ matrix.platform == 'java' }} | ||
| run: echo "REPORT_FOLDER=target" >> $GITHUB_ENV | ||
| - name: NET - Platform dependent report location | ||
| if: ${{ matrix.platform == 'net' }} | ||
| run: echo "REPORT_FOLDER=reports" >> $GITHUB_ENV | ||
| - name: Test scope (default), all except video controller mock tests | ||
| run: | | ||
| echo "JAVA_TEST_SCOPE=-Dtest=!**/selema/video/Test*" >> $GITHUB_ENV | ||
| echo "NET_TEST_SCOPE=--filter FullyQualifiedName!~Test4giis.Selema.Video" >> $GITHUB_ENV | ||
| - name: Test scope (override for grid), only single test because performance | ||
| if: ${{ matrix.mode == 'grid' }} | ||
| run: | | ||
| echo "JAVA_TEST_SCOPE=-Dtest=TestLifecycle4#testFailMethod" >> $GITHUB_ENV | ||
| echo "NET_TEST_SCOPE=--filter FullyQualifiedName=Test4giis.Selema.Mstest2.TestLifecycle4.testFailMethod" >> $GITHUB_ENV | ||
| - name: Test scope (override for vcmock-local), only local video controller mock tests | ||
| if: ${{ matrix.mode == 'vcmock-local' }} | ||
| run: | | ||
| echo "JAVA_TEST_SCOPE=-Dtest=**/video/TestVideoControllerLocal" >> $GITHUB_ENV | ||
| echo "NET_TEST_SCOPE=--filter FullyQualifiedName~Video.TestVideoControllerLocal" >> $GITHUB_ENV | ||
| - name: Test scope (override for vcmock-remote), only remote video controller mock tests | ||
| if: ${{ matrix.mode == 'vcmock-remote' }} | ||
| run: | | ||
| echo "JAVA_TEST_SCOPE=-Dtest=**/video/TestVideoControllerRemote" >> $GITHUB_ENV | ||
| echo "NET_TEST_SCOPE=--filter FullyQualifiedName~Video.TestVideoControllerRemote" >> $GITHUB_ENV | ||
| - name: test properties configuration | ||
| run: | | ||
| mkdir -p ${{ env.REPORT_FOLDER }}/selema | ||
| echo "selema.test.mode=${{ matrix.mode }}" > selema.properties | ||
| echo "selema.test.browser=chrome" >> selema.properties | ||
| # remote web driver will be updated later before launching the remote service | ||
| echo "selema.test.remote.webdriver=none" >> selema.properties | ||
| echo "selema.test.web.root=http://`(hostname -i)`:8888" >> selema.properties | ||
| echo "selema.test.manual.check=false" >> selema.properties | ||
| - name: launch services - web server | ||
| run: nohup python3 -m http.server --directory $GITHUB_WORKSPACE/java/src/test/resources/static 8888 & | ||
| # Although Selenoid is not supported with the latest docker and excluded from the matrix, | ||
| # we keep this configuration in the workflow for reference and testing with older docker versions. | ||
| - name: launch services - selenoid | ||
| if: ${{ matrix.mode=='selenoid' }} | ||
| run: | | ||
| sed -i 's|selema.test.remote.webdriver=none|selema.test.remote.webdriver=http://127.0.0.1:4444/wd/hub|g' selema.properties | ||
| set -x | ||
| mkdir -p ${{ env.REPORT_FOLDER }}/browsers | ||
| echo '{"chrome": {"default": "latest", "versions": {"latest": {"image":"selenoid/chrome:latest","port":"4444","tmpfs": {"/tmp":"size=512m"} } } } }' > ${{ env.REPORT_FOLDER }}/browsers/browsers.json | ||
| docker pull selenoid/chrome:latest | ||
| docker pull selenoid/video-recorder:latest-release | ||
| docker run -d --name selenoid -p 4444:4444 \ | ||
| -v /var/run/docker.sock:/var/run/docker.sock \ | ||
| -v $GITHUB_WORKSPACE/${{ matrix.platform}}/${{ env.REPORT_FOLDER }}/browsers:/etc/selenoid/:ro \ | ||
| -v $GITHUB_WORKSPACE/${{ matrix.platform}}/${{ env.REPORT_FOLDER }}/selema/:/opt/selenoid/video/ \ | ||
| -e OVERRIDE_VIDEO_OUTPUT_DIR=$GITHUB_WORKSPACE/${{ matrix.platform}}/${{ env.REPORT_FOLDER }}/selema/ \ | ||
| aerokube/selenoid:latest-release | ||
| docker logs selenoid | ||
| #spin up a docker-selenium standalone based selenium dynamic grid with chrome (config in src/test/resources) | ||
| #note that the .toml file defines username and password, the url also includes them | ||
| - name: launch services - selenium dynamic grid | ||
| if: ${{ matrix.mode=='grid' }} | ||
| run: | | ||
| set -x | ||
| sed -i "s|selema.test.remote.webdriver=none|selema.test.remote.webdriver=http://testuser:test@localhost:4444|g" selema.properties | ||
| mkdir -p ${{ env.REPORT_FOLDER }}/selema/assets | ||
| sudo chown 1200:1201 ${{ env.REPORT_FOLDER }}/selema/assets | ||
| docker run -d --name selenium --shm-size="2g" -p 4444:4444 \ | ||
| -v $GITHUB_WORKSPACE/java/src/test/resources/selenium-dynamic-grid.toml:/opt/selenium/docker.toml \ | ||
| -v $GITHUB_WORKSPACE/${{ matrix.platform}}/${{ env.REPORT_FOLDER }}/selema/assets:/opt/selenium/assets \ | ||
| -v /var/run/docker.sock:/var/run/docker.sock \ | ||
| selenium/standalone-docker:latest | ||
| sleep 10 | ||
| docker logs selenium | ||
| # spin up a docker-selenium standalone selenium browser with a sidecar video recorder | ||
| - name: launch services - preloaded selenium standalone with video recorder sidecar | ||
| if: ${{ matrix.mode=='preload-local' }} | ||
| run: | | ||
| sed -i "s|selema.test.remote.webdriver=none|selema.test.remote.webdriver=http://localhost:4444|g" selema.properties | ||
| echo "selema.test.preload.video.container=selenium-video-chrome" >> selema.properties | ||
| echo "selema.test.preload.video.sourcefile=$GITHUB_WORKSPACE/preload-local/chrome.mp4" >> selema.properties | ||
| echo "selema.test.preload.video.targetfolder=${{ env.REPORT_FOLDER }}/selema" >> selema.properties | ||
| set -x | ||
| docker network create grid | ||
| mkdir -p $GITHUB_WORKSPACE/preload-local | ||
| LABEL=chrome NETWORK=grid FOLDER=$GITHUB_WORKSPACE/preload-local PORTS=4444:4444 USER=$UID \ | ||
| docker compose -f ../video-controller/docker-compose-preload.yml up -d | ||
| # chmod ug+rx ../video-controller/preload-start.sh | ||
| # ../video-controller/preload-start.sh chrome grid $GITHUB_WORKSPACE/preload-local "4444:4444" $UID | ||
| # samb, but to use a remote video controller | ||
| - name: launch services - preloaded selenium standalone with video recorder sidecar (remote video controller) | ||
| if: ${{ matrix.mode=='preload-remote' }} | ||
| run: | | ||
| sed -i "s|selema.test.remote.webdriver=none|selema.test.remote.webdriver=http://localhost:4444|g" selema.properties | ||
| echo "selema.test.preload.label=chrome" >> selema.properties | ||
| echo "selema.test.preload.video.controller=http://localhost:4449/selema-video-controller" >> selema.properties | ||
| echo "selema.test.preload.video.targetfolder=${{ env.REPORT_FOLDER }}/selema" >> selema.properties | ||
| set -x | ||
| docker network create grid | ||
| mkdir -p $GITHUB_WORKSPACE/video-controller/app/videos | ||
| LABEL=chrome NETWORK=grid FOLDER=$GITHUB_WORKSPACE/video-controller/app/videos PORTS=4444:4444 USER=$UID \ | ||
| docker compose -f ../video-controller/docker-compose-preload.yml up -d | ||
| # chmod ug+rx ../video-controller/preload-start.sh | ||
| # ../video-controller/preload-start.sh chrome grid $GITHUB_WORKSPACE/video-controller/app/videos "4444:4444" $UID | ||
| # spin up the video controller, do not use containres because of it needs access to the docker socket | ||
| - name: launch services - remote video controller | ||
| if: ${{ matrix.mode=='vcmock-remote' }} || ${{ matrix.mode=='preload-remote' }} | ||
|
Check warning on line 182 in .github/workflows/test.yml
|
||
| run: | | ||
| set -x | ||
| cd $GITHUB_WORKSPACE/video-controller/app | ||
| mkdir -p videos | ||
| npm install | ||
| npm start > $GITHUB_WORKSPACE/${{ matrix.platform}}/${{ env.REPORT_FOLDER }}/selema/video-controller.log 2>&1 & | ||
| - name: JAVA - Build and test | ||
| if: ${{ matrix.platform=='java' }} | ||
| run: mvn test -Dmaven.test.failure.ignore=true ${{ env.JAVA_TEST_SCOPE }} -U --no-transfer-progress | ||
| - name: NET - Build and test | ||
| if: ${{ matrix.platform=='net' }} | ||
| run: dotnet test ${{ env.NET_TEST_SCOPE }} --logger "trx;LogFileName=../../reports/test-result.trx" | ||
| - name: Display contents of the selema report folder (for debug) | ||
| if: always() | ||
| run: sudo ls -laR ${{ env.REPORT_FOLDER }}/selema | ||
| - name: NET - Generate junit html reports | ||
| if: ${{ always() && matrix.platform=='net' }} | ||
| uses: javiertuya/[email protected] | ||
| with: | ||
| net-trx-report: "net/reports/test-result.trx" | ||
| net-surefire-folder: "net/reports/surefire-reports" | ||
| surefire-files: "net/reports/surefire-reports/TEST-*.xml" | ||
| report-dir: net/reports | ||
| - name: Generate report checks | ||
| if: always() | ||
| uses: mikepenz/[email protected] | ||
| with: | ||
| check_name: "test-result-${{ matrix.platform }}-${{ matrix.version }}-${{ matrix.mode }}" | ||
| report_paths: "**/${{ env.REPORT_FOLDER }}/surefire-reports/TEST-*.xml" | ||
| fail_on_failure: 'true' | ||
| - if: always() | ||
| name: Publish test report files | ||
| uses: actions/[email protected] | ||
| with: | ||
| name: "test-report-${{ matrix.platform }}-${{ matrix.version }}-${{ matrix.mode }}-files" | ||
| path: | | ||
| java/target/surefire-reports | ||
| java/target/site | ||
| java/target/selema/**/* | ||
| net/reports | ||
| java/reports/selema/**/* | ||
| - name: JAVA - Reports for Sonar | ||
| if: ${{ always() && matrix.platform=='java' }} | ||
| uses: actions/[email protected] | ||
| with: | ||
| name: "sonar-${{ matrix.platform }}-${{ matrix.version }}-${{ matrix.mode }}" | ||
| path: | | ||
| java/target/surefire-reports | ||
| java/target/site/jacoco/jacoco.xml | ||
| # C# code is converted in the development environment and pushed to the repo, | ||
| # so that there can be incompatible changes in the java side | ||
| # this last step performs conversion with the latest versions and checks compilation is ok | ||
| - name: Verify Conversion from Java to C# | ||
| if: ${{ always() && matrix.platform=='net' && matrix.mode=='headless' }} | ||
| run: | | ||
| echo "*** Check .NET build on converted code" | ||
| dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/javiertuya/index.json" | ||
| dotnet tool install JavaToCSharpCli --global | ||
| dotnet tool list --global | ||
| ant convert | ||
| dotnet build | ||
| # Example using a custom action, see https://github.com/javiertuya/sonarqube-action | ||
| sonarqube: | ||
| needs: [test] | ||
| #if: ${{ false }} # disable for now | ||
| #this job fails when comming from a dependabot PR (can't read the sonarqube token). Discussion and workarounds: | ||
| #https://community.sonarsource.com/t/youre-not-authorized-to-run-analysis-and-github-bots/41994/4 | ||
| #https://github.com/dependabot/dependabot-core/issues/3253#issuecomment-797125425 | ||
| if: ${{ github.actor != 'dependabot[bot]' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: javiertuya/[email protected] | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| sonar-token: ${{ secrets.SONAR_TOKEN }} | ||
| working-directory: java | ||
| restore-artifact-name1: "sonar-java-base-headless" | ||
| restore-artifact-path1: "target-headless" | ||
| #restore-artifact-name2: "sonar-java-base-selenoid" | ||
| #restore-artifact-path2: "target-selenoid" | ||
| restore-artifact-name3: "sonar-java-base-grid" | ||
| restore-artifact-path3: "target-grid" | ||
| restore-artifact-name4: "sonar-java-base-preload-local" | ||
| restore-artifact-path4: "target-preload-local" | ||
| restore-artifact-name5: "sonar-java-base-vcmock-local" | ||
| restore-artifact-path5: "target-vcmock-local" | ||
| restore-artifact-name6: "sonar-java-base-preload-remote" | ||
| restore-artifact-path6: "target-preload-remote" | ||
| restore-artifact-name7: "sonar-java-base-vcmock-remote" | ||
| restore-artifact-path7: "target-vcmock-remote" | ||
| #don't restore java reports using versions different from 'base' | ||
| publish-java-snapshot: | ||
| #avoid publishing PRs and dependabot branches | ||
| if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/dashgit/combined/') }} | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: java | ||
| steps: | ||
| - uses: javiertuya/[email protected] | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| working-directory: java | ||
| java-version: '11' #artifactes are built with java 11 for compatibility | ||
| mvn-deploy-args: '-P publish-github -DskipTests=true -Dmaven.test.failure.ignore=false -U --no-transfer-progress' | ||
| delete-old-snapshots: true | ||
| min-snapshots-to-keep: 4 | ||