Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 92 additions & 14 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,103 @@ on:
push:
branches: [master]
workflow_dispatch:
pull_request:
branches: [master]

jobs:
notify-app:
tests-on-push:
if: github.event_name == 'push'
runs-on: ubuntu-latest
strategy:
matrix:
event_type:
- iOS-ReactNativeClassic
- Android-ReactNativeClassic
- iOS-ReactNativeExpo
- Android-ReactNativeExpo
steps:
- name: Dispatch ${{ matrix.event_type }}
- name: Dispatch App Build
run: |
set -euo pipefail
curl -sS --fail-with-body -X POST \
-H "Authorization: Bearer ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d '{"event_type": "iOS-ReactNativeClassic", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
curl -sS --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d '{"event_type": "Android-ReactNativeClassic", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
curl -sS --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d '{"event_type": "iOS-ReactNativeExpo", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
curl -sS --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d '{"event_type": "Android-ReactNativeExpo", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'

tests-on-pr:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Dispatch App Build
run: |
curl -sS --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d "$(jq -n \
--arg et 'iOS-ReactNativeClassic' \
--arg prnum '${{ github.event.pull_request.number }}' \
--arg sh '${{ github.event.pull_request.head.sha }}' \
'{event_type:$et, client_payload:{pr:$prnum, sha:$sh}}')"
curl -sS --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d "$(jq -n \
--arg et 'Android-ReactNativeClassic' \
--arg prnum '${{ github.event.pull_request.number }}' \
--arg sh '${{ github.event.pull_request.head.sha }}' \
'{event_type:$et, client_payload:{pr:$prnum, sha:$sh}}')"
curl -sS --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d "$(jq -n \
--arg et 'iOS-ReactNativeExpo' \
--arg prnum '${{ github.event.pull_request.number }}' \
--arg sh '${{ github.event.pull_request.head.sha }}' \
'{event_type:$et, client_payload:{pr:$prnum, sha:$sh}}')"
curl -sS --fail-with-body -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d "$(jq -n \
--arg et 'Android-ReactNativeExpo' \
--arg prnum '${{ github.event.pull_request.number }}' \
--arg sh '${{ github.event.pull_request.head.sha }}' \
'{event_type:$et, client_payload:{pr:$prnum, sha:$sh}}')"

tests-manual:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Dispatch App Build
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d '{"event_type": "iOS-ReactNativeClassic", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
curl -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d '{"event_type": "Android-ReactNativeClassic", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
curl -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d '{"event_type": "iOS-ReactNativeExpo", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'
curl -X POST \
-H "Authorization: token ${{ secrets.AUTOMATION_ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/trycourier/mobile-automation-tests/dispatches \
-d "$(jq -n --arg et "${{ matrix.event_type }}" \
'{event_type: $et, client_payload: { dummy_payload: "some_value_todo_logic" } }')"
-d '{"event_type": "Android-ReactNativeExpo", "client_payload": {"sha":"'"${{ github.sha }}"'","ref":"'"${{ github.ref }}"'"}}'