| name: Snapshot tests |
| |
| on: |
| workflow_run: |
| workflows: [Validate] |
| types: |
| - completed |
| |
| jobs: |
| snapshot-tests: |
| runs-on: ubuntu-latest |
| steps: |
| - name: 'Download artifact' |
| uses: actions/github-script@v6 |
| with: |
| script: | |
| # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run |
| 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 |
| ls -l |
| ls -l apks |
| - name: Run tests |
| uses: emulator-wtf/run-tests@master |
| with: |
| api-token: ${{ secrets.EW_API_TOKEN }} |
| app: apks/snapshot-tests-debug.apk |
| test: apks/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: 'Post PR comment' |
| uses: mshick/add-pr-comment@v2 |
| if: github.event_name == '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) |