Skip to content

Commit 697e738

Browse files
author
Christian Melchior
authored
Add support for Github Actions (#881)
1 parent ba6d423 commit 697e738

File tree

57 files changed

+3406
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3406
-315
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: 'Run Android tests on Device Farm'
2+
inputs:
3+
apk-path:
4+
required: true
5+
apk-auxiliary-path:
6+
description: 'Install additional APKs needed for the tests'
7+
default: ''
8+
required: false
9+
baas_url:
10+
description: 'URL of the test server to be used'
11+
required: true
12+
type: string
13+
app-id:
14+
description: 'The test runner class to use'
15+
required: true
16+
project-arn:
17+
required: true
18+
device-pool-arn:
19+
required: true
20+
arguments:
21+
default: _
22+
outputs:
23+
test-results-path:
24+
value: ${{ steps.get-test-results.outputs.results-path }}
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Run the tests
29+
uses: nhachicha/aws-devicefarm/test-application@master
30+
31+
id: run-tests
32+
with:
33+
project_arn: ${{ inputs.project-arn }}
34+
device_pool_arn: ${{ inputs.device-pool-arn }}
35+
app_file: ${{ inputs.apk-path }}
36+
app_auxiliary_files: ${{ inputs.apk-auxiliary-path }}
37+
app_type: ANDROID_APP
38+
test_type: APPIUM_PYTHON
39+
test_package_file: https://github.com/realm/aws-devicefarm-sample-data/releases/download/0.3/sample_env_python3.zip
40+
test_package_type: APPIUM_PYTHON_TEST_PACKAGE
41+
test_spec_file: test_spec-${{ inputs.app-id }}.yaml
42+
test_spec_type: APPIUM_PYTHON_TEST_SPEC
43+
remote_src: true
44+
test_spec: |
45+
version: 0.1
46+
phases:
47+
install:
48+
commands:
49+
- export PYTHON_VERSION=3
50+
test:
51+
commands:
52+
- adb shell pm list packages | grep realm
53+
- 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]?\)'
54+
55+
- run: |
56+
Install-Module -Name AWSPowerShell -Force
57+
echo "::group::Data"
58+
echo (ConvertFrom-Json '${{ steps.run-tests.outputs.data }}' | ConvertTo-Json)
59+
echo "::endgroup::"
60+
Import-Module AWSPowerShell
61+
$runs = Get-DFRunList -Arn ${{ inputs.project-arn }}
62+
$jobs = Get-DFJobList -Arn $runs[0].Arn
63+
$suites = Get-DFSuiteList -Arn $jobs[0].Arn
64+
$fileArtifacts = Get-DFArtifactList -Arn $suites[1].Arn -Type File
65+
echo "All File Artifacts:"
66+
echo $fileArtifacts
67+
$logCatArtifacts = $fileArtifacts | Where-Object { $_.Name -EQ "Logcat" }
68+
if ($logCatArtifacts) {
69+
echo "LogCat Artifacts:"
70+
echo $logCatArtifacts
71+
echo "::group::Logcat"
72+
Invoke-WebRequest -Uri $logCatArtifacts[0].Url | Select-Object -Expand RawContent
73+
echo "::endgroup::"
74+
} else {
75+
Write-Warning "No logCatArtifacts found."
76+
}
77+
78+
shell: pwsh
79+
if: always()
80+
name: Device Farm Output

.github/workflows/auto-merge-branches.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ jobs:
2727
id: find-target-branch
2828
shell: sh
2929
run: |
30-
if [ "${GITHUB_REF#refs/heads/}" = "main" ]; then echo '::set-output name=branch::releases/ktor2-support'; fi
31-
if [ "${GITHUB_REF#refs/heads/}" = "releases" ]; then echo '::set-output name=branch::${{ github.event.repository.default_branch }}'; fi
30+
if [ "${GITHUB_REF#refs/heads/}" = "releases" ]; then echo 'branch=${{ github.event.repository.default_branch }}' >> $GITHUB_OUTPUT; fi
3231
3332
# Unconditionally create a PR with the changes that needs to be manually reviewed.
3433
# https://cli.github.com/manual/gh_pr_create

0 commit comments

Comments
 (0)