| name: Snapshot tests |
| |
| on: |
| workflow_run: |
| workflows: ['Build snapshot tests'] |
| types: |
| - completed |
| |
| jobs: |
| snapshot-tests: |
| runs-on: ubuntu-latest |
| steps: |
| - uses: haya14busa/action-workflow_run-status@v1 |
| - name: Download artifact |
| # From https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run |
| uses: actions/github-script@v6 |
| with: |
| script: | |
| let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| run_id: context.payload.workflow_run.id, |
| }); |
| let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { |
| return artifact.name == "apks" |
| })[0]; |
| let download = await github.rest.actions.downloadArtifact({ |
| owner: context.repo.owner, |
| repo: context.repo.repo, |
| artifact_id: matchArtifact.id, |
| archive_format: 'zip', |
| }); |
| let fs = require('fs'); |
| fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/apks.zip`, Buffer.from(download.data)); |
| - name: Unzip artifact |
| run: | |
| unzip apks.zip |
| - name: Run tests |
| uses: emulator-wtf/run-tests@master |
| with: |
| api-token: ${{ secrets.EW_API_TOKEN }} |
| app: debug/snapshot-tests-debug.apk |
| test: androidTest/debug/snapshot-tests-debug-androidTest.apk |
| devices: | |
| model=Pixel2,version=23 |
| model=Pixel2,version=31 |
| outputs-dir: build/test-results |
| directories-to-pull: /sdcard/Download/ |
| - name: Check files |
| run: | |
| ls -l build/test-results/Pixel2_api31/sdcard/Download |
| ls -l build/test-results/Pixel2_api23/sdcard/Download |
| - name: 'Post PR comment' |
| uses: mshick/add-pr-comment@v2 |
| if: github.event.workflow_run.event == 'pull_request' |
| with: |
| message-id: ${{ github.sha }} |
| message: | |
| **Snapshot Tests** |
| **API 23**: [Report](https://happo.io/a/27/report/${{ github.sha }}-android23) [Diff](https://happo.io/a/27/p/27/compare/master-android23/${{ github.sha }}-android23) |
| **API 31**: [Report](https://happo.io/a/27/report/${{ github.sha }}-android31) [Diff](https://happo.io/a/27/p/27/compare/master-android31/${{ github.sha }}-android31) |
| - name: "Deploy Snapshot" |
| env: |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} |
| run: ./deploy_snapshot.sh |