-
Notifications
You must be signed in to change notification settings - Fork 15
Added workflow for running test with every PR and upload artifacts #46
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
Open
WSEAutomationTests
wants to merge
2
commits into
main
Choose a base branch
from
user/jdugar/RunCheckInTestWithEveryPR
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: Run CheckInTest with every PR and Upload Logs | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: write # Allow write access to repository contents (e.g., pushing changes) | ||
| pull-requests: write # Allow write access to pull requests (e.g., create or merge PRs) | ||
| issues: write # Allow write access to issues (optional, if needed) | ||
| actions: write # Allow write access to Actions (e.g., update or create workflows) | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Run on ${{ matrix.name }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - name: ASUS-PROART | ||
| label: Asus-ProArt | ||
| - name: MICROSOFT-SURFA | ||
| label: Surface-Pro | ||
| - name: HP-REGIS-PV | ||
| label: HP-REGIS-PV | ||
| runs-on: ${{ matrix.label }} | ||
|
|
||
| steps: | ||
| - name: Check out the repository | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 # Ensures the entire history is checked out (not just the latest commit) | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install pywinauto | ||
| shell: powershell | ||
|
|
||
| - name: Run PowerShell Tests from E2E folder (deACvice ${{ matrix.name }}) | ||
| shell: powershell # Using PowerShell | ||
| continue-on-error: true | ||
| working-directory: E2E # Set working directory to E2E | ||
| run: | | ||
| try { | ||
| .\CheckInTest.ps1 | ||
| } catch { | ||
| Write-Error "Test failed: $_" | ||
| exit 1 | ||
| } | ||
|
|
||
| - name: Find the latest log folder | ||
| if: always() | ||
| id: find-latest-log | ||
| shell: powershell | ||
| working-directory: E2E\logs # Set working directory to E2E\logs | ||
| run: | | ||
| Write-Output "Changed directory to: $PWD" | ||
|
|
||
| $logFolders = Get-ChildItem -Directory | ||
| Write-Output "Log folders found: $($logFolders.Name)" | ||
|
|
||
| $latestLogFolder = $logFolders | Sort-Object LastWriteTime -Descending | Select-Object -First 1 | ||
| Write-Output "Latest log folder: $latestLogFolder" | ||
|
|
||
| # Set the output variable for the path to use in the next step | ||
| echo "LOG_FOLDER_NAME=$latestLogFolder" >> $env:GITHUB_ENV | ||
| echo "LATEST_LOG_FOLDER=$($latestLogFolder.FullName)" >> $env:GITHUB_ENV | ||
|
|
||
| - name: Verify latest log folder contents | ||
| shell: powershell | ||
| run: | | ||
| # Verify the contents of the log folder | ||
| Get-ChildItem -Path "${{ env.LATEST_LOG_FOLDER }}" -Recurse | ||
|
|
||
| - name: Set artifact name | ||
| id: set-artifact-name | ||
| shell: powershell | ||
| run: | | ||
| $artifactName = "${{ env.LOG_FOLDER_NAME }}-${{ matrix.name}}" | ||
| echo "ARTIFACT_NAME=$artifactName" >> $env:GITHUB_ENV | ||
|
|
||
| - name: Upload logs from device ${{ matrix.name}} | ||
| if: ${{ always() && env.LATEST_LOG_FOLDER != '' }} | ||
| uses: actions/[email protected] | ||
| with: | ||
| name: ${{ env.ARTIFACT_NAME }} | ||
| path: ${{ env.LATEST_LOG_FOLDER }}\** # Correct way to reference environment variable | ||
| if-no-files-found: warn # Don't fail if no files are found | ||
| retention-days: 7 # Artifact retention period (optional) | ||
| compression-level: 6 # Optional compression level | ||
| overwrite: true # Overwrite artifact if one with the same name exists | ||
| include-hidden-files: false # Do not include hidden files | ||
|
|
||
| - name: Test Complete on device ${{ matrix.name}} | ||
| if: success() | ||
| run: | | ||
| Write-Output "Test run completed successfully" | ||
|
|
||
| - name: Test Failed on device ${{ matrix.name }} | ||
| if: failure() | ||
| run: | | ||
| Write-Output "Test run failed" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in step name: 'deACvice' appears to be a misspelling of 'device'. Please correct it for clarity.