Only run e2e tests on android for PR (to lower costs, choice up to you) #9
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
name: Deploy to Production | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .nvmrc | |
- name: Cache dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
**/node_modules | |
.yarn/cache | |
.yarn/install-state.gz | |
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install | |
- name: Run tests | |
run: yarn test | |
- name: Setup EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
eas-version: latest | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: Create preview | |
uses: expo/expo-github-action/preview@v8 | |
id: preview | |
with: | |
command: eas update --auto | |
comment: false | |
- name: E2E tests with Maestro | |
run: | | |
curl -Ls "https://get.maestro.mobile.dev" | bash | |
export PATH="$PATH":"$HOME/.maestro/bin" | |
yarn test:e2e:ci:ios --ios-update-id ${{ steps.preview.outputs.iosId }} --apiKey ${{ secrets.MAESTRO_API_KEY }} --tags pr,weekly,deploy --name Deploy | |
yarn test:e2e:ci:android --android-update-id ${{ steps.preview.outputs.androidId }} --apiKey ${{ secrets.MAESTRO_API_KEY }} --tags pr,weekly,deploy --name Deploy | |
- name: Deploy to Production | |
run: | | |
# Uncomment the following lines to build and submit to the app store | |
# eas build --platform all --profile production | |
# eas submit --platform all --profile production | |
echo "Successfully built and submitted to the app store" |