-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Github Actions (#881)
- Loading branch information
Christian Melchior
authored
Jan 30, 2024
1 parent
ba6d423
commit 697e738
Showing
57 changed files
with
3,406 additions
and
315 deletions.
There are no files selected for viewing
This file contains 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,80 @@ | ||
name: 'Run Android tests on Device Farm' | ||
inputs: | ||
apk-path: | ||
required: true | ||
apk-auxiliary-path: | ||
description: 'Install additional APKs needed for the tests' | ||
default: '' | ||
required: false | ||
baas_url: | ||
description: 'URL of the test server to be used' | ||
required: true | ||
type: string | ||
app-id: | ||
description: 'The test runner class to use' | ||
required: true | ||
project-arn: | ||
required: true | ||
device-pool-arn: | ||
required: true | ||
arguments: | ||
default: _ | ||
outputs: | ||
test-results-path: | ||
value: ${{ steps.get-test-results.outputs.results-path }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Run the tests | ||
uses: nhachicha/aws-devicefarm/test-application@master | ||
|
||
id: run-tests | ||
with: | ||
project_arn: ${{ inputs.project-arn }} | ||
device_pool_arn: ${{ inputs.device-pool-arn }} | ||
app_file: ${{ inputs.apk-path }} | ||
app_auxiliary_files: ${{ inputs.apk-auxiliary-path }} | ||
app_type: ANDROID_APP | ||
test_type: APPIUM_PYTHON | ||
test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip | ||
test_package_type: APPIUM_PYTHON_TEST_PACKAGE | ||
test_spec_file: test_spec-${{ inputs.app-id }}.yaml | ||
test_spec_type: APPIUM_PYTHON_TEST_SPEC | ||
remote_src: true | ||
test_spec: | | ||
version: 0.1 | ||
phases: | ||
install: | ||
commands: | ||
- export PYTHON_VERSION=3 | ||
test: | ||
commands: | ||
- adb shell pm list packages | grep realm | ||
- adb shell am instrument -w -e baas_url ${{ inputs.baas_url }} -r ${{ inputs.app-id }}/androidx.test.runner.AndroidJUnitRunner | egrep 'OK \([0-9]+ test[s]?\)' | ||
- run: | | ||
Install-Module -Name AWSPowerShell -Force | ||
echo "::group::Data" | ||
echo (ConvertFrom-Json '${{ steps.run-tests.outputs.data }}' | ConvertTo-Json) | ||
echo "::endgroup::" | ||
Import-Module AWSPowerShell | ||
$runs = Get-DFRunList -Arn ${{ inputs.project-arn }} | ||
$jobs = Get-DFJobList -Arn $runs[0].Arn | ||
$suites = Get-DFSuiteList -Arn $jobs[0].Arn | ||
$fileArtifacts = Get-DFArtifactList -Arn $suites[1].Arn -Type File | ||
echo "All File Artifacts:" | ||
echo $fileArtifacts | ||
$logCatArtifacts = $fileArtifacts | Where-Object { $_.Name -EQ "Logcat" } | ||
if ($logCatArtifacts) { | ||
echo "LogCat Artifacts:" | ||
echo $logCatArtifacts | ||
echo "::group::Logcat" | ||
Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent | ||
echo "::endgroup::" | ||
} else { | ||
Write-Warning "No logCatArtifacts found." | ||
} | ||
shell: pwsh | ||
if: always() | ||
name: Device Farm Output |
This file contains 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
Oops, something went wrong.